Author: jbevain
Date: 2008-01-30 14:25:04 -0500 (Wed, 30 Jan 2008)
New Revision: 94407
Modified:
trunk/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
trunk/mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs
Log:
2008-01-30 Jb Evain <[EMAIL PROTECTED]>
* NewExpression.cs: add Emit support for reference types.
Modified: trunk/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
===================================================================
--- trunk/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
2008-01-30 19:19:51 UTC (rev 94406)
+++ trunk/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
2008-01-30 19:25:04 UTC (rev 94407)
@@ -1,5 +1,9 @@
2008-01-30 Jb Evain <[EMAIL PROTECTED]>
+ * NewExpression.cs: add Emit support for reference types.
+
+2008-01-30 Jb Evain <[EMAIL PROTECTED]>
+
* LambdaExpression.cs, EmitContext.cs: small refactoring.
Extract the different EmitContexts to their own file.
Modified: trunk/mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs
===================================================================
--- trunk/mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs
2008-01-30 19:19:51 UTC (rev 94406)
+++ trunk/mcs/class/System.Core/System.Linq.Expressions/NewExpression.cs
2008-01-30 19:25:04 UTC (rev 94407)
@@ -29,6 +29,7 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection;
+using System.Reflection.Emit;
namespace System.Linq.Expressions {
@@ -63,10 +64,24 @@
this.arguments = arguments;
this.members = members;
}
-
+
internal override void Emit (EmitContext ec)
{
- throw new NotImplementedException ();
+ var ig = ec.ig;
+
+ bool is_value_type = this.Type.IsValueType;
+ if (is_value_type)
+ throw new NotImplementedException ();
+
+ foreach (var arg in arguments)
+ arg.Emit (ec);
+
+ ig.Emit (OpCodes.Newobj, constructor ??
GetDefaultConstructor (this.Type));
}
+
+ static ConstructorInfo GetDefaultConstructor (Type type)
+ {
+ return type.GetConstructor (Type.EmptyTypes);
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches