Operand val = build(node.getValueNode(), s);
return buildConstDeclAssignment(node, s, val);
}
public Operand buildConstDeclAssignment(ConstDeclNode constDeclNode, IRScope s, Operand val) {
Node constNode = constDeclNode.getConstNode();
if (constNode == null) {
// SSS FIXME: Shouldn't we be adding a put const instr. here?
s.getNearestModule().setConstantValue(constDeclNode.getName(), val);
s.getNearestModule().getRootMethod().addInstr(new PutConstInstr(s.getNearestModule(), 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
s.addInstr(new PutConstInstr(getSelf(s), constDeclNode.getName(), val));
}