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

C# Ast.IndexerExpression类代码示例

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

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



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

示例1: VisitIndexerExpression

 public override object VisitIndexerExpression(IndexerExpression indexer, object data)
 {
     if (GetPrecedence(indexer.TargetObject) >= GetPrecedence(indexer)) {
         indexer.TargetObject = Deparenthesize(indexer.TargetObject);
     }
     return base.VisitIndexerExpression(indexer, data);
 }
开发者ID:almazik,项目名称:ILSpy,代码行数:7,代码来源:RemoveParenthesis.cs


示例2: VisitIndexerExpression

		public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
		{
			List<int> indexes = new List<int>();
			foreach(Expression indexExpr in indexerExpression.Indexes) {
				Value indexValue = (Value)indexExpr.AcceptVisitor(this, null);
				if (!indexValue.Type.IsInteger) throw new GetValueException("Integer expected");
				indexes.Add((int)indexValue.PrimitiveValue);
			}
			Value target = (Value)indexerExpression.TargetObject.AcceptVisitor(this, null);
			if (!target.Type.IsArray) throw new GetValueException("Target is not array");
			return target.GetArrayElement(indexes.ToArray());
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:12,代码来源:EvaluateAstVisitor.cs


示例3: VisitMemberReferenceExpression

        public override object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data)
        {
            var identifierExpression = memberReferenceExpression.TargetObject as IdentifierExpression;
            if (identifierExpression == null || identifierExpression.Identifier != identifier)
                return base.VisitMemberReferenceExpression(memberReferenceExpression, data);

            var indexerExpression = new IndexerExpression(
                memberReferenceExpression.TargetObject,
                new List<Expression> { new PrimitiveExpression(memberReferenceExpression.MemberName, memberReferenceExpression.MemberName) });

            ReplaceCurrentNode(indexerExpression);
            indexerExpression.Parent = memberReferenceExpression.Parent;

            return indexerExpression;
        }
开发者ID:sirrocco,项目名称:rhino-divandb,代码行数:15,代码来源:TransformVisitor.cs


