public Operand buildColon2(final Colon2Node colon2) { Node lhs = colon2.getLeftNode(); // Colon2ImplicitNode - (module|class) Foo. Weird, but it is a wrinkle of AST inheritance. if (lhs == null) return searchConst(colon2.getName()); // Colon2ConstNode (Left::name) return searchModuleForConst(build(lhs), colon2.getName()); }
public Operand buildColon2(final Colon2Node iVisited, IRScope s) { Node leftNode = iVisited.getLeftNode(); final String name = iVisited.getName(); // ENEBO: Does this really happen? if (leftNode == null) return searchConst(s, s, name); if (iVisited instanceof Colon2ConstNode) { // 1. Load the module first (lhs of node) // 2. Then load the constant from the module Operand module = build(leftNode, s); return searchConstInInheritanceHierarchy(s, module, name); } else if (iVisited instanceof Colon2MethodNode) { Colon2MethodNode c2mNode = (Colon2MethodNode)iVisited; List<Operand> args = setupCallArgs(null, s); Variable callResult = s.getNewTemporaryVariable(); Instr callInstr = CallInstr.create(callResult, new MethAddr(c2mNode.getName()), null, args.toArray(new Operand[args.size()]), null); s.addInstr(callInstr); return callResult; } else { throw new NotCompilableException("Not compilable: " + iVisited); } }
public Operand buildColon2(final Colon2Node colon2) { Node lhs = colon2.getLeftNode(); // Colon2ImplicitNode - (module|class) Foo. Weird, but it is a wrinkle of AST inheritance. if (lhs == null) return searchConst(colon2.getName()); // Colon2ConstNode (Left::name) return searchModuleForConst(build(lhs), colon2.getName()); }
public Operand buildColon2(final Colon2Node iVisited, IRScope s) { Node leftNode = iVisited.getLeftNode(); final String name = iVisited.getName(); // ENEBO: Does this really happen? if (leftNode == null) return searchConst(s, s, name); if (iVisited instanceof Colon2ConstNode) { // 1. Load the module first (lhs of node) // 2. Then load the constant from the module Operand module = build(leftNode, s); return searchConstInInheritanceHierarchy(s, module, name); } else if (iVisited instanceof Colon2MethodNode) { Colon2MethodNode c2mNode = (Colon2MethodNode)iVisited; List<Operand> args = setupCallArgs(null, s); Variable callResult = s.getNewTemporaryVariable(); Instr callInstr = CallInstr.create(callResult, new MethAddr(c2mNode.getName()), null, args.toArray(new Operand[args.size()]), null); s.addInstr(callInstr); return callResult; } else { throw new NotCompilableException("Not compilable: " + iVisited); } }
case COMPLEXNODE: return buildComplex((ComplexNode) node); case CONSTDECLNODE: return buildConstDecl((ConstDeclNode) node); case CONSTNODE: return searchConst(((ConstNode) node).getName()); case DASGNNODE: return buildDAsgn((DAsgnNode) node); case DEFINEDNODE: return buildGetDefinition(((DefinedNode) node).getExpressionNode());
case COMPLEXNODE: return buildComplex((ComplexNode) node); case CONSTDECLNODE: return buildConstDecl((ConstDeclNode) node); case CONSTNODE: return searchConst(((ConstNode) node).getName()); case DASGNNODE: return buildDAsgn((DAsgnNode) node); case DEFINEDNODE: return buildGetDefinition(((DefinedNode) node).getExpressionNode());
case COLON3NODE: return buildColon3((Colon3Node) node, s); case CONSTDECLNODE: return buildConstDecl((ConstDeclNode) node, s); case CONSTNODE: return searchConst(s, s, ((ConstNode) node).getName()); case DASGNNODE: return buildDAsgn((DAsgnNode) node, s); case DEFINEDNODE: return buildGetDefinitionBase(((DefinedNode) node).getExpressionNode(), s);
case COLON3NODE: return buildColon3((Colon3Node) node, s); case CONSTDECLNODE: return buildConstDecl((ConstDeclNode) node, s); case CONSTNODE: return searchConst(s, s, ((ConstNode) node).getName()); case DASGNNODE: return buildDAsgn((DAsgnNode) node, s); case DEFINEDNODE: return buildGetDefinitionBase(((DefinedNode) node).getExpressionNode(), s);