コード例 #1
0
        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="CSharpSetIndexBinder" />.
        /// </summary>
        /// <param name="isCompoundAssignment">True if the assignment comes from a compound assignment in source.</param>
        /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param>
        /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param>
        /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
        public CSharpSetIndexBinder(
            bool isCompoundAssignment,
            bool isChecked,
            Type callingContext,
            IEnumerable <CSharpArgumentInfo> argumentInfo) :
            base(BinderHelper.CreateCallInfo(ref argumentInfo, 2)) // discard 2 arguments: the target object and the value
        {
            IsCompoundAssignment = isCompoundAssignment;
            _argumentInfo        = argumentInfo as CSharpArgumentInfo[];
            _callingContext      = callingContext;
            _binder = new RuntimeBinder(callingContext, isChecked);
        }
コード例 #2
0
        //////////////////////////////////////////////////////////////////////


        /// <summary>
        /// Initializes a new instance of the <see cref="SetMemberBinder" />.
        /// </summary>
        /// <param name="name">The name of the member to get.</param>
        /// <param name="isCompoundAssignment">True if the assignment comes from a compound assignment in source.</param>
        /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param>
        /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param>
        /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
        public CSharpSetMemberBinder(
            string name,
            bool isCompoundAssignment,
            bool isChecked,
            Type callingContext,
            IEnumerable <CSharpArgumentInfo> argumentInfo) :
            base(name, false)
        {
            IsCompoundAssignment = isCompoundAssignment;
            _argumentInfo        = BinderHelper.ToArray(argumentInfo);
            _binder = new RuntimeBinder(callingContext, isChecked);
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpGetMemberBinder" />.
 /// </summary>
 /// <param name="name">The name of the member to get.</param>
 /// <param name="resultIndexed">Determines if COM binder should return a callable object.</param>
 /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param>
 /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
 public CSharpGetMemberBinder(
     string name,
     bool resultIndexed,
     Type callingContext,
     IEnumerable <CSharpArgumentInfo> argumentInfo) :
     base(name, false /*caseInsensitive*/)
 {
     ResultIndexed   = resultIndexed;
     _argumentInfo   = BinderHelper.ToArray(argumentInfo);
     _callingContext = callingContext;
     _binder         = new RuntimeBinder(callingContext);
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpUnaryOperationBinder"/> class.
 /// </summary>
 /// <param name="operation">The unary operation kind.</param>
 /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param>
 /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param>
 /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
 public CSharpUnaryOperationBinder(
     ExpressionType operation,
     bool isChecked,
     Type callingContext,
     IEnumerable <CSharpArgumentInfo> argumentInfo) :
     base(operation)
 {
     _argumentInfo = BinderHelper.ToArray(argumentInfo);
     Debug.Assert(_argumentInfo.Length == 1);
     _callingContext = callingContext;
     _binder         = new RuntimeBinder(callingContext, isChecked);
 }
コード例 #5
0
ファイル: CSharpConvertBinder.cs プロジェクト: zwy2014/corefx
 /// <summary>
 /// Initializes a new intsance of the <see cref="CSharpConvertBinder" />.
 /// </summary>
 /// <param name="type">The type to convert to.</param>
 /// <param name="conversionKind">The kind of conversion for this operation.</param>
 /// <param name="isChecked">True if the operation is defined in a checked context; otherwise false.</param>
 public CSharpConvertBinder(
     Type type,
     CSharpConversionKind conversionKind,
     bool isChecked,
     Type callingContext) :
     base(type, conversionKind == CSharpConversionKind.ExplicitConversion)
 {
     _conversionKind = conversionKind;
     _isChecked      = isChecked;
     _callingContext = callingContext;
     _binder         = RuntimeBinder.GetInstance();
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpGetMemberBinder" />.
 /// </summary>
 /// <param name="name">The name of the member to get.</param>
 /// <param name="resultIndexed">Determines if COM binder should return a callable object.</param>
 /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param>
 /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
 public CSharpGetMemberBinder(
     string name,
     bool resultIndexed,
     Type callingContext,
     IEnumerable <CSharpArgumentInfo> argumentInfo) :
     base(name, false /*caseInsensitive*/)
 {
     m_bResultIndexed = resultIndexed;
     m_callingContext = callingContext;
     m_argumentInfo   = BinderHelper.ToList(argumentInfo);
     m_binder         = RuntimeBinder.GetInstance();
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpUnaryOperationBinder"/> class.
 /// </summary>
 /// <param name="operation">The unary operation kind.</param>
 /// <param name="isChecked">True if the operation is defined in a checked context; otherwise, false.</param>
 /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
 public CSharpUnaryOperationBinder(
     ExpressionType operation,
     bool isChecked,
     Type callingContext,
     IEnumerable <CSharpArgumentInfo> argumentInfo) :
     base(operation)
 {
     IsChecked      = isChecked;
     CallingContext = callingContext;
     _argumentInfo  = BinderHelper.ToList(argumentInfo);
     Debug.Assert(_argumentInfo.Count == 1);
     _binder = RuntimeBinder.GetInstance();
 }
コード例 #8
0
        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="CSharpSetIndexBinder" />.
        /// </summary>
        /// <param name="isCompoundAssignment">True if the assignment comes from a compound assignment in source.</param>
        /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param>
        /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
        public CSharpSetIndexBinder(
            bool isCompoundAssignment,
            bool isChecked,
            Type callingContext,
            IEnumerable <CSharpArgumentInfo> argumentInfo) :
            base(BinderHelper.CreateCallInfo(argumentInfo, 2)) // discard 2 arguments: the target object and the value
        {
            _bIsCompoundAssignment = isCompoundAssignment;
            _isChecked             = isChecked;
            _callingContext        = callingContext;
            _argumentInfo          = BinderHelper.ToList(argumentInfo);
            _binder = RuntimeBinder.GetInstance();
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpInvokeMemberBinder" />.
 /// </summary>
 /// <param name="flags">Extra information about this operation that is not specific to any particular argument.</param>
 /// <param name="name">The name of the member to invoke.</param>
 /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param>
 /// <param name="typeArguments">The list of user-specified type arguments to this call.</param>
 /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
 public CSharpInvokeMemberBinder(
     CSharpCallFlags flags,
     string name,
     Type callingContext,
     IEnumerable <Type> typeArguments,
     IEnumerable <CSharpArgumentInfo> argumentInfo) :
     base(name, false, BinderHelper.CreateCallInfo(argumentInfo, 1)) // discard 1 argument: the target object (even if static, arg is type)
 {
     Flags          = flags;
     CallingContext = callingContext;
     _typeArguments = BinderHelper.ToList(typeArguments);
     _argumentInfo  = BinderHelper.ToList(argumentInfo);
     _binder        = RuntimeBinder.GetInstance();
 }
コード例 #10
0
        //////////////////////////////////////////////////////////////////////


        /// <summary>
        /// Initializes a new instance of the <see cref="SetMemberBinder" />.
        /// </summary>
        /// <param name="name">The name of the member to get.</param>
        /// <param name="isCompoundAssignment">True if the assignment comes from a compound assignment in source.</param>
        /// <param name="callingContext">The <see cref="System.Type"/> that indicates where this operation is defined.</param>
        /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
        public CSharpSetMemberBinder(
            string name,
            bool isCompoundAssignment,
            bool isChecked,
            Type callingContext,
            IEnumerable <CSharpArgumentInfo> argumentInfo) :
            base(name, false)
        {
            _bIsCompoundAssignment = isCompoundAssignment;
            _isChecked             = isChecked;
            _callingContext        = callingContext;
            _argumentInfo          = BinderHelper.ToList(argumentInfo);
            _binder = RuntimeBinder.GetInstance();
        }
コード例 #11
0
        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="CSharpBinaryOperationBinder"/> class.
        /// </summary>
        /// <param name="operation">The binary operation kind.</param>
        /// <param name="isChecked">True if the operation is defined in a checked context; otherwise false.</param>
        /// <param name="binaryOperationFlags">The flags associated with this binary operation.</param>
        /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
        public CSharpBinaryOperationBinder(
            ExpressionType operation,
            bool isChecked,
            CSharpBinaryOperationFlags binaryOperationFlags,
            Type callingContext,
            IEnumerable <CSharpArgumentInfo> argumentInfo) :
            base(operation)
        {
            m_isChecked      = isChecked;
            m_binopFlags     = binaryOperationFlags;
            m_callingContext = callingContext;
            m_argumentInfo   = BinderHelper.ToList(argumentInfo);
            Debug.Assert(m_argumentInfo.Count == 2);
            m_binder = RuntimeBinder.GetInstance();
        }
コード例 #12
0
        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="CSharpBinaryOperationBinder"/> class.
        /// </summary>
        /// <param name="operation">The binary operation kind.</param>
        /// <param name="isChecked">True if the operation is defined in a checked context; otherwise false.</param>
        /// <param name="binaryOperationFlags">The flags associated with this binary operation.</param>
        /// <param name="callingContext">The <see cref="Type"/> that indicates where this operation is defined.</param>
        /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
        public CSharpBinaryOperationBinder(
            ExpressionType operation,
            bool isChecked,
            CSharpBinaryOperationFlags binaryOperationFlags,
            Type callingContext,
            IEnumerable <CSharpArgumentInfo> argumentInfo) :
            base(operation)
        {
            IsChecked      = isChecked;
            _binopFlags    = binaryOperationFlags;
            CallingContext = callingContext;
            _argumentInfo  = BinderHelper.ToArray(argumentInfo);
            Debug.Assert(_argumentInfo.Length == 2);
            _binder = RuntimeBinder.GetInstance();
        }
コード例 #13
0
ファイル: TypeArray.cs プロジェクト: layomia/dotnet_runtime
        public static TypeArray Allocate(params CType[] types)
        {
            if (types?.Length > 0)
            {
                RuntimeBinder.EnsureLockIsTaken();
                TypeArrayKey key = new TypeArrayKey(types);
                if (!s_tableTypeArrays.TryGetValue(key, out TypeArray result))
                {
                    result = new TypeArray(types);
                    s_tableTypeArrays.Add(key, result);
                }

                return(result);
            }

            return(Empty);
        }
コード例 #14
0
 public static void InsertParameterModifier(CType elementType, bool isOut, ParameterModifierType parameterModifier)
 {
     RuntimeBinder.EnsureLockIsTaken();
     Debug.Assert(LookupParameterModifier(elementType, isOut) == null);
     s_parameterModifierTable.Add(new KeyPair <CType, bool>(elementType, isOut), parameterModifier);
 }
コード例 #15
0
        public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals)
        {
            Expr indexerArguments = runtimeBinder.CreateArgumentListEXPR(arguments, locals, 1, arguments.Length);

            return(runtimeBinder.BindProperty(this, arguments[0], locals[0], indexerArguments));
        }
コード例 #16
0
 public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals)
 => runtimeBinder.DispatchPayload(this, arguments, locals);
コード例 #17
0
 public EXPR DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals)
 => runtimeBinder.BindAssignment(this, arguments, locals);
コード例 #18
0
 public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals)
 {
     Debug.Assert(arguments.Length == 1);
     return(runtimeBinder.BindProperty(this, arguments[0], locals[0], null));
 }
コード例 #19
0
 public static AggregateType LookupAggregate(AggregateSymbol aggregate, AggregateType outer, TypeArray args)
 {
     RuntimeBinder.EnsureLockIsTaken();
     s_aggregateTable.TryGetValue(MakeKey(aggregate, MakeKey(outer, args)), out AggregateType result);
     return(result);
 }
コード例 #20
0
 public static Symbol LookupSym(Name name, ParentSymbol parent, symbmask_t kindmask)
 {
     RuntimeBinder.EnsureLockIsTaken();
     return(s_dictionary.TryGetValue(new Key(name, parent), out Symbol sym) ? FindCorrectKind(sym, kindmask) : null);
 }
コード例 #21
0
 public static void InsertAggregate(AggregateSymbol aggregate, AggregateType outer, TypeArray args, AggregateType ats)
 {
     RuntimeBinder.EnsureLockIsTaken();
     Debug.Assert(LookupAggregate(aggregate, outer, args) == null);
     s_aggregateTable.Add(MakeKey(aggregate, MakeKey(outer, args)), ats);
 }
コード例 #22
0
        internal static DynamicMetaObject Bind(
            ICSharpBinder action,
            RuntimeBinder binder,
            DynamicMetaObject[] args,
            IEnumerable <CSharpArgumentInfo> arginfos,
            DynamicMetaObject onBindingError)
        {
            Expression[]        parameters   = new Expression[args.Length];
            BindingRestrictions restrictions = BindingRestrictions.Empty;
            ICSharpInvokeOrInvokeMemberBinder callPayload = action as ICSharpInvokeOrInvokeMemberBinder;
            ParameterExpression tempForIncrement          = null;
            IEnumerator <CSharpArgumentInfo> arginfosEnum = (arginfos ?? Array.Empty <CSharpArgumentInfo>()).GetEnumerator();

            for (int index = 0; index < args.Length; ++index)
            {
                DynamicMetaObject o = args[index];
                // Our contract with the DLR is such that we will not enter a bind unless we have
                // values for the meta-objects involved.

                Debug.Assert(o.HasValue);

                CSharpArgumentInfo info = arginfosEnum.MoveNext() ? arginfosEnum.Current : null;

                if (index == 0 && IsIncrementOrDecrementActionOnLocal(action))
                {
                    // We have an inc or a dec operation. Insert the temp local instead.
                    //
                    // We need to do this because for value types, the object will come
                    // in boxed, and we'd need to unbox it to get the original type in order
                    // to increment. The only way to do that is to create a new temporary.
                    object value = o.Value;
                    tempForIncrement = Expression.Variable(value != null ? value.GetType() : typeof(object), "t0");
                    parameters[0]    = tempForIncrement;
                }
                else
                {
                    parameters[index] = o.Expression;
                }

                BindingRestrictions r = DeduceArgumentRestriction(index, callPayload, o, info);
                restrictions = restrictions.Merge(r);

                // Here we check the argument info. If the argument info shows that the current argument
                // is a literal constant, then we also add an instance restriction on the value of
                // the constant.
                if (info != null && info.LiteralConstant)
                {
                    if (o.Value is double && double.IsNaN((double)o.Value))
                    {
                        MethodInfo isNaN = s_DoubleIsNaN ?? (s_DoubleIsNaN = typeof(double).GetMethod("IsNaN"));
                        Expression e     = Expression.Call(null, isNaN, o.Expression);
                        restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(e));
                    }
                    else if (o.Value is float && float.IsNaN((float)o.Value))
                    {
                        MethodInfo isNaN = s_SingleIsNaN ?? (s_SingleIsNaN = typeof(float).GetMethod("IsNaN"));
                        Expression e     = Expression.Call(null, isNaN, o.Expression);
                        restrictions = restrictions.Merge(BindingRestrictions.GetExpressionRestriction(e));
                    }
                    else
                    {
                        Expression e = Expression.Equal(o.Expression, Expression.Constant(o.Value, o.Expression.Type));
                        r            = BindingRestrictions.GetExpressionRestriction(e);
                        restrictions = restrictions.Merge(r);
                    }
                }
            }

            // Get the bound expression.
            try
            {
                Expression expression = binder.Bind(action, parameters, args, out DynamicMetaObject deferredBinding);

                if (deferredBinding != null)
                {
                    expression   = ConvertResult(deferredBinding.Expression, action);
                    restrictions = deferredBinding.Restrictions.Merge(restrictions);
                    return(new DynamicMetaObject(expression, restrictions));
                }

                if (tempForIncrement != null)
                {
                    // If we have a ++ or -- payload, we need to do some temp rewriting.
                    // We rewrite to the following:
                    //
                    // temp = (type)o;
                    // temp++;
                    // o = temp;
                    // return o;

                    DynamicMetaObject arg0 = args[0];

                    expression = Expression.Block(
                        new[] { tempForIncrement },
                        Expression.Assign(tempForIncrement, Expression.Convert(arg0.Expression, arg0.Value.GetType())),
                        expression,
                        Expression.Assign(arg0.Expression, Expression.Convert(tempForIncrement, arg0.Expression.Type)));
                }

                expression = ConvertResult(expression, action);

                return(new DynamicMetaObject(expression, restrictions));
            }
            catch (RuntimeBinderException e)
            {
                if (onBindingError != null)
                {
                    return(onBindingError);
                }

                return(new DynamicMetaObject(
                           Expression.Throw(
                               Expression.New(
                                   typeof(RuntimeBinderException).GetConstructor(new Type[] { typeof(string) }),
                                   Expression.Constant(e.Message)
                                   ),
                               GetTypeForErrorMetaObject(action, args)
                               ),
                           restrictions
                           ));
            }
        }
