Skip to content

Instantly share code, notes, and snippets.

@headius

headius/.diff Secret

Created January 23, 2020 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/e54e34822c868b3daedd6383fbbc0058 to your computer and use it in GitHub Desktop.
Save headius/e54e34822c868b3daedd6383fbbc0058 to your computer and use it in GitHub Desktop.
diff --git a/core/src/main/java/org/jruby/ir/IRClosure.java b/core/src/main/java/org/jruby/ir/IRClosure.java
index 1449ae9642..d1968e58fa 100644
--- a/core/src/main/java/org/jruby/ir/IRClosure.java
+++ b/core/src/main/java/org/jruby/ir/IRClosure.java
@@ -104,15 +104,16 @@ public class IRClosure extends IRScope {
this.signature = signature;
lexicalParent.addClosure(this);
+ if (staticScope != null) {
+ staticScope.setIRScope(this);
+ staticScope.setScopeType(this.getScopeType());
+ }
+
if (getManager().isDryRun()) {
this.body = null;
} else {
boolean shouldJit = manager.getInstanceConfig().getCompileMode().shouldJIT();
this.body = shouldJit ? new MixedModeIRBlockBody(this, signature) : new InterpretedIRBlockBody(this, signature);
- if (staticScope != null && !isBeginEndBlock) {
- staticScope.setIRScope(this);
- staticScope.setScopeType(this.getScopeType());
- }
}
if (needsCoverage) getFlags().add(IRFlags.CODE_COVERAGE);
diff --git a/core/src/main/java/org/jruby/ir/IREvalScript.java b/core/src/main/java/org/jruby/ir/IREvalScript.java
index a929fb0931..3fbfc9e7ca 100644
--- a/core/src/main/java/org/jruby/ir/IREvalScript.java
+++ b/core/src/main/java/org/jruby/ir/IREvalScript.java
@@ -16,7 +16,7 @@ public class IREvalScript extends IRClosure {
this.fileName = fileName;
- if (!getManager().isDryRun() && staticScope != null) {
+ if (staticScope != null) {
// SSS FIXME: This is awkward!
if (evalType == EvalType.MODULE_EVAL) {
staticScope.setScopeType(getScopeType());
diff --git a/core/src/main/java/org/jruby/ir/IRMethod.java b/core/src/main/java/org/jruby/ir/IRMethod.java
index 31d547ddcc..7d785b53b9 100644
--- a/core/src/main/java/org/jruby/ir/IRMethod.java
+++ b/core/src/main/java/org/jruby/ir/IRMethod.java
@@ -37,7 +37,7 @@ public class IRMethod extends IRScope {
if (needsCodeCoverage) getFlags().add(IRFlags.CODE_COVERAGE);
- if (!getManager().isDryRun() && staticScope != null) {
+ if (staticScope != null) {
staticScope.setIRScope(this);
}
}
diff --git a/core/src/main/java/org/jruby/ir/IRModuleBody.java b/core/src/main/java/org/jruby/ir/IRModuleBody.java
index 444f36c2a2..47b74d7427 100644
--- a/core/src/main/java/org/jruby/ir/IRModuleBody.java
+++ b/core/src/main/java/org/jruby/ir/IRModuleBody.java
@@ -12,8 +12,8 @@ public class IRModuleBody extends IRScope {
this.executesOnce = executesOnce;
- if (!getManager().isDryRun()) {
- if (staticScope != null) staticScope.setIRScope(this);
+ if (staticScope != null) {
+ staticScope.setIRScope(this);
}
}
diff --git a/core/src/main/java/org/jruby/ir/IRScriptBody.java b/core/src/main/java/org/jruby/ir/IRScriptBody.java
index 9c39fb6361..486501e408 100644
--- a/core/src/main/java/org/jruby/ir/IRScriptBody.java
+++ b/core/src/main/java/org/jruby/ir/IRScriptBody.java
@@ -13,7 +13,7 @@ public class IRScriptBody extends IRScope {
this.toplevelScope = null;
this.fileName = sourceName;
- if (!getManager().isDryRun() && staticScope != null) {
+ if (staticScope != null) {
staticScope.setIRScope(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment