public void setModule(RubyModule module) { this.cref = module; for (StaticScope scope = getEnclosingScope(); scope != null; scope = scope.getEnclosingScope()) { if (scope.cref != null) { previousCRefScope = scope; return; } } }
public void setModule(RubyModule module) { this.cref = module; for (StaticScope scope = getEnclosingScope(); scope != null; scope = scope.getEnclosingScope()) { if (scope.cref != null) { previousCRefScope = scope; return; } } }
public void setModule(RubyModule module) { this.cref = module; for (StaticScope scope = getEnclosingScope(); scope != null; scope = scope.getEnclosingScope()) { if (scope.cref != null) { previousCRefScope = scope; return; } } }
public void setModule(RubyModule module) { this.cref = module; for (StaticScope scope = getEnclosingScope(); scope != null; scope = scope.getEnclosingScope()) { if (scope.cref != null) { previousCRefScope = scope; return; } } }
public void popCurrentScope() { currentScope = currentScope.getEnclosingScope(); }
public void popCurrentScope() { currentScope = currentScope.getEnclosingScope(); }
public void popCurrentScope() { currentScope = currentScope.getEnclosingScope(); }
public void popCurrentScope() { currentScope = currentScope.getEnclosingScope(); }
/** * Update current scoping structure to populate with proper cref scoping values. This should * be called at any point when you reference a scope for the first time. For the interpreter * this is done in a small number of places (defnNode, defsNode, and getBlock). The compiler * does this in the same places. * * @return the current cref, though this is largely an implementation detail */ public RubyModule determineModule() { if (cref == null) { cref = getEnclosingScope().determineModule(); assert cref != null : "CRef is always created before determine happens"; previousCRefScope = getEnclosingScope().previousCRefScope; } return cref; }
/** * Update current scoping structure to populate with proper cref scoping values. This should * be called at any point when you reference a scope for the first time. For the interpreter * this is done in a small number of places (defnNode, defsNode, and getBlock). The compiler * does this in the same places. * * @return the current cref, though this is largely an implementation detail */ public RubyModule determineModule() { if (cref == null) { cref = getEnclosingScope().determineModule(); assert cref != null : "CRef is always created before determine happens"; previousCRefScope = getEnclosingScope().previousCRefScope; } return cref; }
/** * Update current scoping structure to populate with proper cref scoping values. This should * be called at any point when you reference a scope for the first time. For the interpreter * this is done in a small number of places (defnNode, defsNode, and getBlock). The compiler * does this in the same places. * * @return the current cref, though this is largely an implementation detail */ public RubyModule determineModule() { if (cref == null) { cref = getEnclosingScope().determineModule(); assert cref != null : "CRef is always created before determine happens"; previousCRefScope = getEnclosingScope().previousCRefScope; } return cref; }
private static IRScope getEvalContainerScope(Ruby runtime, StaticScope evalScope) { // SSS FIXME: Weirdness here. We cannot get the containing IR scope from evalScope because of static-scope wrapping // that is going on // 1. In all cases, DynamicScope.getEvalScope wraps the executing static scope in a new local scope. // 2. For instance-eval (module-eval, class-eval) scenarios, there is an extra scope that is added to // the stack in ThreadContext.java:preExecuteUnder // I dont know what rule to apply when. However, in both these cases, since there is no IR-scope associated, // I have used the hack below where I first unwrap once and see if I get a non-null IR scope. If that doesn't // work, I unwarp once more and I am guaranteed to get the IR scope I want. IRScope containingIRScope = ((IRStaticScope)evalScope.getEnclosingScope()).getIRScope(); if (containingIRScope == null) containingIRScope = ((IRStaticScope)evalScope.getEnclosingScope().getEnclosingScope()).getIRScope(); return containingIRScope; }
/** * Update current scoping structure to populate with proper cref scoping values. This should * be called at any point when you reference a scope for the first time. For the interpreter * this is done in a small number of places (defnNode, defsNode, and getBlock). The compiler * does this in the same places. * * @return the current cref, though this is largely an implementation detail */ public RubyModule determineModule() { if (cref == null) { cref = getEnclosingScope().determineModule(); assert cref != null : "CRef is always created before determine happens"; previousCRefScope = getEnclosingScope().previousCRefScope; } return cref; }
private static IRScope getEvalContainerScope(Ruby runtime, StaticScope evalScope) { // SSS FIXME: Weirdness here. We cannot get the containing IR scope from evalScope because of static-scope wrapping // that is going on // 1. In all cases, DynamicScope.getEvalScope wraps the executing static scope in a new local scope. // 2. For instance-eval (module-eval, class-eval) scenarios, there is an extra scope that is added to // the stack in ThreadContext.java:preExecuteUnder // I dont know what rule to apply when. However, in both these cases, since there is no IR-scope associated, // I have used the hack below where I first unwrap once and see if I get a non-null IR scope. If that doesn't // work, I unwarp once more and I am guaranteed to get the IR scope I want. IRScope containingIRScope = ((IRStaticScope)evalScope.getEnclosingScope()).getIRScope(); if (containingIRScope == null) containingIRScope = ((IRStaticScope)evalScope.getEnclosingScope().getEnclosingScope()).getIRScope(); return containingIRScope; }
public static RubyModule getNthScopeModule(StaticScope scope, int depth) { int n = depth; while (n > 0) { scope = scope.getEnclosingScope(); if (scope.getScopeType() != null) { n--; } } return scope.getModule(); }
public static RubyModule getNthScopeModule(StaticScope scope, int depth) { int n = depth; while (n > 0) { scope = scope.getEnclosingScope(); if (scope.getScopeType() != null) { n--; } } return scope.getModule(); }
@JIT public static RubyFixnum getArgScopeDepth(ThreadContext context, StaticScope currScope) { int i = 0; while (!currScope.isArgumentScope()) { currScope = currScope.getEnclosingScope(); i++; } return context.runtime.newFixnum(i); }
@JIT public static RubyFixnum getArgScopeDepth(ThreadContext context, StaticScope currScope) { int i = 0; while (!currScope.isArgumentScope()) { currScope = currScope.getEnclosingScope(); i++; } return context.runtime.newFixnum(i); }
public void popCurrentScope() { if (!currentScope.isBlockScope()) { lexer.getCmdArgumentState().reset(currentScope.getCommandArgumentStack()); } currentScope = currentScope.getEnclosingScope(); }
public void popCurrentScope() { if (!currentScope.isBlockScope()) { lexer.getCmdArgumentState().reset(currentScope.getCommandArgumentStack()); } currentScope = currentScope.getEnclosingScope(); }