@Override public LocalVariable findExistingLocalVariable(String name, int scopeDepth) { // Look in the nearest non-eval scope's shared eval scope vars first. // If you dont find anything there, look in the nearest non-eval scope's regular vars. LocalVariable lvar = nearestNonEvalScope.evalScopeVars.getVariable(name); if ((lvar != null) || scopeDepth == 0) return lvar; else return nearestNonEvalScope.findExistingLocalVariable(name, scopeDepth-nearestNonEvalScopeDepth-1); }
@Override public LocalVariable findExistingLocalVariable(String name, int scopeDepth) { // Look in the nearest non-eval scope's shared eval scope vars first. // If you dont find anything there, look in the nearest non-eval scope's regular vars. LocalVariable lvar = nearestNonEvalScope.evalScopeVars.getVariable(name); if ((lvar != null) || scopeDepth == 0) return lvar; else return nearestNonEvalScope.findExistingLocalVariable(name, scopeDepth-nearestNonEvalScopeDepth-1); }
@Override protected LocalVariable findExistingLocalVariable(RubySymbol name, int scopeDepth) { LocalVariable lvar = lookupExistingLVar(name); if (lvar != null) return lvar; int newDepth = scopeDepth - 1; if (newDepth >= 0) { lvar = getLexicalParent().findExistingLocalVariable(name, newDepth); if (lvar != null) flags.add(IRFlags.ACCESS_PARENTS_LOCAL_VARIABLES); } return lvar; }
@Override protected LocalVariable findExistingLocalVariable(RubySymbol name, int scopeDepth) { LocalVariable lvar = lookupExistingLVar(name); if (lvar != null) return lvar; int newDepth = scopeDepth - 1; if (newDepth >= 0) { lvar = getLexicalParent().findExistingLocalVariable(name, newDepth); if (lvar != null) flags.add(IRFlags.ACCESS_PARENTS_LOCAL_VARIABLES); } return lvar; }
@Override public LocalVariable findExistingLocalVariable(String name, int scopeDepth) { LocalVariable lvar = localVars.getVariable(name); if (lvar != null) return lvar; int newDepth = isForLoopBody ? scopeDepth : scopeDepth - 1; return newDepth >= 0 ? getLexicalParent().findExistingLocalVariable(name, newDepth) : null; }
@Override public LocalVariable findExistingLocalVariable(String name, int scopeDepth) { LocalVariable lvar = localVars.getVariable(name); if (lvar != null) return lvar; int newDepth = isForLoopBody ? scopeDepth : scopeDepth - 1; return newDepth >= 0 ? getLexicalParent().findExistingLocalVariable(name, newDepth) : null; }
/** * Find or create a local variable. By default, scopes are assumed to * only check current depth. Blocks/Closures override this because they * have special nesting rules. */ public LocalVariable getLocalVariable(String name, int scopeDepth) { LocalVariable lvar = findExistingLocalVariable(name, scopeDepth); if (lvar == null) { lvar = new LocalVariable(name, scopeDepth, localVars.nextSlot); localVars.putVariable(name, lvar); } return lvar; }
/** * Find or create a local variable. By default, scopes are assumed to * only check current depth. Blocks/Closures override this because they * have special nesting rules. */ public LocalVariable getLocalVariable(String name, int scopeDepth) { LocalVariable lvar = findExistingLocalVariable(name, scopeDepth); if (lvar == null) { lvar = new LocalVariable(name, scopeDepth, localVars.nextSlot); localVars.putVariable(name, lvar); } return lvar; }
/** * Find or create a local variable. By default, scopes are assumed to * only check current depth. Blocks/Closures override this because they * have special nesting rules. */ public LocalVariable getLocalVariable(RubySymbol name, int scopeDepth) { LocalVariable lvar = findExistingLocalVariable(name, scopeDepth); if (lvar == null) { lvar = getNewLocalVariable(name, scopeDepth); } else if (lvar.getScopeDepth() != scopeDepth) { lvar = lvar.cloneForDepth(scopeDepth); } return lvar; }
/** * Find or create a local variable. By default, scopes are assumed to * only check current depth. Blocks/Closures override this because they * have special nesting rules. */ public LocalVariable getLocalVariable(RubySymbol name, int scopeDepth) { LocalVariable lvar = findExistingLocalVariable(name, scopeDepth); if (lvar == null) { lvar = getNewLocalVariable(name, scopeDepth); } else if (lvar.getScopeDepth() != scopeDepth) { lvar = lvar.cloneForDepth(scopeDepth); } return lvar; }