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(IntegerNode node)
 {
 }
示例#3
0
 public void Accept(IntegerNode node)
 {
     var i = new HassiumInt(node.Number);
     if (!module.ObjectPool.ContainsKey(i.GetHashCode()))
         module.ObjectPool.Add(i.GetHashCode(), i);
     method.Emit(node.SourceLocation, InstructionType.PushObject, i.GetHashCode());
 }