コード例 #23
0
 // rankNum is 0 for SZ arrays, equal to rank otherwise.
 public static ArrayType LookupArray(CType elementType, int rankNum)
 {
     RuntimeBinder.EnsureLockIsTaken();
     s_arrayTable.TryGetValue(new KeyPair <CType, int>(elementType, rankNum), out ArrayType result);
     return(result);
 }
コード例 #24
0
ファイル: BinderHelper.cs プロジェクト: zmm623/corefx
        internal static DynamicMetaObject Bind(
            DynamicMetaObjectBinder action,
            RuntimeBinder binder,
            IEnumerable <DynamicMetaObject> args,
            IEnumerable <CSharpArgumentInfo> arginfos,
            DynamicMetaObject onBindingError)
        {
            List <Expression>   parameters   = new List <Expression>();
            BindingRestrictions restrictions = BindingRestrictions.Empty;
            ICSharpInvokeOrInvokeMemberBinder callPayload = action as ICSharpInvokeOrInvokeMemberBinder;
            ParameterExpression tempForIncrement          = null;
            IEnumerator <CSharpArgumentInfo> arginfosEnum = arginfos == null ? null : arginfos.GetEnumerator();

            int index = 0;

            foreach (DynamicMetaObject o in args)
            {
                // Our contract with the DLR is such that we will not enter a bind unless we have
                // values for the meta-objects involved.

                if (!o.HasValue)
                {
                    Debug.Assert(false, "The runtime binder is being asked to bind a metaobject without a value");
                    throw Error.InternalCompilerError();
                }
                CSharpArgumentInfo info = null;
                if (arginfosEnum != null && arginfosEnum.MoveNext())
                {
                    info = arginfosEnum.Current;
                }

                if (index == 0 && IsIncrementOrDecrementActionOnLocal(action))
                {
                    // We have an inc or a dec operation. Insert the temp local instead.
                    //
                    // We need to do this because for value types, the object will come
                    // in boxed, and we'd need to unbox it to get the original type in order
                    // to increment. The only way to do that is to create a new temporary.
                    tempForIncrement = Expression.Variable(o.Value != null ? o.Value.GetType() : typeof(object), "t0");
                    parameters.Add(tempForIncrement);
                }
                else
                {
                    parameters.Add(o.Expression);
                }

                BindingRestrictions r = DeduceArgumentRestriction(index, callPayload, o, info);
                restrictions = restrictions.Merge(r);

                // Here we check the argument info. If the argument info shows that the current argument
                // is a literal constant, then we also add an instance restriction on the value of
                // the constant.
                if (info != null && info.LiteralConstant)
                {
                    if ((o.Value is float && float.IsNaN((float)o.Value)) ||
                        o.Value is double && double.IsNaN((double)o.Value))
                    {
                        // We cannot create an equality restriction for NaN, because equality is implemented
                        // in such a way that NaN != NaN and the rule we make would be unsatisfiable.
                    }
                    else
                    {
                        Expression e = Expression.Equal(o.Expression, Expression.Constant(o.Value, o.Expression.Type));
                        r            = BindingRestrictions.GetExpressionRestriction(e);
                        restrictions = restrictions.Merge(r);
                    }
                }

                ++index;
            }

            // Get the bound expression.
            try
            {
                DynamicMetaObject deferredBinding;
                Expression        expression = binder.Bind(action, parameters, args.ToArray(), out deferredBinding);

                if (deferredBinding != null)
                {
                    expression   = ConvertResult(deferredBinding.Expression, action);
                    restrictions = deferredBinding.Restrictions.Merge(restrictions);
                    return(new DynamicMetaObject(expression, restrictions));
                }

                if (tempForIncrement != null)
                {
                    // If we have a ++ or -- payload, we need to do some temp rewriting.
                    // We rewrite to the following:
                    //
                    // temp = (type)o;
                    // temp++;
                    // o = temp;
                    // return o;

                    DynamicMetaObject arg0 = Enumerable.First(args);

                    Expression assignTemp = Expression.Assign(
                        tempForIncrement,
                        Expression.Convert(arg0.Expression, arg0.Value.GetType()));
                    Expression assignResult = Expression.Assign(
                        arg0.Expression,
                        Expression.Convert(tempForIncrement, arg0.Expression.Type));
                    List <Expression> expressions = new List <Expression>();

                    expressions.Add(assignTemp);
                    expressions.Add(expression);
                    expressions.Add(assignResult);

                    expression = Expression.Block(new ParameterExpression[] { tempForIncrement }, expressions);
                }

                expression = ConvertResult(expression, action);

                return(new DynamicMetaObject(expression, restrictions));
            }
            catch (RuntimeBinderException e)
            {
                if (onBindingError != null)
                {
                    return(onBindingError);
                }

                return(new DynamicMetaObject(
                           Expression.Throw(
                               Expression.New(
                                   typeof(RuntimeBinderException).GetConstructor(new Type[] { typeof(string) }),
                                   Expression.Constant(e.Message)
                                   ),
                               GetTypeForErrorMetaObject(action, args.FirstOrDefault())
                               ),
                           restrictions
                           ));
            }
        }
コード例 #25
0
 public static void InsertArray(CType elementType, int rankNum, ArrayType pArray)
 {
     RuntimeBinder.EnsureLockIsTaken();
     Debug.Assert(LookupArray(elementType, rankNum) == null);
     s_arrayTable.Add(new KeyPair <CType, int>(elementType, rankNum), pArray);
 }
コード例 #26
0
 public void PopulateSymbolTableWithName(SymbolTable symbolTable, Type callingType, ArgumentObject[] arguments)
 => RuntimeBinder.PopulateSymbolTableWithPayloadInformation(symbolTable, this, callingType, arguments);
コード例 #27
0
 public static ParameterModifierType LookupParameterModifier(CType elementType, bool isOut)
 {
     RuntimeBinder.EnsureLockIsTaken();
     s_parameterModifierTable.TryGetValue(new KeyPair <CType, bool>(elementType, isOut), out ParameterModifierType result);
     return(result);
 }