Ejemplo n.º 1
0
 public void EmitLiteralExpression(LiteralExpression node, int si)
 {
     if(node.Value is int)
     {
         this.Text.Emit("movl ${0}, %eax", node.Value);
     }
     else if(node.Value is float)
     {
         var value = (float)node.Value;
         var label = this.ROData.Label(section => section.EmitLong(value.ToIEEE754()));
         this.Text.Emit("flds {0}", label);
     }
     else
     {
         Helper.NotSupported();
     }
 }
		public override void VisitLiteralExpression (LiteralExpression node)
		{
			var value = node.Value;
			if (value == null) {
				WriteKeyword ("null");
				return;
			}

			switch (Type.GetTypeCode (value.GetType ())) {
			case TypeCode.Boolean:
				WriteKeyword ((bool) value ? "true" : "false");
				return;
			case TypeCode.Char:
				WriteLiteral ("'");
				WriteLiteral (value.ToString ());
				WriteLiteral ("'");
				return;
			case TypeCode.String:
				WriteLiteral ("\"");
				WriteLiteral (value.ToString ());
				WriteLiteral ("\"");
				return;
			// complete
			default:
				WriteLiteral (value.ToString ());
				return;
			}
		}
Ejemplo n.º 3
0
		public virtual void VisitLiteralExpression (LiteralExpression node)
		{
		}
Ejemplo n.º 4
0
 public override ICodeNode VisitLiteralExpression(LiteralExpression node)
 {
     node = (LiteralExpression)base.VisitLiteralExpression(node);
     return new TypedLiteralExpression(node.Value);
 }
Ejemplo n.º 5
0
 public virtual ICodeNode VisitLiteralExpression(LiteralExpression node)
 {
     return(node);
 }