@Override public Instr cloneForInlining(InlinerInfo ii) { // SSS FIXME: So, do we clone the class body scope or not? return new DefineClassInstr(ii.getRenamedVariable(result), this.newIRClassBody, container.cloneForInlining(ii), superClass.cloneForInlining(ii)); }
@Override public Instr cloneForInlining(InlinerInfo ii) { // SSS FIXME: So, do we clone the class body scope or not? return new DefineClassInstr(ii.getRenamedVariable(result), this.newIRClassBody, container.cloneForInlining(ii), superClass.cloneForInlining(ii)); }
public static DefineClassInstr decode(IRReaderDecoder d) { return new DefineClassInstr((d.decodeVariable()), (IRClassBody) d.decodeScope(), d.decodeOperand(), d.decodeOperand()); }
public static DefineClassInstr decode(IRReaderDecoder d) { return new DefineClassInstr((d.decodeVariable()), (IRClassBody) d.decodeScope(), d.decodeOperand(), d.decodeOperand()); }
@Override public Instr clone(CloneInfo ii) { return new DefineClassInstr(ii.getRenamedVariable(result), this.newIRClassBody, getContainer().cloneForInlining(ii), getSuperClass().cloneForInlining(ii)); }
@Override public Instr clone(CloneInfo ii) { return new DefineClassInstr(ii.getRenamedVariable(result), this.newIRClassBody, getContainer().cloneForInlining(ii), getSuperClass().cloneForInlining(ii)); }
/** * Build a new class and add it to the current scope (s). */ public Operand buildClass(ClassNode classNode) { Node superNode = classNode.getSuperNode(); Colon3Node cpath = classNode.getCPath(); Operand superClass = (superNode == null) ? null : build(superNode); RubySymbol className = cpath.getName(); Operand container = getContainerFromCPath(cpath); IRClassBody body = new IRClassBody(manager, scope, className, classNode.getLine(), classNode.getScope()); Variable classVar = addResultInstr(new DefineClassInstr(createTemporaryVariable(), body, container, superClass)); Variable processBodyResult = addResultInstr(new ProcessModuleBodyInstr(createTemporaryVariable(), classVar, NullBlock.INSTANCE)); newIRBuilder(manager, body).buildModuleOrClassBody(classNode.getBodyNode(), classNode.getLine(), classNode.getEndLine()); return processBodyResult; }
/** * Build a new class and add it to the current scope (s). */ public Operand buildClass(ClassNode classNode) { Node superNode = classNode.getSuperNode(); Colon3Node cpath = classNode.getCPath(); Operand superClass = (superNode == null) ? null : build(superNode); RubySymbol className = cpath.getName(); Operand container = getContainerFromCPath(cpath); IRClassBody body = new IRClassBody(manager, scope, className, classNode.getLine(), classNode.getScope()); Variable classVar = addResultInstr(new DefineClassInstr(createTemporaryVariable(), body, container, superClass)); Variable processBodyResult = addResultInstr(new ProcessModuleBodyInstr(createTemporaryVariable(), classVar, NullBlock.INSTANCE)); newIRBuilder(manager, body).buildModuleOrClassBody(classNode.getBodyNode(), classNode.getLine(), classNode.getEndLine()); return processBodyResult; }
/** * Build a new class and add it to the current scope (s). */ public Operand buildClass(ClassNode classNode, IRScope s) { Node superNode = classNode.getSuperNode(); Colon3Node cpath = classNode.getCPath(); Operand superClass = (superNode == null) ? null : build(superNode, s); String className = cpath.getName(); Operand container = getContainerFromCPath(cpath, s); IRClassBody c = new IRClassBody(manager, s, className, classNode.getPosition().getLine(), classNode.getScope()); Variable classBody = s.getNewTemporaryVariable(); s.addInstr(new DefineClassInstr(classBody, c, container, superClass)); Variable ret = s.getNewTemporaryVariable(); s.addInstr(new ProcessModuleBodyInstr(ret, classBody)); c.addInstr(new ReceiveSelfInstr(c.getSelf())); // Set %current_scope = <c> // Set %current_module = module<c> c.addInstr(new CopyInstr(c.getCurrentScopeVariable(), new CurrentScope(c))); c.addInstr(new CopyInstr(c.getCurrentModuleVariable(), new ScopeModule(c))); // Create a new nested builder to ensure this gets its own IR builder state Operand rv = newIRBuilder(manager).build(classNode.getBodyNode(), c); if (rv != null) c.addInstr(new ReturnInstr(rv)); return ret; }
/** * Build a new class and add it to the current scope (s). */ public Operand buildClass(ClassNode classNode, IRScope s) { Node superNode = classNode.getSuperNode(); Colon3Node cpath = classNode.getCPath(); Operand superClass = (superNode == null) ? null : build(superNode, s); String className = cpath.getName(); Operand container = getContainerFromCPath(cpath, s); IRClassBody c = new IRClassBody(manager, s, className, classNode.getPosition().getLine(), classNode.getScope()); Variable classBody = s.getNewTemporaryVariable(); s.addInstr(new DefineClassInstr(classBody, c, container, superClass)); Variable ret = s.getNewTemporaryVariable(); s.addInstr(new ProcessModuleBodyInstr(ret, classBody)); c.addInstr(new ReceiveSelfInstr(c.getSelf())); // Set %current_scope = <c> // Set %current_module = module<c> c.addInstr(new CopyInstr(c.getCurrentScopeVariable(), new CurrentScope(c))); c.addInstr(new CopyInstr(c.getCurrentModuleVariable(), new ScopeModule(c))); // Create a new nested builder to ensure this gets its own IR builder state Operand rv = newIRBuilder(manager).build(classNode.getBodyNode(), c); if (rv != null) c.addInstr(new ReturnInstr(rv)); return ret; }