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


C# DirectionExpression类代码示例

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


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

示例1: VisitDirectionExpression

 public override void VisitDirectionExpression(DirectionExpression directionExpression)
 {
     this.DirectionExpression.Add(directionExpression.Expression);
     base.VisitDirectionExpression(directionExpression);
 }
开发者ID:txdv,项目名称:Builder,代码行数:5,代码来源:ReferenceArgumentVisitor.cs

示例2: TrackedVisitDirectionExpression

		public virtual object TrackedVisitDirectionExpression(DirectionExpression directionExpression, object data) {
			return base.VisitDirectionExpression(directionExpression, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:3,代码来源:NodeTrackingAstVisitor.cs

示例3: AddArguments

			void AddArguments (AbstractCSharpNode parent, object location, Mono.CSharp.Arguments args)
			{
				if (args == null)
					return;
				
				var commaLocations = LocationsBag.GetLocations (args);
				
				for (int i = 0; i < args.Count; i++) {
					Argument arg = args[i];
					if (arg.ArgType == Argument.AType.Out || arg.ArgType == Argument.AType.Ref) {
						DirectionExpression direction = new DirectionExpression ();
						direction.FieldDirection = arg.ArgType == Argument.AType.Out ? FieldDirection.Out : FieldDirection.Ref;
						var argLocation = LocationsBag.GetLocations (arg);
						if (location != null)
							direction.AddChild (new CSharpTokenNode (Convert (argLocation[0]), "123".Length), InvocationExpression.Roles.Keyword);
						direction.AddChild ((INode)arg.Expr.Accept (this), InvocationExpression.Roles.Expression);
						
						parent.AddChild (direction, InvocationExpression.Roles.Argument);
					} else {
						parent.AddChild ((INode)arg.Expr.Accept (this), InvocationExpression.Roles.Argument);
					}
					if (commaLocations != null && i > 0) {
						int idx = commaLocations.Count - i;
						if (idx >= 0)
							parent.AddChild (new CSharpTokenNode (Convert (commaLocations[idx]), 1), InvocationExpression.Roles.Comma);
					}
				}
				if (commaLocations != null && commaLocations.Count > args.Count) 
					parent.AddChild (new CSharpTokenNode (Convert (commaLocations[0]), 1), InvocationExpression.Roles.Comma);
			}
开发者ID:silk,项目名称:monodevelop,代码行数:30,代码来源:CSharpParser.cs

示例4: VisitDirectionExpression

		public virtual void VisitDirectionExpression (DirectionExpression directionExpression)
		{
			VisitChildren (directionExpression);
		}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs

示例5: CreateFromStatements

		CodeAction CreateFromStatements(RefactoringContext context, List<AstNode> statements)
		{
			if (!(statements [0].Parent is Statement))
				return null;
			
			return new CodeAction(context.TranslateString("Extract method"), script => {
				string methodName = "NewMethod";
				var method = new MethodDeclaration() {
					ReturnType = new PrimitiveType("void"),
					Name = methodName,
					Body = new BlockStatement()
				};
				bool usesNonStaticMember = false;
				foreach (var node in statements) {
					usesNonStaticMember |= StaticVisitor.UsesNotStaticMember(context, node);
					if (node is Statement) {
						method.Body.Add((Statement)node.Clone());
					} else {
						method.Body.AddChildUnsafe (node.Clone (), node.Role);
					}
				}
				if (!usesNonStaticMember)
					method.Modifiers |= Modifiers.Static;
				
				var target = new IdentifierExpression(methodName);
				var invocation = new InvocationExpression(target);
				
				var usedVariables = VariableLookupVisitor.Analyze(context, statements);
				
				var inExtractedRegion = new VariableUsageAnalyzation (context, usedVariables);
				var lastStatement = statements [statements.Count - 1];
				
				var stmt = statements [0].GetParent<BlockStatement>();
				while (stmt.GetParent<BlockStatement> () != null) {
					stmt = stmt.GetParent<BlockStatement>();
				}
				
				inExtractedRegion.SetAnalyzedRange(statements [0], lastStatement);
				stmt.AcceptVisitor (inExtractedRegion);
				
				var beforeExtractedRegion = new VariableUsageAnalyzation (context, usedVariables);
				beforeExtractedRegion.SetAnalyzedRange(statements [0].Parent, statements [0], true, false);
				stmt.AcceptVisitor (beforeExtractedRegion);
				
				var afterExtractedRegion = new VariableUsageAnalyzation (context, usedVariables);
				afterExtractedRegion.SetAnalyzedRange(lastStatement, stmt.Statements.Last(), false, true);
				stmt.AcceptVisitor (afterExtractedRegion);
				usedVariables.Sort ((l, r) => l.Region.Begin.CompareTo (r.Region.Begin));

				IVariable generatedReturnVariable = null;
				foreach (var variable in usedVariables) {
					if ((variable is IParameter) || beforeExtractedRegion.Has (variable) || !afterExtractedRegion.Has (variable))
						continue;
					generatedReturnVariable = variable;
					method.ReturnType = context.CreateShortType (variable.Type);
					method.Body.Add (new ReturnStatement (new IdentifierExpression (variable.Name)));
					break;
				}

				int parameterOutCount = 0;
				foreach (var variable in usedVariables) {
					if (!(variable is IParameter) && !beforeExtractedRegion.Has (variable) && !afterExtractedRegion.Has (variable))
						continue;
					if (variable == generatedReturnVariable)
						continue;
					Expression argumentExpression = new IdentifierExpression(variable.Name); 
					
					ParameterModifier mod = ParameterModifier.None;
					if (inExtractedRegion.GetStatus (variable) == VariableState.Changed) {
						if (beforeExtractedRegion.GetStatus (variable) == VariableState.None) {
							mod = ParameterModifier.Out;
							argumentExpression = new DirectionExpression(FieldDirection.Out, argumentExpression);
							parameterOutCount++;
						} else {
							mod = ParameterModifier.Ref;
							argumentExpression = new DirectionExpression(FieldDirection.Ref, argumentExpression);
						}
					}
					
					method.Parameters.Add(new ParameterDeclaration(context.CreateShortType(variable.Type), variable.Name, mod));
					invocation.Arguments.Add(argumentExpression);
				}

				ParameterDeclaration parameterToTransform = null;
				bool transformParameterToReturn = method.ReturnType is PrimitiveType && 
				                                  ((PrimitiveType)method.ReturnType).Keyword == "void" &&
				                                  parameterOutCount == 1;
				if(transformParameterToReturn) {
					parameterToTransform = method.Parameters.First(p => p.ParameterModifier == ParameterModifier.Out);
					parameterToTransform.Remove();
					var argumentExpression = invocation.Arguments.OfType<DirectionExpression>().First(a => a.FieldDirection == FieldDirection.Out);
					argumentExpression.Remove();
					method.ReturnType = parameterToTransform.Type.Clone();
					var argumentDecl = new VariableDeclarationStatement(parameterToTransform.Type.Clone(),parameterToTransform.Name);
					method.Body.InsertChildBefore(method.Body.First(),argumentDecl,BlockStatement.StatementRole);
					method.Body.Add(new ReturnStatement (new IdentifierExpression (parameterToTransform.Name)));
				}

				script
					.InsertWithCursor(context.TranslateString("Extract method"), Script.InsertPosition.Before, method)
//.........这里部分代码省略.........
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:101,代码来源:ExtractMethodAction.cs

示例6: VisitDirectionExpression

 public override StringBuilder VisitDirectionExpression(DirectionExpression directionExpression, int data)
 {
     // at invocation time we wont pass out or inout keywords so
     // this just passes through
     return directionExpression.Expression.AcceptVisitor(this, data);
 }
开发者ID:mono-soc-2011,项目名称:SLSharp,代码行数:6,代码来源:GlslVisitor.cs

示例7: ConvertArgument

			Expression ConvertArgument (Argument arg)
			{
				if (arg is NamedArgument) {
					var na = (NamedArgument)arg;
					NamedArgumentExpression newArg = new NamedArgumentExpression();
					newArg.AddChild (Identifier.Create (na.Name, Convert (na.Location)), NamedArgumentExpression.Roles.Identifier);
					
					var loc = LocationsBag.GetLocations (na);
					if (loc != null)
						newArg.AddChild (new CSharpTokenNode (Convert (loc[0]), 1), NamedArgumentExpression.Roles.Colon);
					
					if (arg.ArgType == Argument.AType.Out || arg.ArgType == Argument.AType.Ref) {
						DirectionExpression direction = new DirectionExpression ();
						direction.FieldDirection = arg.ArgType == Argument.AType.Out ? FieldDirection.Out : FieldDirection.Ref;
						var argLocation = LocationsBag.GetLocations (arg);
						if (argLocation != null)
							direction.AddChild (new CSharpTokenNode (Convert (argLocation[0]), "123".Length), InvocationExpression.Roles.Keyword);
						direction.AddChild ((Expression)arg.Expr.Accept (this), InvocationExpression.Roles.Expression);
						newArg.AddChild (direction, NamedArgumentExpression.Roles.Expression);
					} else {
						newArg.AddChild ((Expression)na.Expr.Accept (this), NamedArgumentExpression.Roles.Expression);
					}
					return newArg;
				}
				
				if (arg.ArgType == Argument.AType.Out || arg.ArgType == Argument.AType.Ref) {
					DirectionExpression direction = new DirectionExpression ();
					direction.FieldDirection = arg.ArgType == Argument.AType.Out ? FieldDirection.Out : FieldDirection.Ref;
					var argLocation = LocationsBag.GetLocations (arg);
					if (argLocation != null)
						direction.AddChild (new CSharpTokenNode (Convert (argLocation[0]), "123".Length), InvocationExpression.Roles.Keyword);
					direction.AddChild ((Expression)arg.Expr.Accept (this), InvocationExpression.Roles.Expression);
					return direction;
				}
				
				return (Expression)arg.Expr.Accept (this);
			}
开发者ID:N3X15,项目名称:ILSpy,代码行数:37,代码来源:CSharpParser.cs

示例8: Argument

	void Argument(
#line  1372 "cs.ATG" 
out Expression argumentexpr) {

#line  1374 "cs.ATG" 
		Expression expr;
		FieldDirection fd = FieldDirection.None;
		
		if (la.kind == 93 || la.kind == 100) {
			if (la.kind == 100) {
				lexer.NextToken();

#line  1379 "cs.ATG" 
				fd = FieldDirection.Ref; 
			} else {
				lexer.NextToken();

#line  1380 "cs.ATG" 
				fd = FieldDirection.Out; 
			}
		}
		Expr(
#line  1382 "cs.ATG" 
out expr);

#line  1383 "cs.ATG" 
		argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr; 
	}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:28,代码来源:Parser.cs

示例9: VisitDirectionExpression

            public override void VisitDirectionExpression(DirectionExpression directionExpression)
            {
                base.VisitDirectionExpression(directionExpression);

                HandlePotentialWrite(directionExpression);
            }
开发者ID:artifexor,项目名称:NRefactory,代码行数:6,代码来源:ExceptionRethrowIssue.cs

示例10: VisitDirectionExpression

        public void VisitDirectionExpression(DirectionExpression directionExpression)
        {
            JsonObject expression = CreateJsonExpression(directionExpression);
            switch (directionExpression.FieldDirection)
            {
                case FieldDirection.Out:
                    //essential
                    expression.AddJsonValue("keyword", GetKeyword(DirectionExpression.OutKeywordRole));
                    break;
                case FieldDirection.Ref:
                    //essential
                    expression.AddJsonValue("keyword", GetKeyword(DirectionExpression.RefKeywordRole));
                    break;
                default:
                    throw new NotSupportedException("Invalid value for FieldDirection");
            }

            expression.AddJsonValue("expression", GenExpression(directionExpression.Expression));

            Push(expression);
        }
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:21,代码来源:AstCsToJson.cs

示例11: VisitDirectionExpression

		public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
			Debug.Assert((directionExpression != null));
			Debug.Assert((directionExpression.Expression != null));
			return directionExpression.Expression.AcceptVisitor(this, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:5,代码来源:AbstractASTVisitor.cs

示例12: VisitDirectionExpression

 public void VisitDirectionExpression(DirectionExpression node)
 {
     NotSupported(node);
 }
开发者ID:evanw,项目名称:minisharp,代码行数:4,代码来源:Lower.cs

示例13: VisitDirectionExpression

		public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
			throw new global::System.NotImplementedException("DirectionExpression");
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:3,代码来源:NotImplementedAstVisitor.cs

示例14: VisitDirectionExpression

		public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
			Debug.Assert((directionExpression != null));
			Debug.Assert((directionExpression.Expression != null));
			nodeStack.Push(directionExpression.Expression);
			directionExpression.Expression.AcceptVisitor(this, data);
			directionExpression.Expression = ((Expression)(nodeStack.Pop()));
			return null;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:8,代码来源:AbstractAstTransformer.cs

示例15: VisitDirectionExpression

 public virtual void VisitDirectionExpression(DirectionExpression directionExpression)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(directionExpression);
     }
 }
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs


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