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