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


C# AssignmentExpression.AddChild方法代码示例

本文整理汇总了C#中AssignmentExpression.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# AssignmentExpression.AddChild方法的具体用法?C# AssignmentExpression.AddChild怎么用?C# AssignmentExpression.AddChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AssignmentExpression的用法示例。


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

示例1: Visit

			public override object Visit (CompoundAssign compoundAssign)
			{
				var result = new AssignmentExpression ();
				int opLength = 2;
				switch (compoundAssign.Op) {
				case Binary.Operator.Multiply:
					result.AssignmentOperatorType = AssignmentOperatorType.Multiply;
					break;
				case Binary.Operator.Division:
					result.AssignmentOperatorType = AssignmentOperatorType.Divide;
					break;
				case Binary.Operator.Modulus:
					result.AssignmentOperatorType = AssignmentOperatorType.Modulus;
					break;
				case Binary.Operator.Addition:
					result.AssignmentOperatorType = AssignmentOperatorType.Add;
					break;
				case Binary.Operator.Subtraction:
					result.AssignmentOperatorType = AssignmentOperatorType.Subtract;
					break;
				case Binary.Operator.LeftShift:
					result.AssignmentOperatorType = AssignmentOperatorType.ShiftLeft;
					opLength = 3;
					break;
				case Binary.Operator.RightShift:
					result.AssignmentOperatorType = AssignmentOperatorType.ShiftRight;
					opLength = 3;
					break;
				case Binary.Operator.BitwiseAnd:
					result.AssignmentOperatorType = AssignmentOperatorType.BitwiseAnd;
					break;
				case Binary.Operator.BitwiseOr:
					result.AssignmentOperatorType = AssignmentOperatorType.BitwiseOr;
					break;
				case Binary.Operator.ExclusiveOr:
					result.AssignmentOperatorType = AssignmentOperatorType.ExclusiveOr;
					break;
				}
				
				result.AddChild ((INode)compoundAssign.Target.Accept (this), AssignmentExpression.LeftExpressionRole);
				result.AddChild (new CSharpTokenNode (Convert (compoundAssign.Location), opLength), AssignmentExpression.OperatorRole);
				result.AddChild ((INode)compoundAssign.Source.Accept (this), AssignmentExpression.RightExpressionRole);
				return result;
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:44,代码来源:CSharpParser.cs

示例2: Visit

			public override object Visit(SimpleAssign simpleAssign)
			{
				var result = new AssignmentExpression();
				
				result.Operator = AssignmentOperatorType.Assign;
				if (simpleAssign.Target != null)
					result.AddChild((Expression)simpleAssign.Target.Accept(this), AssignmentExpression.LeftRole);
				var location = LocationsBag.GetLocations(simpleAssign);
				if (location != null)
					result.AddChild(new CSharpTokenNode(Convert(location [0]), AssignmentExpression.AssignRole), AssignmentExpression.AssignRole);
				if (simpleAssign.Source != null) {
					result.AddChild((Expression)simpleAssign.Source.Accept(this), AssignmentExpression.RightRole);
				}
				return result;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:15,代码来源:CSharpParser.cs

示例3: GetAttributes

			IEnumerable<Attribute> GetAttributes (List<Mono.CSharp.Attribute> optAttributes)
			{
				if (optAttributes == null)
					yield break;
				foreach (var attr in optAttributes) {
					Attribute result = new Attribute ();
					result.Type = ConvertToType (attr.TypeNameExpression);
					
					if (attr.PosArguments != null) {
						foreach (var arg in attr.PosArguments) {
							result.AddChild ((Expression)arg.Expr.Accept (this), Attribute.Roles.Argument);
						}
					}
					if (attr.NamedArguments != null) { 
						foreach (NamedArgument na in attr.NamedArguments) {
							var newArg = new AssignmentExpression ();
							newArg.Operator = AssignmentOperatorType.Assign;
							newArg.AddChild (new IdentifierExpression (na.Name, Convert (na.Location)), AssignmentExpression.LeftRole);
							
							var loc = LocationsBag.GetLocations (na);
							if (loc != null)
								newArg.AddChild (new CSharpTokenNode (Convert (loc[0]), 1), AssignmentExpression.Roles.Assign);
							newArg.AddChild ((Expression)na.Expr.Accept (this), AssignmentExpression.RightRole);
							result.AddChild (newArg, Attribute.Roles.Argument);
						}
					}
					yield return result;
				}
			}
开发者ID:hduregger,项目名称:monodevelop,代码行数:29,代码来源:CSharpParser.cs


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