Skip to content
Permalink
Browse files
Revert "[Truffle] Top-level methods should be public by default."
* This reverts commit 6be4fe2.
* They should be private: $ ruby -e 'def m; end; p self.private_methods(false)'
  • Loading branch information
eregon committed Dec 30, 2014
1 parent af77cd9 commit ba273a5ff2039a27aec967a1b4441b0f37d45328
Showing with 1 addition and 1 deletion.
  1. +1 −1 core/src/main/java/org/jruby/truffle/translator/TranslatorDriver.java
@@ -163,7 +163,7 @@ public RubyRootNode parse(RubyNode currentNode, RubyContext context, Source sour

// Set default top-level visibility
if (parserContext == ParserContext.TOP_LEVEL) {
truffleNode = new SetFrameVisibilityNode(context, truffleNode.getSourceSection(), truffleNode, Visibility.PUBLIC);
truffleNode = new SetFrameVisibilityNode(context, truffleNode.getSourceSection(), truffleNode, Visibility.PRIVATE);
}

// Load flip-flop states

4 comments on commit ba273a5

@nirvdrum
Copy link
Contributor

@nirvdrum nirvdrum commented on ba273a5 Dec 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should have a spec for this then. Reverting this change does break specs for ERB because it changes the semantics of eval. But I'm now thinking it's because our notion of top-level isn't correct.

@nirvdrum
Copy link
Contributor

@nirvdrum nirvdrum commented on ba273a5 Dec 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like non-Truffle JRuby gets this wrong, too.

@eregon
Copy link
Member Author

@eregon eregon commented on ba273a5 Dec 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/rubyspec/rubyspec/commit/91ce9f65493a18acc401dc7ded0e79e0226a03c6 should specify the basics of it. Behavior across files probably belongs to load or require.

@eregon
Copy link
Member Author

@eregon eregon commented on ba273a5 Dec 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by da135d7.

Please sign in to comment.