@Override public int getNextClosureId() { return getLexicalParent().getNextClosureId(); }
@Override public int getNextClosureId() { return getLexicalParent().getNextClosureId(); }
@Override public int getNextClosureId() { return getLexicalParent().getNextClosureId(); }
@Override public int getNextClosureId() { return getLexicalParent().getNextClosureId(); }
@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; }
public LocalVariable getNewLocalVariable(String name, int depth) { if (isForLoopBody) return getLexicalParent().getNewLocalVariable(name, depth); if (depth == 0) { LocalVariable lvar = new ClosureLocalVariable(this, name, 0, localVars.nextSlot); localVars.putVariable(name, lvar); return lvar; } else { return getLexicalParent().getNewLocalVariable(name, depth-1); } }
@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; }
public LocalVariable getNewLocalVariable(String name, int depth) { if (isForLoopBody) return getLexicalParent().getNewLocalVariable(name, depth); if (depth == 0) { LocalVariable lvar = new ClosureLocalVariable(this, name, 0, localVars.nextSlot); localVars.putVariable(name, lvar); return lvar; } else { return getLexicalParent().getNewLocalVariable(name, depth-1); } }
@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; }
public IRMethod convertToMethod(RubySymbol name) { // We want variable scoping to be the same as a method and not see outside itself. if (source == null || getFlags().contains(IRFlags.ACCESS_PARENTS_LOCAL_VARIABLES) || // Built methods cannot search down past method scope getFlags().contains(IRFlags.RECEIVES_CLOSURE_ARG) || // we pass in captured block at define_method as block so explicits ones not supported !isNestedClosuresSafeForMethodConversion()) { source = null; return null; } DefNode def = source; source = null; // FIXME: This should be bytelist from param vs being made (see above). return new IRMethod(getManager(), getLexicalParent(), def, name, true, getLine(), getStaticScope(), getFlags().contains(IRFlags.CODE_COVERAGE)); }
public IRMethod convertToMethod(RubySymbol name) { // We want variable scoping to be the same as a method and not see outside itself. if (source == null || getFlags().contains(IRFlags.ACCESS_PARENTS_LOCAL_VARIABLES) || // Built methods cannot search down past method scope getFlags().contains(IRFlags.RECEIVES_CLOSURE_ARG) || // we pass in captured block at define_method as block so explicits ones not supported !isNestedClosuresSafeForMethodConversion()) { source = null; return null; } DefNode def = source; source = null; // FIXME: This should be bytelist from param vs being made (see above). return new IRMethod(getManager(), getLexicalParent(), def, name, true, getLine(), getStaticScope(), getFlags().contains(IRFlags.CODE_COVERAGE)); }
@Override public LocalVariable getLocalVariable(String name, int scopeDepth) { if (isForLoopBody) return getLexicalParent().getLocalVariable(name, scopeDepth); LocalVariable lvar = findExistingLocalVariable(name, scopeDepth); if (lvar == null) lvar = getNewLocalVariable(name, scopeDepth); // Create a copy of the variable usable at the right depth if (lvar.getScopeDepth() != scopeDepth) lvar = lvar.cloneForDepth(scopeDepth); return lvar; }
@Override public LocalVariable getLocalVariable(String name, int scopeDepth) { if (isForLoopBody) return getLexicalParent().getLocalVariable(name, scopeDepth); LocalVariable lvar = findExistingLocalVariable(name, scopeDepth); if (lvar == null) lvar = getNewLocalVariable(name, scopeDepth); // Create a copy of the variable usable at the right depth if (lvar.getScopeDepth() != scopeDepth) lvar = lvar.cloneForDepth(scopeDepth); return lvar; }
@Override public void setName(RubySymbol name) { ByteList newName = getLexicalParent().getName().getBytes().dup(); newName.append(name.getBytes()); super.setName(getManager().getRuntime().newSymbol(newName)); }
@Override public void setName(RubySymbol name) { ByteList newName = getLexicalParent().getName().getBytes().dup(); newName.append(name.getBytes()); super.setName(getManager().getRuntime().newSymbol(newName)); }