public static ScopeModule ModuleFor(int depth) { return depth < SCOPE_MODULE.length ? SCOPE_MODULE[depth] : new ScopeModule(depth); }
public static ScopeModule decode(IRReaderDecoder d) { return ModuleFor(d.decodeInt()); }
public void ScopeModule(ScopeModule scopemodule) { print(scopemodule.getScopeModuleDepth()); } public void Self(Self self) { print("%self"); }
case RATIONAL: return Rational.decode(this); case REGEXP: return Regexp.decode(this); case SCOPE_MODULE: return ScopeModule.decode(this); case SELF: return Self.SELF; case SPLAT: return Splat.decode(this);
case RATIONAL: return Rational.decode(this); case REGEXP: return Regexp.decode(this); case SCOPE_MODULE: return ScopeModule.decode(this); case SELF: return Self.SELF; case SPLAT: return Splat.decode(this);
public static ScopeModule ModuleFor(int depth) { return depth < SCOPE_MODULE.length ? SCOPE_MODULE[depth] : new ScopeModule(depth); }
public static ScopeModule decode(IRReaderDecoder d) { return ModuleFor(d.decodeInt()); }
public void ScopeModule(ScopeModule scopemodule) { print(scopemodule.getScopeModuleDepth()); } public void Self(Self self) { print("%self"); }
private Operand findContainerModule(IRScope s) { IRScope nearestModuleBody = s.getNearestModuleReferencingScope(); return (nearestModuleBody == null) ? s.getCurrentModuleVariable() : new ScopeModule(nearestModuleBody); }
private Operand findContainerModule() { int nearestModuleBodyDepth = scope.getNearestModuleReferencingScopeDepth(); return (nearestModuleBodyDepth == -1) ? scope.getCurrentModuleVariable() : ScopeModule.ModuleFor(nearestModuleBodyDepth); }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getScopeModuleDepth()); }
private Operand findContainerModule(IRScope s) { IRScope nearestModuleBody = s.getNearestModuleReferencingScope(); return (nearestModuleBody == null) ? s.getCurrentModuleVariable() : new ScopeModule(nearestModuleBody); }
private Operand findContainerModule() { int nearestModuleBodyDepth = scope.getNearestModuleReferencingScopeDepth(); return (nearestModuleBodyDepth == -1) ? scope.getCurrentModuleVariable() : ScopeModule.ModuleFor(nearestModuleBodyDepth); }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(getScopeModuleDepth()); }
private Operand getContainerFromCPath(Colon3Node cpath, IRScope s) { Operand container; if (cpath instanceof Colon2Node) { Node leftNode = ((Colon2Node) cpath).getLeftNode(); if (leftNode != null) { // Foo::Bar container = build(leftNode, s); } else { // Only name with no left-side Bar <- Note no :: on left container = findContainerModule(s); } } else { //::Bar container = new ScopeModule(manager.getObject()); } return container; }
public Operand classVarContainer(boolean declContext) { /* ------------------------------------------------------------------------------- * We are looking for the nearest enclosing scope that is a non-singleton class body * without running into an eval-scope in between. * * Stop lexical scope walking at an eval script boundary. Evals are essentially * a way for a programmer to splice an entire tree of lexical scopes at the point * where the eval happens. So, when we hit an eval-script boundary at compile-time, * defer scope traversal to when we know where this scope has been spliced in. * ------------------------------------------------------------------------------- */ int n = 0; IRScope cvarScope = scope; while (cvarScope != null && !(cvarScope instanceof IREvalScript) && !cvarScope.isNonSingletonClassBody()) { // For loops don't get their own static scope if (!(cvarScope instanceof IRFor)) { n++; } cvarScope = cvarScope.getLexicalParent(); } if (cvarScope != null && cvarScope.isNonSingletonClassBody()) { return ScopeModule.ModuleFor(n); } else { return addResultInstr(new GetClassVarContainerModuleInstr(createTemporaryVariable(), scope.getCurrentScopeVariable(), declContext ? null : buildSelf())); } }
@Override public void ScopeModule(ScopeModule scopemodule) { jvmMethod().loadStaticScope(); jvmAdapter().pushInt(scopemodule.getScopeModuleDepth()); jvmAdapter().invokestatic(p(Helpers.class), "getNthScopeModule", sig(RubyModule.class, StaticScope.class, int.class)); }
private Operand getContainerFromCPath(Colon3Node cpath, IRScope s) { Operand container; if (cpath instanceof Colon2Node) { Node leftNode = ((Colon2Node) cpath).getLeftNode(); if (leftNode != null) { // Foo::Bar container = build(leftNode, s); } else { // Only name with no left-side Bar <- Note no :: on left container = findContainerModule(s); } } else { //::Bar container = new ScopeModule(manager.getObject()); } return container; }
public Operand classVarContainer(boolean declContext) { /* ------------------------------------------------------------------------------- * We are looking for the nearest enclosing scope that is a non-singleton class body * without running into an eval-scope in between. * * Stop lexical scope walking at an eval script boundary. Evals are essentially * a way for a programmer to splice an entire tree of lexical scopes at the point * where the eval happens. So, when we hit an eval-script boundary at compile-time, * defer scope traversal to when we know where this scope has been spliced in. * ------------------------------------------------------------------------------- */ int n = 0; IRScope cvarScope = scope; while (cvarScope != null && !(cvarScope instanceof IREvalScript) && !cvarScope.isNonSingletonClassBody()) { // For loops don't get their own static scope if (!(cvarScope instanceof IRFor)) { n++; } cvarScope = cvarScope.getLexicalParent(); } if (cvarScope != null && cvarScope.isNonSingletonClassBody()) { return ScopeModule.ModuleFor(n); } else { return addResultInstr(new GetClassVarContainerModuleInstr(createTemporaryVariable(), scope.getCurrentScopeVariable(), declContext ? null : buildSelf())); } }
@Override public void ScopeModule(ScopeModule scopemodule) { jvmMethod().loadStaticScope(); jvmAdapter().pushInt(scopemodule.getScopeModuleDepth()); jvmAdapter().invokestatic(p(Helpers.class), "getNthScopeModule", sig(RubyModule.class, StaticScope.class, int.class)); }