Skip to content

Commit

Permalink
[Truffle] Pass {public,private}_constant specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Apr 15, 2015
1 parent caeedd4 commit 97e6e09
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
1 change: 0 additions & 1 deletion spec/truffle/tags/core/module/private_constant_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/module/public_constant_tags.txt

This file was deleted.

Expand Up @@ -1607,9 +1607,11 @@ public PrivateConstantNode(PrivateConstantNode prev) {
public RubyModule privateConstant(RubyModule module, Object[] args) {
notDesignedForCompilation();

for (Object ob : args) {
if (ob instanceof RubySymbol){
module.changeConstantVisibility(this, (RubySymbol) ob, true);
for (Object name : args) {
if (name instanceof RubySymbol) {
module.changeConstantVisibility(this, name.toString(), true);
} else {
throw new UnsupportedOperationException();
}
}
return module;
Expand All @@ -1631,9 +1633,11 @@ public PublicConstantNode(PublicConstantNode prev) {
public RubyModule publicConstant(RubyModule module, Object[] args) {
notDesignedForCompilation();

for (Object ob : args) {
if (ob instanceof RubySymbol){
module.changeConstantVisibility(this, (RubySymbol) ob, false);
for (Object name : args) {
if (name instanceof RubySymbol) {
module.changeConstantVisibility(this, name.toString(), false);
} else {
throw new UnsupportedOperationException();
}
}
return module;
Expand Down
Expand Up @@ -346,17 +346,17 @@ public void alias(Node currentNode, String newName, String oldName) {
}

@TruffleBoundary
public void changeConstantVisibility(Node currentNode, RubySymbol constant, boolean isPrivate) {
public void changeConstantVisibility(Node currentNode, String name, boolean isPrivate) {
RubyNode.notDesignedForCompilation();

RubyConstant rubyConstant = ModuleOperations.lookupConstant(getContext(), LexicalScope.NONE, this, constant.toString());
checkFrozen(currentNode);
RubyConstant rubyConstant = constants.get(name);

if (rubyConstant != null) {
rubyConstant.setPrivate(isPrivate);
newLexicalVersion();
} else {
throw new RaiseException(context.getCoreLibrary().nameErrorUninitializedConstant(this, constant.toString(), currentNode));
throw new RaiseException(context.getCoreLibrary().nameErrorUninitializedConstant(this, name, currentNode));
}
}

Expand Down

0 comments on commit 97e6e09

Please sign in to comment.