示例4: TransformMapDefinition

        private VariableDeclaration TransformMapDefinition()
        {
            var variableDeclaration = QueryParsingUtils.GetVariableDeclaration(indexDefinition.Map);
            var queryExpression = ((QueryExpression) variableDeclaration.Initializer);
            var expression = queryExpression.FromClause.InExpression;
            if(expression is MemberReferenceExpression) // collection
            {
                var mre = (MemberReferenceExpression)expression;
                queryExpression.FromClause.InExpression = mre.TargetObject;
                //doc["@metadata"]["Raven-Entity-Name"]
                var metadata = new IndexerExpression(
                    new IndexerExpression(new IdentifierExpression(queryExpression.FromClause.Identifier), new List<Expression> { new PrimitiveExpression("@metadata", "@metadata") }),
                    new List<Expression> { new PrimitiveExpression("Raven-Entity-Name", "Raven-Entity-Name") }
                    );
                queryExpression.MiddleClauses.Insert(0,
                    new QueryExpressionWhereClause
                    {
                        Condition =
                            new BinaryOperatorExpression(
                                metadata,
                                BinaryOperatorType.Equality,
                                new PrimitiveExpression(mre.MemberName, mre.MemberName)
                                )
                    });
            }
            var selectOrGroupClause = queryExpression.SelectOrGroupClause;
            var projection = ((QueryExpressionSelectClause) selectOrGroupClause).Projection;
            var objectInitializer = ((ObjectCreateExpression) projection).ObjectInitializer;

            var identifierExpression = new IdentifierExpression(queryExpression.FromClause.Identifier);
            objectInitializer.CreateExpressions.Add(
                new NamedArgumentExpression
                {
                    Name = "__document_id",
                    Expression = new MemberReferenceExpression(identifierExpression, "__document_id")
                });
            return variableDeclaration;
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:38,代码来源:DynamicViewCompiler.cs


示例5: VisitIndexerExpression

		public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
		{
			IReturnType target = ResolveType(indexerExpression.TargetObject);
			return CreateMemberResolveResult(
				GetIndexer(target, indexerExpression.Indexes)
			);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:ResolveVisitor.cs


示例6: TransformMapDefinitionFromLinqQuerySyntax

		private VariableDeclaration TransformMapDefinitionFromLinqQuerySyntax(string query, out string entityName)
		{
			entityName = null;
			var variableDeclaration = QueryParsingUtils.GetVariableDeclarationForLinqQuery(query, RequiresSelectNewAnonymousType);
			var queryExpression = ((QueryExpression) variableDeclaration.Initializer);
			var expression = queryExpression.FromClause.InExpression;
			if(expression is MemberReferenceExpression) // collection
			{
				var mre = (MemberReferenceExpression)expression;
				entityName = mre.MemberName;
				queryExpression.FromClause.InExpression = mre.TargetObject;
				//doc["@metadata"]["Raven-Entity-Name"]
				var metadata = new IndexerExpression(
					new IndexerExpression(new IdentifierExpression(queryExpression.FromClause.Identifier), new List<Expression> { new PrimitiveExpression("@metadata", "@metadata") }),
					new List<Expression> { new PrimitiveExpression(Constants.RavenEntityName, Constants.RavenEntityName) }
					);
				queryExpression.MiddleClauses.Insert(0, 
				                                     new QueryExpressionWhereClause
				                                     {
				                                     	Condition = 
				                                     		new BinaryOperatorExpression(
				                                     		metadata,
				                                     		BinaryOperatorType.Equality,
				                                     		new PrimitiveExpression(mre.MemberName, mre.MemberName)
				                                     		)
				                                     });
			}
			var selectOrGroupClause = queryExpression.SelectOrGroupClause;
			var projection = ((QueryExpressionSelectClause) selectOrGroupClause).Projection;
			if(projection is ObjectCreateExpression == false)
				return variableDeclaration;

			var objectInitializer = ((ObjectCreateExpression) projection).ObjectInitializer;

			var identifierExpression = new IdentifierExpression(queryExpression.FromClause.Identifier);

			if (objectInitializer.CreateExpressions.OfType<NamedArgumentExpression>().Any(x => x.Name == Constants.DocumentIdFieldName))
				return variableDeclaration;

			objectInitializer.CreateExpressions.Add(
				new NamedArgumentExpression
				{
					Name = Constants.DocumentIdFieldName,
					Expression = new MemberReferenceExpression(identifierExpression, Constants.DocumentIdFieldName)
				});
			return variableDeclaration;
		}
开发者ID:neiz,项目名称:ravendb,代码行数:47,代码来源:DynamicViewCompiler.cs


示例7: AddEntityNameFilteringIfNeeded

        private void AddEntityNameFilteringIfNeeded(VariableDeclaration variableDeclaration, out string entityName)
        {
            entityName = null;
            var invocationExpression = ((InvocationExpression)variableDeclaration.Initializer);
            var targetExpression = ((MemberReferenceExpression)invocationExpression.TargetObject);
            while (targetExpression.TargetObject is InvocationExpression)
            {
                invocationExpression = (InvocationExpression) targetExpression.TargetObject;
                targetExpression = (MemberReferenceExpression)invocationExpression.TargetObject;
            }
            if (targetExpression.TargetObject is MemberReferenceExpression) // collection
            {
                var mre = (MemberReferenceExpression)targetExpression.TargetObject;
                entityName = mre.MemberName;
                //doc["@metadata"]["Raven-Entity-Name"]
                var metadata = new IndexerExpression(
                    new IndexerExpression(new IdentifierExpression("__document"), new List<Expression> { new PrimitiveExpression("@metadata", "@metadata") }),
                    new List<Expression> { new PrimitiveExpression("Raven-Entity-Name", "Raven-Entity-Name") }
                    );
                var whereMethod = new InvocationExpression(new MemberReferenceExpression(mre.TargetObject, "Where"),
                                                           new List<Expression>
                                                           {
                                                           	new LambdaExpression
                                                           	{
                                                           		Parameters =
                                                           			{
                                                           				new ParameterDeclarationExpression(null, "__document")
                                                           			},
                                                           		ExpressionBody = new BinaryOperatorExpression(
                                                           			metadata,
                                                           			BinaryOperatorType.Equality,
                                                           			new PrimitiveExpression(mre.MemberName, mre.MemberName)
                                                           			)
                                                           	}
                                                           });

                invocationExpression.TargetObject = new MemberReferenceExpression(whereMethod, targetExpression.MemberName);

            }
        }
开发者ID:vinone,项目名称:ravendb,代码行数:40,代码来源:DynamicViewCompiler.cs


示例8: GetIndexer

		public IProperty GetIndexer(IndexerExpression indexerExpression)
		{
			IReturnType type = (IReturnType)indexerExpression.TargetObject.AcceptVisitor(this, null);
			if (type == null) {
				return null;
			}
			List<IProperty> indexers = type.GetProperties();
			// remove non-indexers:
			for (int i = 0; i < indexers.Count; i++) {
				if (!indexers[i].IsIndexer)
					indexers.RemoveAt(i--);
			}
			IReturnType[] parameters = new IReturnType[indexerExpression.Indexes.Count];
			for (int i = 0; i < parameters.Length; i++) {
				Expression expr = indexerExpression.Indexes[i] as Expression;
				if (expr != null)
					parameters[i] = (IReturnType)expr.AcceptVisitor(this, null);
			}
			return MemberLookupHelper.FindOverload(indexers.ToArray(), parameters);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:20,代码来源:TypeVisitor.cs


示例9: TrackedVisitIndexerExpression

		public override object TrackedVisitIndexerExpression(IndexerExpression indexerExpression, object data)
		{
			indexerExpression.TargetObject.AcceptVisitor(this, data);

			// Add indices.
			foreach (Expression expression in indexerExpression.Indexes) {
				Append("[");
				expression.AcceptVisitor(this, data);
				Append("]");
			}

			return null;
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:13,代码来源:NRefactoryToPythonConverter.cs


示例10: VisitIndexerExpression

		public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
		{
			IProperty i = GetIndexer(indexerExpression);
			if (i != null)
				return i.ReturnType;
			else
				return null;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:8,代码来源:TypeVisitor.cs


示例11: VisitIndexerExpression

		public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
		{
			return base.VisitIndexerExpression(indexerExpression, data);
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:4,代码来源:NRefactoryAstVisitor.cs


示例12: VisitIndexerExpression

 public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
 {
     Debug.Assert((indexerExpression != null));
     Debug.Assert((indexerExpression.TargetObject != null));
     Debug.Assert((indexerExpression.Indexes != null));
     indexerExpression.TargetObject.AcceptVisitor(this, data);
     foreach (Expression o in indexerExpression.Indexes) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     return null;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:12,代码来源:AbstractASTVisitor.cs


示例13: PrimaryExpr


//.........这里部分代码省略.........
		if (pexpr.EndLocation.IsEmpty)
			pexpr.EndLocation = t.EndLocation;
		}
		
		while (StartOf(35)) {

#line  1997 "cs.ATG" 
			startLocation = la.Location; 
			switch (la.kind) {
			case 31: {
				lexer.NextToken();

#line  1999 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); 
				break;
			}
			case 32: {
				lexer.NextToken();

#line  2001 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); 
				break;
			}
			case 47: {
				PointerMemberAccess(
#line  2003 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 15: {
				MemberAccess(
#line  2004 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 20: {
				lexer.NextToken();

#line  2008 "cs.ATG" 
				List<Expression> parameters = new List<Expression>(); 

#line  2009 "cs.ATG" 
				pexpr = new InvocationExpression(pexpr, parameters); 
				if (StartOf(25)) {
					Argument(
#line  2010 "cs.ATG" 
out expr);

#line  2010 "cs.ATG" 
					SafeAdd(pexpr, parameters, expr); 
					while (la.kind == 14) {
						lexer.NextToken();
						Argument(
#line  2011 "cs.ATG" 
out expr);

#line  2011 "cs.ATG" 
						SafeAdd(pexpr, parameters, expr); 
					}
				}
				Expect(21);
				break;
			}
			case 18: {

#line  2017 "cs.ATG" 
				List<Expression> indices = new List<Expression>();
				pexpr = new IndexerExpression(pexpr, indices);
				
				lexer.NextToken();
				Expr(
#line  2020 "cs.ATG" 
out expr);

#line  2020 "cs.ATG" 
				SafeAdd(pexpr, indices, expr); 
				while (la.kind == 14) {
					lexer.NextToken();
					Expr(
#line  2021 "cs.ATG" 
out expr);

#line  2021 "cs.ATG" 
					SafeAdd(pexpr, indices, expr); 
				}
				Expect(19);
				break;
			}
			}

#line  2024 "cs.ATG" 
			if (pexpr != null) {
			if (pexpr.StartLocation.IsEmpty)
				pexpr.StartLocation = startLocation;
			if (pexpr.EndLocation.IsEmpty)
				pexpr.EndLocation = t.EndLocation;
			}
			
		}
	}
开发者ID:pluraldj,项目名称:SharpDevelop,代码行数:101,代码来源:Parser.cs


示例14: AddEntityNameFilteringIfNeeded

		private void AddEntityNameFilteringIfNeeded(VariableDeclaration variableDeclaration, out string entityName)
		{
			entityName = null;
			var invocationExpression = ((InvocationExpression)variableDeclaration.Initializer);
			var targetExpression = ((MemberReferenceExpression)invocationExpression.TargetObject);
			while (targetExpression.TargetObject is InvocationExpression)
			{
				invocationExpression = (InvocationExpression) targetExpression.TargetObject;
				targetExpression = (MemberReferenceExpression)invocationExpression.TargetObject;
			}
			if (targetExpression.TargetObject is MemberReferenceExpression) // collection
			{
				var mre = (MemberReferenceExpression)targetExpression.TargetObject;
				entityName = mre.MemberName;
				//doc["@metadata"]["Raven-Entity-Name"]
				var metadata = new IndexerExpression(
					new IndexerExpression(new IdentifierExpression("__document"), new List<Expression> { new PrimitiveExpression("@metadata", "@metadata") }),
					new List<Expression> { new PrimitiveExpression(Constants.RavenEntityName, Constants.RavenEntityName) }
					);

				// string.Equals(doc["@metadata"]["Raven-Entity-Name"], "Blogs", StringComparison.InvariantCultureIgnoreCase)
				var binaryOperatorExpression =
					new InvocationExpression(
						new MemberReferenceExpression(new TypeReferenceExpression(new TypeReference("string", true)), "Equals"),
						new List<Expression>
						{
							metadata,
							new PrimitiveExpression(mre.MemberName, mre.MemberName),
							new MemberReferenceExpression(new TypeReferenceExpression(new TypeReference(typeof(StringComparison).FullName)),"InvariantCultureIgnoreCase")
						});
				var whereMethod = new InvocationExpression(new MemberReferenceExpression(mre.TargetObject, "Where"),
				                                           new List<Expression>
				                                           {
				                                           	new LambdaExpression
				                                           	{
				                                           		Parameters =
				                                           			{
				                                           				new ParameterDeclarationExpression(null, "__document")
				                                           			},
				                                           		ExpressionBody = binaryOperatorExpression
				                                           	}
				                                           });

				invocationExpression.TargetObject = new MemberReferenceExpression(whereMethod, targetExpression.MemberName);

			}
		}
开发者ID:shiranGinige,项目名称:ravendb,代码行数:47,代码来源:DynamicViewCompiler.cs


示例15: VisitIndexerExpression

 public object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
 {
     throw new NotImplementedException ();
 }
开发者ID:Monobjc,项目名称:monobjc-tools,代码行数:4,代码来源:CodeDomExpressionPrinter.cs


示例16: VisitIndexerExpression

 public virtual bool VisitIndexerExpression(IndexerExpression indexerExpression, object d)
 {
     if ((indexerExpression == null)) {
         return SetFailure();
     }
     if ((d == null)) {
         return SetFailure();
     }
     if ((indexerExpression.TargetObject == null)) {
         return SetFailure();
     }
     if ((indexerExpression.Indexes == null)) {
         return SetFailure();
     }
     if(indexerExpression.GetType() != d.GetType()) {return SetFailure();}
     var data = (IndexerExpression)d;
     if (!IsMatch(indexerExpression, data)) {
         return SetFailure();
     }
     indexerExpression.TargetObject.AcceptVisitor(this, data.TargetObject);
     if (indexerExpression.Indexes.Count == data.Indexes.Count) {
     for (int i=0; i<indexerExpression.Indexes.Count;i++) {
         Expression o = indexerExpression.Indexes[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Indexes[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     return true;
 }
开发者ID:jbuedel,项目名称:AgentRalphPlugin,代码行数:28,代码来源:AstComparisonVisitor.Generated.cs


示例17: VisitIndexerExpression

 public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
 {
     indexerExpression.TargetObject.Parent = indexerExpression;
     foreach (Expression expr in indexerExpression.Indexes)
     {
         expr.Parent = indexerExpression;
     }
     return base.VisitIndexerExpression(indexerExpression, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:9,代码来源:ParentVisitor.cs


示例18: InitArrayStatement

 private AssignmentExpression InitArrayStatement(ArrayCreateExpression arrayCreateExpression, string variableName, List<Expression> creatExpressions, int index)
 {
     IdentifierExpression identifierExpression = new IdentifierExpression(variableName);
     List<Expression> indexes = new List<Expression>();
     indexes.Add(new PrimitiveExpression(index, index.ToString()));
     IndexerExpression left = new IndexerExpression(identifierExpression, indexes);
     string createType = arrayCreateExpression.CreateType.Type;
     ArrayCreateExpression right = new ArrayCreateExpression(new TypeReference(createType, new int[1]));
     right.ArrayInitializer = new CollectionInitializerExpression(creatExpressions);
     return new AssignmentExpression(left, AssignmentOperatorType.Assign, right);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:11,代码来源:ArrayInitializerTransformer.cs


示例19: VisitIndexerExpression

 public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
 {
     return new CodeIndexerExpression((CodeExpression)indexerExpression.TargetObject.AcceptVisitor(this, data), GetExpressionList(indexerExpression.Indexes));
 }
开发者ID:almazik,项目名称:ILSpy,代码行数:4,代码来源:CodeDOMOutputVisitor.cs


示例20: VisitIndexerExpression

		public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
			throw new global::System.NotImplementedException("IndexerExpression");
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:3,代码来源:NotImplementedAstVisitor.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Ast.InvocationExpression类代码示例发布时间:2022-05-26
下一篇:
C# Ast.IdentifierExpression类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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