public static AstNode CreateConstantLoad(object constant) { AstNode ret; if (constant is char) ret = new CharNode(ModuleBuilder.SourceLocation, (char)constant); else if (constant is int) ret = new IntegerNode(ModuleBuilder.SourceLocation, (int)constant); else if (constant is double) ret = new FloatNode(ModuleBuilder.SourceLocation, (double)constant); else ret = new StringNode(ModuleBuilder.SourceLocation, constant.ToString()); return ret; }
public void Accept(CharNode node) { }
public void Accept(CharNode node) { var ch = new HassiumChar(node.Char); if (!module.ObjectPool.ContainsKey(ch.GetHashCode())) module.ObjectPool.Add(ch.GetHashCode(), ch); method.Emit(node.SourceLocation, InstructionType.PushObject, ch.GetHashCode()); }