-// Permission is hereby granted, free of charge, to any person obtaining
+//
+// MemberInitExpression.cs
+//
+// Author:
+// Jb Evain (jbevain@novell.com)
+//
+// (C) 2008 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-//
-// Authors:
-// Antonello Provenzano <antonello@deveel.com>
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System;
using System.Collections.ObjectModel;
using System.Reflection;
-namespace System.Linq.Expressions
-{
- public sealed class MemberInitExpression : Expression
- {
- #region .ctor
- internal MemberInitExpression(NewExpression newExpression, ReadOnlyCollection<MemberBinding> bindings)
- : base(ExpressionType.MemberInit, newExpression.Type)
- {
- this.newExpression = newExpression;
- this.bindings = bindings;
+namespace System.Linq.Expressions {
+
+ public sealed class MemberInitExpression : Expression {
+
+ NewExpression new_expression;
+ ReadOnlyCollection<MemberBinding> bindings;
+
+ public NewExpression NewExpression {
+ get { return new_expression; }
}
- #endregion
- #region Fields
- private ReadOnlyCollection<MemberBinding> bindings;
- private NewExpression newExpression;
- #endregion
+ public ReadOnlyCollection<MemberBinding> Bindings {
+ get { return bindings; }
+ }
- #region Properties
- public ReadOnlyCollection<MemberBinding> Bindings
+ internal MemberInitExpression (NewExpression new_expression, ReadOnlyCollection<MemberBinding> bindings)
+ : base (ExpressionType.MemberInit, new_expression.Type)
{
- get { return bindings; }
+ this.new_expression = new_expression;
+ this.bindings = bindings;
}
- public NewExpression NewExpression
+#if !FULL_AOT_RUNTIME
+ internal override void Emit (EmitContext ec)
{
- get { return newExpression; }
+ var local = ec.EmitStored (new_expression);
+ ec.EmitCollection (bindings, local);
+ ec.EmitLoad (local);
}
- #endregion
+#endif
}
-}
\ No newline at end of file
+}