当前位置: 首页>>代码示例>>C#>>正文


C# IndexExpression类代码示例

本文整理汇总了C#中IndexExpression的典型用法代码示例。如果您正苦于以下问题:C# IndexExpression类的具体用法?C# IndexExpression怎么用?C# IndexExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IndexExpression类属于命名空间,在下文中一共展示了IndexExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateIndexExpression

 protected virtual IndexExpression UpdateIndexExpression(IndexExpression exp, Expression obj, ReadOnlyCollection<Expression> args)
 {
     if (exp.Object != obj || exp.Arguments != args)
     {
         return Expression.MakeIndex(obj, exp.Indexer, args);
     }
     return exp;
 }
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:8,代码来源:ExpressionVisitor.cs

示例2: IndexVisitor

            public IndexVisitor(IndexExpression expr, Expression newObject, Expression[] newArguments)
            {
                _dict = new Dictionary<Expression, Expression>
                {
                    {expr.Object, newObject}
                };

                for (int i = 0; i < expr.Arguments.Count; i++)
                {
                    _dict.Add(expr.Arguments[i], newArguments?[i]);
                }
            }
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:IndexExpressionVisitorTests.cs

示例3: EvalIndexExpression

		/////////////////////////////////////////////////////////////////////////////

		public override object EvalIndexExpression( object objIn, IndexExpression exp )
		{
			// ******
			//
			// expression:  macro.fieldOrProperty[ i ]
			//
			// exp.MemberName should be the name of an indexer (property with arguments)
			// that we need to access
			//
			var invoker = Invokers.GetIndexerInvoker( objIn, exp.MemberName, typeHelpers );
			if( null == invoker ) {
				ThreadContext.MacroError( "there is no indexer named \"{0}\" on the object type \"{1}\"", exp.MemberName, ObjectInfo.GetTypeName(objIn) );
			}
			object objResult = invoker.Invoke( EvaluateArguments(exp.Arguments) );

			// ******
			CheckNullResult( objResult, objIn, exp.MemberName );
			return objResult;
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:21,代码来源:ExpressionEvaluator.cs

示例4: IndexExpressionProxy

 public IndexExpressionProxy(IndexExpression node) {
     _node = node;
 }
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:3,代码来源:Expression.DebuggerProxy.cs

示例5: DumpIndexExpression

		public abstract string DumpIndexExpression( IndexExpression exp );
开发者ID:jmclain,项目名称:Nmp,代码行数:1,代码来源:ExpressionDumper.cs

示例6: PostWalk

 public virtual void PostWalk(IndexExpression node) { }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:1,代码来源:PythonWalker.Generated.cs

示例7: AddressOfWriteBackCore

        private WriteBack AddressOfWriteBackCore(IndexExpression node)
        {
            // emit instance, if any
            LocalBuilder instanceLocal = null;
            Type instanceType = null;
            if (node.Object != null)
            {
                EmitInstance(node.Object, out instanceType);

                // store in local
                _ilg.Emit(OpCodes.Dup);
                _ilg.Emit(OpCodes.Stloc, instanceLocal = GetInstanceLocal(instanceType));
            }

            // Emit indexes. We don't allow byref args, so no need to worry
            // about write-backs or EmitAddress
            int n = node.ArgumentCount;
            var args = new LocalBuilder[n];
            for (var i = 0; i < n; i++)
            {
                Expression arg = node.GetArgument(i);
                EmitExpression(arg);

                LocalBuilder argLocal = GetLocal(arg.Type);
                _ilg.Emit(OpCodes.Dup);
                _ilg.Emit(OpCodes.Stloc, argLocal);
                args[i] = argLocal;
            }

            // emit the get
            EmitGetIndexCall(node, instanceType);

            // emit the address of the value
            LocalBuilder valueLocal = GetLocal(node.Type);
            _ilg.Emit(OpCodes.Stloc, valueLocal);
            _ilg.Emit(OpCodes.Ldloca, valueLocal);

            // Set the property after the method call
            // don't re-evaluate anything
            return @this =>
            {
                if (instanceLocal != null)
                {
                    @this._ilg.Emit(OpCodes.Ldloc, instanceLocal);
                    @this.FreeLocal(instanceLocal);
                }
                foreach (LocalBuilder arg in args)
                {
                    @this._ilg.Emit(OpCodes.Ldloc, arg);
                    @this.FreeLocal(arg);
                }
                @this._ilg.Emit(OpCodes.Ldloc, valueLocal);
                @this.FreeLocal(valueLocal);

                @this.EmitSetIndexCall(node, instanceLocal?.LocalType);
            };
        }
开发者ID:alessandromontividiu03,项目名称:corefx,代码行数:57,代码来源:LambdaCompiler.Address.cs

示例8: AddressOf

        private void AddressOf(IndexExpression node, Type type)
        {
            if (!TypeUtils.AreEquivalent(type, node.Type) || node.Indexer != null)
            {
                EmitExpressionAddress(node, type);
                return;
            }

            if (node.ArgumentCount == 1)
            {
                EmitExpression(node.Object);
                EmitExpression(node.GetArgument(0));
                _ilg.Emit(OpCodes.Ldelema, node.Type);
            }
            else
            {
                MethodInfo address = node.Object.Type.GetMethod("Address", BindingFlags.Public | BindingFlags.Instance);
                EmitMethodCall(node.Object, address, node);
            }
        }
开发者ID:alessandromontividiu03,项目名称:corefx,代码行数:20,代码来源:LambdaCompiler.Address.cs

示例9: Walk

 // IndexExpression
 public override bool Walk(IndexExpression node) { return Location >= node.StartIndex && Location <= node.EndIndex; }
开发者ID:jsschultz,项目名称:PTVS,代码行数:2,代码来源:PythonWalker.Generated.cs

示例10: EvalIndexExpression

		public abstract object EvalIndexExpression( object obj, IndexExpression exp );
开发者ID:jmclain,项目名称:Nmp,代码行数:1,代码来源:ExpressionEvaluatorBase.cs

示例11: VisitIndexExpression

 protected virtual Expression VisitIndexExpression(IndexExpression exp)
 {
     var obj = this.Visit(exp.Object);
     var args = this.VisitExpressionList(exp.Arguments);
     return this.UpdateIndexExpression(exp, obj, args);
 }
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:6,代码来源:ExpressionVisitor.cs

示例12: VisitIndexExpression

        protected override Expression VisitIndexExpression(IndexExpression exp)
        {
            Accumulate(exp.Indexer);

            return base.VisitIndexExpression(exp);
        }
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:6,代码来源:ExpressionHasher.cs

示例13: VisitIndex

 protected virtual Expression VisitIndex(IndexExpression index)
 {
     return index;
 }
开发者ID:Toolate,项目名称:dotSearch,代码行数:4,代码来源:LuceneExpressionVisitor.cs

示例14: Walk

 public override bool Walk(IndexExpression node)
 {
     node.Parent = _currentScope;
     return base.Walk(node);
 }
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:PythonNameBinder.cs

示例15: EmitSetIndexCall

 private void EmitSetIndexCall(IndexExpression node, Type objectType) {
     if (node.Indexer != null) {
         // For indexed properties, just call the setter
         var method = node.Indexer.GetSetMethod(true);
         EmitCall(objectType, method);
     } else if (node.Arguments.Count != 1) {
         // Multidimensional arrays, call set
         _ilg.Emit(OpCodes.Call, node.Object.Type.GetMethod("Set", BindingFlags.Public | BindingFlags.Instance));
     } else {
         // For one dimensional arrays, emit store
         _ilg.EmitStoreElement(node.Type);
     }
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:13,代码来源:LambdaCompiler.Expressions.cs


注:本文中的IndexExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。