Skip to content

Commit

Permalink
[Truffle] Don't remove an autoloaded constant on failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Feb 18, 2015
1 parent 17e56c7 commit 1f9f9f8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion spec/truffle/tags/core/module/autoload_tags.txt
Expand Up @@ -2,7 +2,6 @@ fails:Module#autoload loads the registered constant when it is opened as a class
fails:Module#autoload loads the registered constant when it is opened as a module
fails:Module#autoload does not load the file if the file is manually required
fails:Module#autoload ignores the autoload request if the file is already loaded
fails:Module#autoload does not remove the constant from the constant table if load fails
fails:Module#autoload does not remove the constant from the constant table if the loaded files does not define it
fails:Module#autoload loads the file when opening a module that is the autoloaded constant
fails:Module#autoload looks up the constant when in a meta class scope
Expand Down
Expand Up @@ -207,8 +207,6 @@ private Object doRubyBasicObject(
requireNode = insert(KernelNodesFactory.RequireNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{}));
}

module.removeConstant(this, (String) methodName);

requireNode.require((RubyString) constant.getValue());

return doRubyBasicObject(frame, first, receiverObject, methodName, blockObject, argumentsObjects);
Expand Down
Expand Up @@ -211,6 +211,7 @@ private void setConstantInternal(RubyNode currentNode, String name, Object value
getConstants().put(name, new RubyConstant(this, value, false, autoload));
} else {
// TODO(CS): warn when redefining a constant
// TODO (nirvdrum 18-Feb-15): But don't warn when redefining an autoloaded constant.
getConstants().put(name, new RubyConstant(this, value, previous.isPrivate(), autoload));
}

Expand Down

0 comments on commit 1f9f9f8

Please sign in to comment.