private Operand findContainerModule() { int nearestModuleBodyDepth = scope.getNearestModuleReferencingScopeDepth(); return (nearestModuleBodyDepth == -1) ? scope.getCurrentModuleVariable() : ScopeModule.ModuleFor(nearestModuleBodyDepth); }
private Operand findContainerModule(IRScope s) { IRScope nearestModuleBody = s.getNearestModuleReferencingScope(); return (nearestModuleBody == null) ? s.getCurrentModuleVariable() : new ScopeModule(nearestModuleBody); }
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); }
private void addCurrentScopeAndModule() { addInstr(new CopyInstr(scope.getCurrentScopeVariable(), CurrentScope.INSTANCE)); // %current_scope addInstr(new CopyInstr(scope.getCurrentModuleVariable(), SCOPE_MODULE[0])); // %current_module }
private void addCurrentScopeAndModule() { addInstr(new CopyInstr(scope.getCurrentScopeVariable(), CurrentScope.INSTANCE)); // %current_scope addInstr(new CopyInstr(scope.getCurrentModuleVariable(), SCOPE_MODULE[0])); // %current_module }
lastVarUseOrDef.put((TemporaryVariable)s.getCurrentModuleVariable(), iCount);
lastVarUseOrDef.put((TemporaryVariable)s.getCurrentModuleVariable(), iCount);
private Operand buildSuperInstr(Operand block, Operand[] args) { CallInstr superInstr; Variable ret = createTemporaryVariable(); if (scope instanceof IRMethod && scope.getLexicalParent() instanceof IRClassBody) { if (((IRMethod) scope).isInstanceMethod) { superInstr = new InstanceSuperInstr(scope, ret, scope.getCurrentModuleVariable(), getName(), args, block, scope.maybeUsingRefinements()); } else { superInstr = new ClassSuperInstr(scope, ret, scope.getCurrentModuleVariable(), getName(), args, block, scope.maybeUsingRefinements()); } } else { // We dont always know the method name we are going to be invoking if the super occurs in a closure. // This is because the super can be part of a block that will be used by 'define_method' to define // a new method. In that case, the method called by super will be determined by the 'name' argument // to 'define_method'. superInstr = new UnresolvedSuperInstr(scope, ret, buildSelf(), args, block, scope.maybeUsingRefinements()); } receiveBreakException(block, superInstr); return ret; }
private Operand buildSuperInstr(Operand block, Operand[] args) { CallInstr superInstr; Variable ret = createTemporaryVariable(); if (scope instanceof IRMethod && scope.getLexicalParent() instanceof IRClassBody) { if (((IRMethod) scope).isInstanceMethod) { superInstr = new InstanceSuperInstr(scope, ret, scope.getCurrentModuleVariable(), getName(), args, block, scope.maybeUsingRefinements()); } else { superInstr = new ClassSuperInstr(scope, ret, scope.getCurrentModuleVariable(), getName(), args, block, scope.maybeUsingRefinements()); } } else { // We dont always know the method name we are going to be invoking if the super occurs in a closure. // This is because the super can be part of a block that will be used by 'define_method' to define // a new method. In that case, the method called by super will be determined by the 'name' argument // to 'define_method'. superInstr = new UnresolvedSuperInstr(scope, ret, buildSelf(), args, block, scope.maybeUsingRefinements()); } receiveBreakException(block, superInstr); return ret; }
private Operand buildSuperInstr(IRScope s, Operand block, Operand[] args) { CallInstr superInstr; Variable ret = s.getNewTemporaryVariable(); if ((s instanceof IRMethod) && (s.getLexicalParent() instanceof IRClassBody)) { IRMethod m = (IRMethod)s; if (m.isInstanceMethod) { superInstr = new InstanceSuperInstr(ret, s.getCurrentModuleVariable(), new MethAddr(s.getName()), args, block); } else { superInstr = new ClassSuperInstr(ret, s.getCurrentModuleVariable(), new MethAddr(s.getName()), args, block); } } else { // We dont always know the method name we are going to be invoking if the super occurs in a closure. // This is because the super can be part of a block that will be used by 'define_method' to define // a new method. In that case, the method called by super will be determined by the 'name' argument // to 'define_method'. superInstr = new UnresolvedSuperInstr(ret, getSelf(s), args, block); } receiveBreakException(s, block, superInstr); return ret; }
private Operand buildSuperInstr(IRScope s, Operand block, Operand[] args) { CallInstr superInstr; Variable ret = s.getNewTemporaryVariable(); if ((s instanceof IRMethod) && (s.getLexicalParent() instanceof IRClassBody)) { IRMethod m = (IRMethod)s; if (m.isInstanceMethod) { superInstr = new InstanceSuperInstr(ret, s.getCurrentModuleVariable(), new MethAddr(s.getName()), args, block); } else { superInstr = new ClassSuperInstr(ret, s.getCurrentModuleVariable(), new MethAddr(s.getName()), args, block); } } else { // We dont always know the method name we are going to be invoking if the super occurs in a closure. // This is because the super can be part of a block that will be used by 'define_method' to define // a new method. In that case, the method called by super will be determined by the 'name' argument // to 'define_method'. superInstr = new UnresolvedSuperInstr(ret, getSelf(s), args, block); } receiveBreakException(s, block, superInstr); return ret; }
private InterpreterContext buildPrePostExeInner(Node body) { // Set up %current_scope and %current_module addInstr(new CopyInstr(scope.getCurrentScopeVariable(), CurrentScope.INSTANCE)); addInstr(new CopyInstr(scope.getCurrentModuleVariable(), SCOPE_MODULE[0])); build(body); // END does not have either explicit or implicit return, so we add one addInstr(new ReturnInstr(new Nil())); return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildPrePostExeInner(Node body) { // Set up %current_scope and %current_module addInstr(new CopyInstr(scope.getCurrentScopeVariable(), CurrentScope.INSTANCE)); addInstr(new CopyInstr(scope.getCurrentModuleVariable(), SCOPE_MODULE[0])); build(body); // END does not have either explicit or implicit return, so we add one addInstr(new ReturnInstr(new Nil())); return scope.allocateInterpreterContext(instructions); }
addInstr(new CopyInstr(scope.getCurrentModuleVariable(), ScopeModule.ModuleFor(nearestScopeDepth == -1 ? 1 : nearestScopeDepth)));
addInstr(new CopyInstr(scope.getCurrentModuleVariable(), ScopeModule.ModuleFor(nearestScopeDepth == -1 ? 1 : nearestScopeDepth)));
s.addInstr(new InheritanceSearchConstInstr(v, s.getCurrentModuleVariable(), "StandardError", false)); outputExceptionCheck(s, v, exc, caughtLabel);
s.addInstr(new InheritanceSearchConstInstr(v, s.getCurrentModuleVariable(), "StandardError", false)); outputExceptionCheck(s, v, exc, caughtLabel);