Skip to content

Commit

Permalink
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ protected RubyConstant lookupConstant(VirtualFrame frame, DynamicObject module,
@Cached("doLookup(cachedModule, cachedName)") RubyConstant constant,
@Cached("isVisible(cachedModule, constant)") boolean isVisible,
@Cached("createBinaryProfile()") ConditionProfile sameNameProfile) {
if (!isVisible && !ignoreVisibility) {
if (!isVisible) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().nameErrorPrivateConstant(module, name, this));
}
@@ -75,7 +75,7 @@ protected RubyConstant lookupConstantUncached(DynamicObject module, String name)
RubyConstant constant = doLookup(module, name);
boolean isVisible = isVisible(module, constant);

if (!isVisible && !ignoreVisibility) {
if (!isVisible) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().nameErrorPrivateConstant(module, name, this));
}
@@ -102,7 +102,7 @@ protected RubyConstant doLookup(DynamicObject module, String name) {
}

protected boolean isVisible(DynamicObject module, RubyConstant constant) {
return constant == null || constant.isVisibleTo(getContext(), LexicalScope.NONE, module);
return ignoreVisibility || constant == null || constant.isVisibleTo(getContext(), LexicalScope.NONE, module);
}

}

0 comments on commit bef0b75

Please sign in to comment.