Implement XamlNodeQueue, and add couple of missing files.
[mono.git] / mcs / mcs / constant.cs
index 52c76c4190176a1beba74aec1d8a2f0a32ac12da..d9fdbfc328668472ea77e85981aa492472c5b1b1 100644 (file)
 //
 
 using System;
+
+#if STATIC
+using IKVM.Reflection.Emit;
+#else
 using System.Reflection.Emit;
+#endif
 
 namespace Mono.CSharp {
 
@@ -45,10 +50,15 @@ namespace Mono.CSharp {
                /// </summary>
                public abstract object GetValue ();
 
+#if !STATIC
+               //
+               // Returns an object value which is typed to contant type
+               //
                public virtual object GetTypedValue ()
                {
                        return GetValue ();
                }
+#endif
 
                public override void Error_ValueCannotBeConverted (ResolveContext ec, Location loc, TypeSpec target, bool expl)
                {
@@ -180,7 +190,7 @@ namespace Mono.CSharp {
                                        Error_ValueCannotBeConverted (ec, loc, target_type, false);
                                }
 
-                               return New.Constantify (target_type).Resolve (ec);
+                               return New.Constantify (target_type, loc).Resolve (ec);
                        }
                }
 
@@ -249,14 +259,24 @@ namespace Mono.CSharp {
                        // do nothing
                }
 
+               public sealed override Expression Clone (CloneContext clonectx)
+               {
+                       // No cloning is not needed for constants
+                       return this;
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression target)
                {
-                       // CloneTo: Nothing, we do not keep any state on this expression
+                       throw new NotSupportedException ("should not be reached");
                }
 
                public override System.Linq.Expressions.Expression MakeExpression (BuilderContext ctx)
                {
+#if STATIC
+                       return base.MakeExpression (ctx);
+#else
                        return System.Linq.Expressions.Expression.Constant (GetTypedValue (), type.GetMetaInfo ());
+#endif
                }
 
                public new Constant Resolve (ResolveContext rc)
@@ -281,7 +301,8 @@ namespace Mono.CSharp {
                }
        }
 
-       public abstract class IntegralConstant : Constant {
+       public abstract class IntegralConstant : Constant
+       {
                protected IntegralConstant (Location loc) :
                        base (loc)
                {
@@ -1980,7 +2001,7 @@ namespace Mono.CSharp {
 
                        var ac = targetType as ArrayContainer;
                        if (ac != null) {
-                               if (ac.Rank != 1)
+                               if (ac.Rank != 1 || ac.Element.IsArray)
                                        base.EncodeAttributeValue (rc, enc, targetType);
                                else
                                        enc.Stream.Write (uint.MaxValue);
@@ -2019,7 +2040,7 @@ namespace Mono.CSharp {
                        }
 
                        // Exlude internal compiler types
-                       if (targetType == InternalType.AnonymousMethod)
+                       if (targetType.Kind == MemberKind.InternalCompilerType && targetType != InternalType.Dynamic && targetType != InternalType.Null)
                                return null;
 
                        if (!IsLiteral && !Convert.ImplicitStandardConversionExists (this, targetType))