Skip to content

Commit

Permalink
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -73,13 +73,11 @@ protected RubyConstant lookupConstant(
@Cached("name") String cachedName,
@Cached("doLookup(cachedModule, cachedName)") RubyConstant constant,
@Cached("isVisible(cachedModule, constant)") boolean isVisible,
@Cached("createBinaryProfile()") ConditionProfile sameNameProfile,
@Cached("createBinaryProfile()") ConditionProfile isVisibleProfile,
@Cached("createBinaryProfile()") ConditionProfile isDeprecatedProfile) {
if (isVisibleProfile.profile(!isVisible)) {
@Cached("createBinaryProfile()") ConditionProfile sameNameProfile) {
if (!isVisible) {
throw new RaiseException(coreExceptions().nameErrorPrivateConstant(module, name, this));
}
if (isDeprecatedProfile.profile(constant != null && constant.isDeprecated())) {
if (constant != null && constant.isDeprecated()) {
warnDeprecatedConstant(frame, name);
}
return constant;
@@ -98,14 +96,16 @@ public Assumption getUnmodifiedAssumption(DynamicObject module) {
}

@Specialization(guards = "isRubyModule(module)")
protected RubyConstant lookupConstantUncached(VirtualFrame frame, DynamicObject module, String name) {
protected RubyConstant lookupConstantUncached(VirtualFrame frame, DynamicObject module, String name,
@Cached("createBinaryProfile()") ConditionProfile isVisibleProfile,
@Cached("createBinaryProfile()") ConditionProfile isDeprecatedProfile) {
RubyConstant constant = doLookup(module, name);
boolean isVisible = isVisible(module, constant);

if (!isVisible) {
if (isVisibleProfile.profile(!isVisible)) {
throw new RaiseException(coreExceptions().nameErrorPrivateConstant(module, name, this));
}
if (constant != null && constant.isDeprecated()) {
if (isDeprecatedProfile.profile(constant != null && constant.isDeprecated())) {
warnDeprecatedConstant(frame, name);
}
return constant;
Original file line number Diff line number Diff line change
@@ -51,25 +51,25 @@ public RubyConstant lookupConstant(VirtualFrame frame, Object module, String nam
@Specialization(assumptions = "getUnmodifiedAssumption(getModule())")
protected RubyConstant lookupConstant(VirtualFrame frame,
@Cached("doLookup()") RubyConstant constant,
@Cached("isVisible(constant)") boolean isVisible,
@Cached("createBinaryProfile()") ConditionProfile isVisibleProfile,
@Cached("createBinaryProfile()") ConditionProfile isDeprecatedProfile) {
if (isVisibleProfile.profile(!isVisible)) {
@Cached("isVisible(constant)") boolean isVisible) {
if (!isVisible) {
throw new RaiseException(coreExceptions().nameErrorPrivateConstant(getModule(), name, this));
}
if (isDeprecatedProfile.profile(constant != null && constant.isDeprecated())) {
if (constant != null && constant.isDeprecated()) {
warnDeprecatedConstant(frame, name);
}
return constant;
}

@Specialization(assumptions = "getUnmodifiedAssumption(getModule())")
protected RubyConstant lookupConstantUncached(VirtualFrame frame) {
protected RubyConstant lookupConstantUncached(VirtualFrame frame,
@Cached("createBinaryProfile()") ConditionProfile isVisibleProfile,
@Cached("createBinaryProfile()") ConditionProfile isDeprecatedProfile) {
RubyConstant constant = doLookup();
if (!isVisible(constant)) {
if (isVisibleProfile.profile(!isVisible(constant))) {
throw new RaiseException(coreExceptions().nameErrorPrivateConstant(getModule(), name, this));
}
if (constant != null && constant.isDeprecated()) {
if (isDeprecatedProfile.profile(constant != null && constant.isDeprecated())) {
warnDeprecatedConstant(frame, name);
}
return constant;

0 comments on commit dc20ea8

Please sign in to comment.