Skip to content

Commit

Permalink
IR: gruesome hack to make sure default listener is conditional for JR…
Browse files Browse the repository at this point in the history
…uby::IR.compiler_debug=true/false
  • Loading branch information
enebo committed Apr 4, 2012
1 parent 827af26 commit f327e0b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/org/jruby/ir/IRManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class IRManager {
private final BooleanLiteral trueObject = new BooleanLiteral(true);
private final BooleanLiteral falseObject = new BooleanLiteral(false);
private Set<CompilerPassListener> passListeners = new HashSet<CompilerPassListener>();
private CompilerPassListener defaultListener = new BasicCompilerPassListener();

public IRManager() {
if (RubyInstanceConfig.IR_COMPILER_DEBUG) addListener(new BasicCompilerPassListener());
}

public Nil getNil() {
Expand All @@ -46,6 +46,13 @@ public List<CompilerPass> getCompilerPasses(IRScope scope) {
}

public Set<CompilerPassListener> getListeners() {
// FIXME: This is ugly but we want to conditionalize output based on JRuby module setting/unsetting
if (RubyInstanceConfig.IR_COMPILER_DEBUG) {
addListener(defaultListener);
} else {
removeListener(defaultListener);
}

return passListeners;
}

Expand Down

0 comments on commit f327e0b

Please sign in to comment.