コード例 #1
0
 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;
 }
コード例 #2
0
 public void Accept(CharNode node)
 {
 }
コード例 #3
0
ファイル: Compiler.cs プロジェクト: GruntTheDivine/Hassium
 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());
 }