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; }
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 buildConstDeclAssignment(ConstDeclNode constDeclNode, IRScope s, Operand val) { Node constNode = constDeclNode.getConstNode(); if (constNode == null) { s.addInstr(new PutConstInstr(findContainerModule(s), constDeclNode.getName(), val)); } else if (constNode.getNodeType() == NodeType.COLON2NODE) { Operand module = build(((Colon2Node) constNode).getLeftNode(), s); s.addInstr(new PutConstInstr(module, constDeclNode.getName(), val)); } else { // colon3, assign in Object ScopeModule object = new ScopeModule(manager.getObject()); s.addInstr(new PutConstInstr(object, constDeclNode.getName(), val)); } return val; }
public Operand buildConstDeclAssignment(ConstDeclNode constDeclNode, IRScope s, Operand val) { Node constNode = constDeclNode.getConstNode(); if (constNode == null) { s.addInstr(new PutConstInstr(findContainerModule(s), constDeclNode.getName(), val)); } else if (constNode.getNodeType() == NodeType.COLON2NODE) { Operand module = build(((Colon2Node) constNode).getLeftNode(), s); s.addInstr(new PutConstInstr(module, constDeclNode.getName(), val)); } else { // colon3, assign in Object ScopeModule object = new ScopeModule(manager.getObject()); s.addInstr(new PutConstInstr(object, constDeclNode.getName(), val)); } return val; }