• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IndexExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: IndexMember

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

		protected Expression IndexMember( bool isRootNode, string memberName, bool validToken, IInput input )
		{
			// ******
			Expression expression = null;

			//IArgumentsProcessor ap = new ArgumentsProcessor( argScanner, recognizer );
			IArgumentsProcessor ap = new ArgumentsProcessor( scanner, recognizer );

			//NmpStringList strArgs = argScanner( input, RecognizedCharType.CloseBracketChar );
			NmpStringList strArgs = scanner.ArgScanner( input, RecognizedCharType.CloseBracketChar );

			// ******
			if( ! validToken ) {
				//
				// IndexResult
				//
				return new UnnamedIndexExpression( ap, strArgs );
			}
			else {
				if( isRootNode ) {
					expression = new UnnamedIndexExpression(memberName, ap, strArgs );
				}
				else {
					expression = new IndexExpression( memberName, ap, strArgs );
				}
			}

			// ******
			return expression;
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:32,代码来源:ETB.cs


示例17: AddressOfWriteBack

        private WriteBack AddressOfWriteBack(IndexExpression node)
        {
            if (node.Indexer == null || !node.Indexer.CanWrite)
            {
                return null;
            }

            return AddressOfWriteBackCore(node); // avoids closure allocation
        }
开发者ID:alessandromontividiu03,项目名称:corefx,代码行数:9,代码来源:LambdaCompiler.Address.cs


示例18: AddressOf

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

            if (node.Arguments.Count == 1) {
                EmitExpression(node.Object);
                EmitExpression(node.Arguments[0]);
                _ilg.Emit(OpCodes.Ldelema, node.Type);
            } else {
                var address = node.Object.Type.GetMethod("Address", BindingFlags.Public | BindingFlags.Instance);
                EmitMethodCall(node.Object, address, node);
            }
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:15,代码来源:LambdaCompiler.Address.cs


示例19: Walk

 // IndexExpression
 public override bool Walk(IndexExpression node) { return false; }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:2,代码来源:PythonWalker.Generated.cs


示例20: AddressOfWriteBack

        private WriteBack AddressOfWriteBack(IndexExpression node)
        {
            if (node.Indexer == null || !node.Indexer.CanWrite)
            {
                return null;
            }

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

                _ilg.Emit(OpCodes.Dup);
                _ilg.Emit(OpCodes.Stloc, instanceLocal = GetLocal(instanceType));
            }

            // Emit indexes. We don't allow byref args, so no need to worry
            // about writebacks or EmitAddress
            List<LocalBuilder> args = new List<LocalBuilder>();
            foreach (var arg in node.Arguments)
            {
                EmitExpression(arg);

                var argLocal = GetLocal(arg.Type);
                _ilg.Emit(OpCodes.Dup);
                _ilg.Emit(OpCodes.Stloc, argLocal);
                args.Add(argLocal);
            }

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

            // emit the address of the value
            var 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 delegate ()
            {
                if (instanceLocal != null)
                {
                    _ilg.Emit(OpCodes.Ldloc, instanceLocal);
                    FreeLocal(instanceLocal);
                }
                foreach (var arg in args)
                {
                    _ilg.Emit(OpCodes.Ldloc, arg);
                    FreeLocal(arg);
                }
                _ilg.Emit(OpCodes.Ldloc, valueLocal);
                FreeLocal(valueLocal);

                EmitSetIndexCall(node, instanceType);
            };
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:59,代码来源:LambdaCompiler.Address.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IndexQuery类代码示例发布时间:2022-05-24
下一篇:
C# IndexEntry类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap