Merge pull request #231 from linquize/a853199c497bb0977970974303fac7e42080809d
[mono.git] / mcs / mcs / constant.cs
index 3532c7d33fc85dc2ee58a8090ee5a466467795fa..86250a222af1e33e389e8ae965ccd93b1eee5707 100644 (file)
@@ -7,6 +7,7 @@
 //
 // Copyright 2001-2003 Ximian, Inc.
 // Copyright 2003-2008 Novell, Inc.
+// Copyright 2011 Xamarin Inc
 //
 
 using System;
@@ -78,6 +79,11 @@ namespace Mono.CSharp {
                        return c;
                }
 
+               public override bool ContainsEmitWithAwait ()
+               {
+                       return false;
+               }
+
                public virtual Constant ConvertImplicitly (TypeSpec type)
                {
                        if (this.type == type)
@@ -269,7 +275,7 @@ namespace Mono.CSharp {
                                return this;
 
                        Constant c;
-                       if (TypeManager.IsEnumType (target_type)) {
+                       if (target_type.IsEnum) {
                                c = TryReduce (ec, EnumSpec.GetUnderlyingType (target_type));
                                if (c == null)
                                        return null;
@@ -427,9 +433,9 @@ namespace Mono.CSharp {
                public override void Emit (EmitContext ec)
                {
                        if (Value)
-                               ec.Emit (OpCodes.Ldc_I4_1);
+                               ec.EmitInt (1);
                        else
-                               ec.Emit (OpCodes.Ldc_I4_0);
+                               ec.EmitInt (0);
                }
 
                public override bool IsDefaultValue {
@@ -1945,7 +1951,7 @@ namespace Mono.CSharp {
                public override void Emit (EmitContext ec)
                {
                        if (Value == null) {
-                               ec.Emit (OpCodes.Ldnull);
+                               ec.EmitNull ();
                                return;
                        }
 
@@ -2050,7 +2056,7 @@ namespace Mono.CSharp {
 
                public override void Emit (EmitContext ec)
                {
-                       ec.Emit (OpCodes.Ldnull);
+                       ec.EmitNull ();
 
                        // Only to make verifier happy
                        if (type.IsGenericParameter)
@@ -2152,7 +2158,7 @@ namespace Mono.CSharp {
                        //
                        // Emits null pointer
                        //
-                       ec.Emit (OpCodes.Ldc_I4_0);
+                       ec.EmitInt (0);
                        ec.Emit (OpCodes.Conv_U);
                }
        }