コード例 #1
0
ファイル: Binder.cs プロジェクト: noahfalk/corefx
        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new CSharp get index binder.
        /// </summary>
        /// <param name="flags">The flags with which to initialize the binder.</param>
        /// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
        /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
        /// <returns>Returns a new CSharp get index binder.</returns>
        public static CallSiteBinder GetIndex(
            CSharpBinderFlags flags,
            Type context,
            IEnumerable<CSharpArgumentInfo> argumentInfo)
        {
            return new CSharpGetIndexBinder(context, argumentInfo);
        }
 internal AssignBinaryDynamicCSharpExpression(Type context, CSharpBinderFlags binderFlags, CSharpExpressionType binaryType, DynamicCSharpArgument left, DynamicCSharpArgument right)
     : base(context, binderFlags)
 {
     OperationNodeType = binaryType;
     Left = left;
     Right = right;
 }
コード例 #3
0
		public CSharpSetMemberBinder (CSharpBinderFlags flags, string name, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
			: base (name, false)
		{
			this.flags = flags;
			this.callingContext = callingContext;
			this.argumentInfo = argumentInfo.ToReadOnly ();
		}
 internal InvokeMemberDynamicCSharpExpression(Type context, CSharpBinderFlags binderFlags, string name, ReadOnlyCollection<Type> typeArguments, ReadOnlyCollection<DynamicCSharpArgument> arguments)
     : base(context, binderFlags)
 {
     Name = name;
     TypeArguments = typeArguments;
     Arguments = arguments;
 }
コード例 #5
0
		public CSharpInvokeBinder (CSharpBinderFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
			: base (CSharpArgumentInfo.CreateCallInfo (argumentInfo, 1))
		{
			this.flags = flags;
			this.callingContext = callingContext;
			this.argumentInfo = argumentInfo.ToReadOnly ();
		}
コード例 #6
0
        private static Expression ReduceDynamicIndex(GetIndexDynamicCSharpExpression index, Func<Expression, Expression> functionalOp, CSharpBinderFlags flags, bool prefix)
        {
            var args = default(DynamicCSharpArgument[]);
            var block = default(Expression[]);
            var temps = default(ParameterExpression[]);
            var i = CopyArguments(index.Object, index.Arguments, prefix, out args, out block, out temps);

            index = index.Update(temps[0], new TrueReadOnlyCollection<DynamicCSharpArgument>(args));

            if (prefix)
            {
                block[i++] = index.ReduceAssignment(functionalOp(index), flags);
            }
            else
            {
                var lastTemp = temps[i] = Expression.Parameter(index.Type, "__index");

                block[i] = Expression.Assign(temps[i], index);
                i++;

                block[i++] = index.ReduceAssignment(functionalOp(lastTemp), flags);
                block[i++] = lastTemp;
            }

            var res = Expression.Block(temps, block);
            return res;
        }
コード例 #7
0
 internal GetMemberDynamicCSharpExpression(Type context, CSharpBinderFlags binderFlags, Expression @object, string name, ReadOnlyCollection<DynamicCSharpArgument> arguments)
     : base(context, binderFlags)
 {
     Object = @object;
     Name = name;
     Arguments = arguments;
 }
コード例 #8
0
		public CSharpInvokeMemberBinder (CSharpBinderFlags flags, string name, Type callingContext, IEnumerable<Type> typeArguments, IEnumerable<CSharpArgumentInfo> argumentInfo)
			: base (name, false, CSharpArgumentInfo.CreateCallInfo (argumentInfo, 1))
		{
			this.flags = flags;
			this.callingContext = callingContext;
			this.argumentInfo = argumentInfo.ToReadOnly ();
			this.typeArguments = typeArguments.ToReadOnly ();
		}
コード例 #9
0
		// or is it part of roslyn not clr?

        public static CallSiteBinder BinaryOperation(CSharpBinderFlags flags, ExpressionType operation, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
        {
            return (CallSiteBinder)(object)new __BinaryOperationBinder
            {
                flags = flags,
                operation = operation,
                context = context,
                argumentInfo = argumentInfo
            };
        }
コード例 #10
0
		public CSharpUnaryOperationBinder (ExpressionType operation, CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
			: base (operation)
		{
			this.argumentInfo = argumentInfo.ToReadOnly ();
			if (this.argumentInfo.Count != 1)
				throw new ArgumentException ("Unary operation requires 1 argument");

			this.flags = flags;
			this.context = context;
		}
コード例 #11
0
		public CSharpBinaryOperationBinder (ExpressionType operation, CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
			: base (operation)
		{
			this.argumentInfo = new ReadOnlyCollectionBuilder<CSharpArgumentInfo> (argumentInfo);
			if (this.argumentInfo.Count != 2)
				throw new ArgumentException ("Binary operation requires 2 arguments");

			this.flags = flags;
			this.context = context;
		}
コード例 #12
0
 public static CallSiteBinder UnaryOperation(CSharpBinderFlags flags, ExpressionType operation, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
 {
     // X:\jsc.svn\examples\javascript\Test\TestUnaryOperation\TestUnaryOperation\Application.cs
     return  (CallSiteBinder)(object)new __UnaryOperationBinder
     {
         flags = flags, 
         operation = operation, 
         context = context, 
         argumentInfo = argumentInfo
     };
 }
コード例 #13
0
        // Z:\jsc.svn\core\ScriptCoreLib\Shared\BCLImplementation\Microsoft\CSharp\RuntimeBinder\Binder.cs

        public static CallSiteBinder InvokeMember(
           CSharpBinderFlags flags,
           string name,
           IEnumerable<Type> typeArguments,
           Type context,
           IEnumerable<CSharpArgumentInfo> argumentInfo
           )
        {
            // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20160103/ndktype

            return null;
        }
コード例 #14
0
        // how does this 

        public static CallSiteBinder GetIndex(CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
        {
            // X:\jsc.svn\examples\javascript\test\TestDynamicGetIndex\TestDynamicGetIndex\Application.cs


            return (CallSiteBinder)(object)new __GetIndexBinder
            {

                flags = flags,
                context = context,
                argumentInfo = argumentInfo
            };
        }
コード例 #15
0
ファイル: Binder.cs プロジェクト: noahfalk/corefx
        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new CSharp convert binder.
        /// </summary>
        /// <param name="flags">The flags with which to initialize the binder.</param>
        /// <param name="type">The type to convert to.</param>
        /// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
        /// <returns>Returns a new CSharp convert binder.</returns>
        public static CallSiteBinder Convert(
            CSharpBinderFlags flags,
            Type type,
            Type context)
        {
            CSharpConversionKind conversionKind =
                ((flags & CSharpBinderFlags.ConvertExplicit) != 0) ?
                    CSharpConversionKind.ExplicitConversion :
                    ((flags & CSharpBinderFlags.ConvertArrayIndex) != 0) ?
                        CSharpConversionKind.ArrayCreationConversion :
                        CSharpConversionKind.ImplicitConversion;
            bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != 0;

            return new CSharpConvertBinder(type, conversionKind, isChecked, context);
        }
コード例 #16
0
		public PSInvokeMemberBinder (CSharpBinderFlags flags, string name, Type callingContext, IEnumerable<Type> typeArguments, IEnumerable<CSharpArgumentInfo> argumentInfo)
		{
			this.name = name;

			var argList = argumentInfo as System.Collections.IList;
			if (argList != null)
			{
				// allocate argument list
				this.mArgs = new object[argList.Count - 1];
			}

//			this.flags = flags;
//			this.callingContext = callingContext;
//			this.argumentInfo = new List<CSharpArgumentInfo>(argumentInfo);
//			if (typeArguments != null) this.typeArguments = new List<Type>(typeArguments);
		}
コード例 #17
0
ファイル: Binder.cs プロジェクト: noahfalk/corefx
        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new CSharp binary operation binder.
        /// </summary>
        /// <param name="flags">The flags with which to initialize the binder.</param>
        /// <param name="operation">The binary operation kind.</param>
        /// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
        /// <param name="argumentInfo">The sequence of <see cref="CSharpArgumentInfo"/> instances for the arguments to this operation.</param>
        /// <returns>Returns a new CSharp binary operation binder.</returns>
        public static CallSiteBinder BinaryOperation(
            CSharpBinderFlags flags,
            ExpressionType operation,
            Type context,
            IEnumerable<CSharpArgumentInfo> argumentInfo)
        {
            bool isChecked = (flags & CSharpBinderFlags.CheckedContext) != 0;
            bool isLogical = (flags & CSharpBinderFlags.BinaryOperationLogical) != 0;

            CSharpBinaryOperationFlags binaryOperationFlags = 0;
            if (isLogical)
            {
                binaryOperationFlags |= CSharpBinaryOperationFlags.LogicalOperation;
            }

            return new CSharpBinaryOperationBinder(operation, isChecked, binaryOperationFlags, context, argumentInfo);
        }
コード例 #18
0
        public static Expression ReduceDynamicAssignment(DynamicCSharpArgument left, Func<Expression, Expression> functionalOp, CSharpBinderFlags flags, bool prefix = true)
        {
            var lhs = MakeWriteable(left.Expression);

            var dynamicMember = lhs as GetMemberDynamicCSharpExpression;
            if (dynamicMember != null)
            {
                return ReduceDynamicMember(dynamicMember, functionalOp, flags, prefix);
            }

            var dynamicIndex = lhs as GetIndexDynamicCSharpExpression;
            if (dynamicIndex != null)
            {
                return ReduceDynamicIndex(dynamicIndex, functionalOp, flags, prefix);
            }

            return Helpers.ReduceAssignment(lhs, functionalOp, prefix);
        }
コード例 #19
0
        /// <summary>
        /// Emits the dynamic get binder.
        /// </summary>
        /// <param name="generator">The generator.</param>
        /// <param name="flag">The binding flags.</param>
        /// <param name="name">The name.</param>
        /// <param name="context">The context.</param>
        /// <param name="argTypes">The arg types.</param>
        public static void EmitDynamicGetBinder(this ILGenerator generator, CSharpBinderFlags flag, string name, Type context, params Type[] argTypes)
        {
            generator.Emit(OpCodes.Ldc_I4, (int)flag);
            if (!argTypes.Any())
            {
                generator.Emit(OpCodes.Ldstr, name);
            }
            generator.EmitTypeOf(context);
            var tList = new List <Action <ILGenerator> > {
                gen => gen.EmitCreateCSharpArgumentInfo(CSharpArgumentInfoFlags.None)
            };

            tList.AddRange(argTypes.Select(tArg => (Action <ILGenerator>)(gen => gen.EmitCreateCSharpArgumentInfo(CSharpArgumentInfoFlags.UseCompileTimeType))));
            generator.EmitArray(typeof(CSharpArgumentInfo), tList);
            if (!argTypes.Any())
            {
                generator.Emit(OpCodes.Call, typeof(Binder).GetMethod("GetMember", new[] { typeof(CSharpBinderFlags), typeof(string), typeof(Type), typeof(CSharpArgumentInfo[]) }));
            }
            else
            {
                generator.Emit(OpCodes.Call, typeof(Binder).GetMethod("GetIndex", new[] { typeof(CSharpBinderFlags), typeof(Type), typeof(CSharpArgumentInfo[]) }));
            }
        }
コード例 #20
0
        internal LoweredDynamicOperation MakeDynamicInvocation(
            BoundExpression loweredReceiver,
            ImmutableArray <BoundExpression> loweredArguments,
            ImmutableArray <string> argumentNames,
            ImmutableArray <RefKind> refKinds,
            bool resultDiscarded)
        {
            _factory.Syntax = loweredReceiver.Syntax;

            TypeSymbol        resultType;
            CSharpBinderFlags binderFlags = 0;

            if (resultDiscarded)
            {
                binderFlags |= CSharpBinderFlags.ResultDiscarded;
                resultType   = _factory.SpecialType(SpecialType.System_Void);
            }
            else
            {
                resultType = AssemblySymbol.DynamicType;
            }

            MethodSymbol argumentInfoFactory = GetArgumentInfoFactory();
            var          binderConstruction  = ((object)argumentInfoFactory != null) ? MakeBinderConstruction(WellKnownMember.Microsoft_CSharp_RuntimeBinder_Binder__Invoke, new[]
            {
                // flags:
                _factory.Literal((int)binderFlags),

                // context:
                _factory.TypeofDynamicOperationContextType(),

                // argument infos:
                MakeCallSiteArgumentInfos(argumentInfoFactory, loweredArguments, argumentNames, refKinds, loweredReceiver)
            }) : null;

            return(MakeDynamicOperation(binderConstruction, loweredReceiver, RefKind.None, loweredArguments, refKinds, null, resultType));
        }
コード例 #21
0
        internal LoweredDynamicOperation MakeDynamicUnaryOperator(
            UnaryOperatorKind operatorKind,
            BoundExpression loweredOperand,
            TypeSymbol resultType)
        {
            Debug.Assert(operatorKind.IsDynamic());

            _factory.Syntax = loweredOperand.Syntax;

            CSharpBinderFlags binderFlags = 0;

            if (operatorKind.IsChecked())
            {
                binderFlags |= CSharpBinderFlags.CheckedContext;
            }

            var loweredArguments = ImmutableArray.Create(loweredOperand);

            MethodSymbol argumentInfoFactory = GetArgumentInfoFactory();
            var          binderConstruction  = ((object)argumentInfoFactory != null) ? MakeBinderConstruction(WellKnownMember.Microsoft_CSharp_RuntimeBinder_Binder__UnaryOperation, new[]
            {
                // flags:
                _factory.Literal((int)binderFlags),

                // expression type:
                _factory.Literal((int)operatorKind.ToExpressionType()),

                // context:
                _factory.TypeofDynamicOperationContextType(),

                // argument infos:
                MakeCallSiteArgumentInfos(argumentInfoFactory, loweredArguments)
            }) : null;

            return(MakeDynamicOperation(binderConstruction, null, RefKind.None, loweredArguments, default(ImmutableArray <RefKind>), null, resultType));
        }
コード例 #22
0
 /// <summary>
 /// Creates a new expression representing a dynamically bound constructor invocation with the specified binder flags.
 /// </summary>
 /// <param name="type">The type of the object to instantiate.</param>
 /// <param name="arguments">An enumerable sequence of dynamic arguments representing the arguments passed to the constructor upon object creation.</param>
 /// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
 /// <returns>A new expression representing a dynamically bound constructor invocation.</returns>
 public static InvokeConstructorDynamicCSharpExpression DynamicInvokeConstructor(Type type, IEnumerable <DynamicCSharpArgument> arguments, CSharpBinderFlags binderFlags)
 {
     return(DynamicInvokeConstructor(type, arguments, binderFlags, null));
 }
コード例 #23
0
ファイル: dynamic.cs プロジェクト: caomw/mono
		public DynamicIndexBinder (CSharpBinderFlags flags, Arguments args, Location loc)
			: this (args, false, false, loc)
		{
			base.flags = flags;
		}
        /// <summary>
        /// Creates a new expression representing a dynamically bound (possibly generic) member invocation with the specified binder flags and the specified type context.
        /// </summary>
        /// <param name="type">The type containing the static member to invoke.</param>
        /// <param name="name">The name of the member to invoke.</param>
        /// <param name="typeArguments">An enumerable sequence of type arguments to pass to the generic member. (Specify null for non-generic members.)</param>
        /// <param name="arguments">An enumerable sequence of dynamic arguments representing the arguments passed to the member upon invocation.</param>
        /// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
        /// <param name="context">The type representing the context in which the dynamic operation is bound.</param>
        /// <returns>A new expression representing a dynamically bound member invocation.</returns>
        public static InvokeMemberDynamicCSharpExpression DynamicInvokeMember(Type type, string name, IEnumerable<Type> typeArguments, IEnumerable<DynamicCSharpArgument> arguments, CSharpBinderFlags binderFlags, Type context)
        {
            RequiresNotNull(type, nameof(type));
            RequiresNotNull(name, nameof(name));

            ValidateType(type);

            var typeArgList = typeArguments.ToReadOnly();

            foreach (var typeArg in typeArgList)
            {
                ValidateType(typeArg);
            }

            var argList = arguments.ToReadOnly();

            return new InvokeStaticMemberDynamicCSharpExpression(context, binderFlags, type, name, typeArgList, argList);
        }
 internal InvokeStaticMemberDynamicCSharpExpression(Type context, CSharpBinderFlags binderFlags, Type type, string name, ReadOnlyCollection<Type> typeArguments, ReadOnlyCollection<DynamicCSharpArgument> arguments)
     : base(context, binderFlags, name, typeArguments, arguments)
 {
     Target = type;
 }
コード例 #26
0
        /// <summary>
        /// Creates a new expression representing a dynamically bound binary operation with the specified binder flags and the specified type context.
        /// </summary>
        /// <param name="binaryType">The type of the binary operation to perform.</param>
        /// <param name="left">The dynamic argument representing the left operand of the operation.</param>
        /// <param name="right">The dynamic argument representing the right operand of the operation.</param>
        /// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
        /// <param name="context">The type representing the context in which the dynamic operation is bound.</param>
        /// <returns>A new expression representing a dynamically bound binary operation.</returns>
        public static BinaryDynamicCSharpExpression MakeDynamicBinary(ExpressionType binaryType, DynamicCSharpArgument left, DynamicCSharpArgument right, CSharpBinderFlags binderFlags, Type context)
        {
            RequiresNotNull(left, nameof(left));
            RequiresNotNull(right, nameof(right));

            CheckBinary(binaryType);

            switch (binaryType)
            {
            case ExpressionType.AddChecked:
            case ExpressionType.MultiplyChecked:
            case ExpressionType.SubtractChecked:
                binderFlags |= CSharpBinderFlags.CheckedContext;
                break;

            case ExpressionType.AndAlso:
            case ExpressionType.OrElse:
                binderFlags |= CSharpBinderFlags.BinaryOperationLogical;
                break;
            }

            return(new BinaryDynamicCSharpExpression(context, binderFlags, binaryType, left, right));
        }
コード例 #27
0
 public static CallSiteBinder IsEvent(CSharpBinderFlags flags, string name, Type context)
 {
     return(null);
 }
コード例 #28
0
        internal LoweredDynamicOperation MakeDynamicMemberInvocation(
            string name,
            BoundExpression loweredReceiver,
            ImmutableArray <TypeSymbolWithAnnotations> typeArguments,
            ImmutableArray <BoundExpression> loweredArguments,
            ImmutableArray <string> argumentNames,
            ImmutableArray <RefKind> refKinds,
            bool hasImplicitReceiver,
            bool resultDiscarded)
        {
            _factory.Syntax = loweredReceiver.Syntax;

            CSharpBinderFlags binderFlags = 0;

            if (hasImplicitReceiver && !_factory.TopLevelMethod.IsStatic)
            {
                binderFlags |= CSharpBinderFlags.InvokeSimpleName;
            }

            TypeSymbol resultType;

            if (resultDiscarded)
            {
                binderFlags |= CSharpBinderFlags.ResultDiscarded;
                resultType   = _factory.SpecialType(SpecialType.System_Void);
            }
            else
            {
                resultType = AssemblySymbol.DynamicType;
            }

            RefKind receiverRefKind;
            bool    receiverIsStaticType;

            if (loweredReceiver.Kind == BoundKind.TypeExpression)
            {
                loweredReceiver      = _factory.Typeof(((BoundTypeExpression)loweredReceiver).Type);
                receiverRefKind      = RefKind.None;
                receiverIsStaticType = true;
            }
            else
            {
                receiverRefKind      = GetReceiverRefKind(loweredReceiver);
                receiverIsStaticType = false;
            }

            MethodSymbol argumentInfoFactory = GetArgumentInfoFactory();
            var          binderConstruction  = ((object)argumentInfoFactory != null) ? MakeBinderConstruction(WellKnownMember.Microsoft_CSharp_RuntimeBinder_Binder__InvokeMember, new[]
            {
                // flags:
                _factory.Literal((int)binderFlags),

                // member name:
                _factory.Literal(name),

                // type arguments:
                typeArguments.IsDefaultOrEmpty ?
                _factory.Null(_factory.WellKnownArrayType(WellKnownType.core_Type)) :
                _factory.ArrayOrEmpty(_factory.WellKnownType(WellKnownType.core_Type), _factory.TypeOfs(typeArguments)),

                // context:
                _factory.TypeofDynamicOperationContextType(),

                // argument infos:
                MakeCallSiteArgumentInfos(argumentInfoFactory, loweredArguments, argumentNames, refKinds, loweredReceiver, receiverRefKind, receiverIsStaticType)
            }) : null;

            return(MakeDynamicOperation(binderConstruction, loweredReceiver, receiverRefKind, loweredArguments, refKinds, null, resultType));
        }
コード例 #29
0
ファイル: Binder.cs プロジェクト: MichaelWalsh/mono
		public static CallSiteBinder InvokeMember (CSharpBinderFlags flags, string name, IEnumerable<Type> typeArguments, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
		{
			return new CSharpInvokeMemberBinder (flags, name, context, typeArguments, argumentInfo);
		}
コード例 #30
0
ファイル: Binder.cs プロジェクト: MichaelWalsh/mono
		public static CallSiteBinder InvokeConstructor (CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
		{
			// What are flags for here
			return new CSharpInvokeConstructorBinder (context, argumentInfo);
		}
コード例 #31
0
ファイル: Binder.cs プロジェクト: MichaelWalsh/mono
		public static CallSiteBinder Invoke (CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
		{
			return new CSharpInvokeBinder (flags, context, argumentInfo);
		}
コード例 #32
0
ファイル: Binder.cs プロジェクト: MichaelWalsh/mono
		public static CallSiteBinder Convert (CSharpBinderFlags flags, Type context, Type type)
		{
			return new CSharpConvertBinder (type, context, flags);
		}
コード例 #33
0
 public static CallSiteBinder GetIndex(CSharpBinderFlags flags, Type context, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     return(new CSharpGetIndexBinder(context, argumentInfo));
 }
コード例 #34
0
 public PSSetMemberBinder(CSharpBinderFlags flags, string name, Type callingContext, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     this.name = name;
 }
コード例 #35
0
 public static CallSiteBinder InvokeMember(CSharpBinderFlags flags, string name, IEnumerable <Type> typeArguments, Type context, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     return(new CSharpInvokeMemberBinder(flags, name, context, typeArguments, argumentInfo));
 }
コード例 #36
0
 internal InvokeConstructorDynamicCSharpExpression(Type context, CSharpBinderFlags binderFlags, Type type, ReadOnlyCollection <DynamicCSharpArgument> arguments)
     : base(context, binderFlags)
 {
     Type      = type;
     Arguments = arguments;
 }
コード例 #37
0
 public DynamicMemberBinder(string name, CSharpBinderFlags flags, Arguments args, Location loc)
     : this(name, args, loc)
 {
     base.flags = flags;
 }
コード例 #38
0
ファイル: dynamic.cs プロジェクト: speier/shake
 public DynamicConversion(TypeSpec targetType, CSharpBinderFlags flags, Arguments args, Location loc)
     : base(null, args, loc)
 {
     type = targetType;
     base.flags = flags;
     base.binder = this;
 }
コード例 #39
0
 public static CallSiteBinder InvokeConstructor(CSharpBinderFlags flags, Type context, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     // What are flags for here
     return(new CSharpInvokeConstructorBinder(context, argumentInfo));
 }
コード例 #40
0
 public static CallSiteBinder Convert(CSharpBinderFlags flags, Type type, Type context)
 {
     return(new CSharpConvertBinder(type, context, flags));
 }
コード例 #41
0
		public CSharpInvokeBinder (CSharpBinderFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
		{
//			this.flags = flags;
//			this.callingContext = callingContext;
//			this.argumentInfo = new List<CSharpArgumentInfo>(argumentInfo);
		}
コード例 #42
0
ファイル: Binder.cs プロジェクト: MichaelWalsh/mono
		public static CallSiteBinder UnaryOperation (CSharpBinderFlags flags, ExpressionType operation, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
		{
			return new CSharpUnaryOperationBinder (operation, flags, context, argumentInfo);
		}
コード例 #43
0
        public static K TryEvalCast <T, K>(T obj, Type type, CSharpBinderFlags kind, Type accessibilityContext)
        {
            var site = CallSite <Func <CallSite, T, K> > .Create(Binder.Convert(kind, type, accessibilityContext));

            return(site.Target(site, obj));
        }
コード例 #44
0
 /// <summary>
 /// Creates a new expression representing a dynamically bound unary assignment operation with the specified binder flags.
 /// </summary>
 /// <param name="unaryType">The type of the unary operation to perform.</param>
 /// <param name="operand">The dynamic argument representing the operand of the operation.</param>
 /// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
 /// <returns>A new expression representing a dynamically bound unary assignment operation.</returns>
 public static AssignUnaryDynamicCSharpExpression MakeDynamicUnaryAssign(CSharpExpressionType unaryType, DynamicCSharpArgument operand, CSharpBinderFlags binderFlags) =>
 MakeDynamicUnaryAssign(unaryType, operand, binderFlags, context: null);
 /// <summary>
 /// Creates a new expression representing a dynamically bound (possibly generic) member invocation with the specified binder flags.
 /// </summary>
 /// <param name="type">The type containing the static member to invoke.</param>
 /// <param name="name">The name of the member to invoke.</param>
 /// <param name="typeArguments">An enumerable sequence of type arguments to pass to the generic member. (Specify null for non-generic members.)</param>
 /// <param name="arguments">An array of dynamic arguments representing the arguments passed to the member upon invocation.</param>
 /// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
 /// <returns>A new expression representing a dynamically bound member invocation.</returns>
 public static InvokeMemberDynamicCSharpExpression DynamicInvokeMember(Type type, string name, IEnumerable<Type> typeArguments, IEnumerable<DynamicCSharpArgument> arguments, CSharpBinderFlags binderFlags) =>
     DynamicInvokeMember(type, name, typeArguments, arguments, binderFlags, context: null);
コード例 #46
0
        public static AssignUnaryDynamicCSharpExpression MakeDynamicUnaryAssign(CSharpExpressionType unaryType, DynamicCSharpArgument operand, CSharpBinderFlags binderFlags, Type context)
        {
            RequiresNotNull(operand, nameof(operand));

            RequiresCanRead(operand.Expression, nameof(operand));
            RequiresCanWrite(operand.Expression, nameof(operand));

            CheckUnaryAssign(unaryType);

            switch (unaryType)
            {
            case CSharpExpressionType.PreIncrementAssignChecked:
            case CSharpExpressionType.PreDecrementAssignChecked:
            case CSharpExpressionType.PostIncrementAssignChecked:
            case CSharpExpressionType.PostDecrementAssignChecked:
                binderFlags |= CSharpBinderFlags.CheckedContext;
                break;
            }

            return(new AssignUnaryDynamicCSharpExpression(context, binderFlags, unaryType, operand));
        }
 internal InvokeInstanceMemberDynamicCSharpExpression(Type context, CSharpBinderFlags binderFlags, Expression @object, string name, ReadOnlyCollection<Type> typeArguments, ReadOnlyCollection<DynamicCSharpArgument> arguments)
     : base(context, binderFlags, name, typeArguments, arguments)
 {
     Object = @object;
 }
コード例 #48
0
 internal AssignUnaryDynamicCSharpExpression(Type context, CSharpBinderFlags binderFlags, CSharpExpressionType unaryType, DynamicCSharpArgument operand)
     : base(context, binderFlags)
 {
     OperationNodeType = unaryType;
     Operand           = operand;
 }
コード例 #49
0
ファイル: dynamic.cs プロジェクト: caomw/mono
		public DynamicMemberBinder (string name, CSharpBinderFlags flags, Arguments args, Location loc)
			: this (name, args, loc)
		{
			base.flags = flags;
		}
コード例 #50
0
 public static CallSiteBinder InvokeConstructor(CSharpBinderFlags flags, Type context, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     return(null);
 }
コード例 #51
0
        /// <summary>
        /// Creates a new expression representing a dynamically bound constructor invocation with the specified binder flags and the specified type context.
        /// </summary>
        /// <param name="type">The type of the object to instantiate.</param>
        /// <param name="arguments">An enumerable sequence of dynamic arguments representing the arguments passed to the constructor upon object creation.</param>
        /// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
        /// <param name="context">The type representing the context in which the dynamic operation is bound.</param>
        /// <returns>A new expression representing a dynamically bound constructor invocation.</returns>
        public static InvokeConstructorDynamicCSharpExpression DynamicInvokeConstructor(Type type, IEnumerable <DynamicCSharpArgument> arguments, CSharpBinderFlags binderFlags, Type context)
        {
            ContractUtils.RequiresNotNull(type, nameof(type));

            ValidateType(type);

            var argList = arguments.ToReadOnly();

            return(new InvokeConstructorDynamicCSharpExpression(context, binderFlags, type, argList));
        }
コード例 #52
0
 public static CallSiteBinder Convert(CSharpBinderFlags flags, Type type, Type context)
 {
     return(null);
 }
コード例 #53
0
 public DynamicIndexBinder(CSharpBinderFlags flags, Arguments args, Location loc)
     : this(args, loc)
 {
     base.flags = flags;
 }
コード例 #54
0
 public static CallSiteBinder SetMember(CSharpBinderFlags flags, string name, Type context, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     return(null);
 }
コード例 #55
0
 public static CallSiteBinder UnaryOperation(CSharpBinderFlags flags, ExpressionType operation, Type context, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     return(null);
 }
コード例 #56
0
 public static CallSiteBinder SetIndex(CSharpBinderFlags flags, Type context, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     return(null);
 }
コード例 #57
0
ファイル: Binder.cs プロジェクト: MichaelWalsh/mono
		public static CallSiteBinder IsEvent (CSharpBinderFlags flags, string name, Type context)
		{
			return new CSharpIsEventBinder (name, context);
		}
コード例 #58
0
 public static CallSiteBinder Invoke(CSharpBinderFlags flags, Type context, IEnumerable <CSharpArgumentInfo> argumentInfo)
 {
     return(new CSharpInvokeBinder(flags, context, argumentInfo));
 }
コード例 #59
0
ファイル: dynamic.cs プロジェクト: speier/shake
 public BinderFlags(CSharpBinderFlags flags, DynamicExpressionStatement statement)
     : base(statement.loc)
 {
     this.flags = flags;
     this.statement = statement;
 }
コード例 #60
0
ファイル: Binder.cs プロジェクト: MichaelWalsh/mono
		public static CallSiteBinder SetMember (CSharpBinderFlags flags, string name, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
		{
			return new CSharpSetMemberBinder (name, context, argumentInfo);
		}