1 /* ****************************************************************************
3 * Copyright (c) Microsoft Corporation.
5 * This source code is subject to terms and conditions of the Microsoft Public License. A
6 * copy of the license can be found in the License.html file at the root of this distribution. If
7 * you cannot locate the Microsoft Public License, please send an email to
8 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
9 * by the terms of the Microsoft Public License.
11 * You must not remove this notice, or any other, from this software.
14 * ***************************************************************************/
15 using System; using Microsoft;
18 #if !SILVERLIGHT // ComObject
20 using System.Collections.Generic;
22 using System.Linq.Expressions;
24 using Microsoft.Linq.Expressions;
26 using System.Runtime.InteropServices;
27 using System.Diagnostics;
29 using System.Dynamic.Utils;
31 using Microsoft.Scripting.Utils;
35 namespace System.Dynamic {
37 namespace Microsoft.Scripting {
39 internal class ErrorArgBuilder : SimpleArgBuilder {
40 internal ErrorArgBuilder(Type parameterType)
41 : base(parameterType) {
43 Debug.Assert(parameterType == typeof(ErrorWrapper));
46 internal override Expression Marshal(Expression parameter) {
47 // parameter.ErrorCode
48 return Expression.Property(
49 Helpers.Convert(base.Marshal(parameter), typeof(ErrorWrapper)),
54 internal override Expression UnmarshalFromRef(Expression value) {
55 // new ErrorWrapper(value)
56 return base.UnmarshalFromRef(
58 typeof(ErrorWrapper).GetConstructor(new Type[] { typeof(int) }),