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


C# Ast.AssignmentExpression类代码示例

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


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

示例1: VisitAssignmentExpression

		public virtual object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
			Debug.Assert((assignmentExpression != null));
			Debug.Assert((assignmentExpression.Left != null));
			Debug.Assert((assignmentExpression.Right != null));
			assignmentExpression.Left.AcceptVisitor(this, data);
			return assignmentExpression.Right.AcceptVisitor(this, data);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:AbstractASTVisitor.cs

示例2: VisitAssignmentExpression

 public override object VisitAssignmentExpression(AssignmentExpression assignment, object data)
 {
     IdentifierExpression ident = assignment.Left as IdentifierExpression;
     BinaryOperatorExpression binary = assignment.Right as BinaryOperatorExpression;
     if (ident != null && binary != null) {
         IdentifierExpression binaryLeft = binary.Left as IdentifierExpression;
         if (binaryLeft != null &&
             binaryLeft.Identifier == ident.Identifier) {
             if (binary.Right is PrimitiveExpression &&
                 1.Equals((binary.Right as PrimitiveExpression).Value)) {
                 if (binary.Op == BinaryOperatorType.Add) {
                     ReplaceCurrentNode(new UnaryOperatorExpression(ident, UnaryOperatorType.PostIncrement));
                 }
                 if (binary.Op == BinaryOperatorType.Subtract) {
                     ReplaceCurrentNode(new UnaryOperatorExpression(ident, UnaryOperatorType.PostDecrement));
                 }
             } else {
                 if (binary.Op == BinaryOperatorType.Add) {
                     ReplaceCurrentNode(new AssignmentExpression(ident, AssignmentOperatorType.Add, binary.Right));
                 }
                 if (binary.Op == BinaryOperatorType.Subtract) {
                     ReplaceCurrentNode(new AssignmentExpression(ident, AssignmentOperatorType.Subtract, binary.Right));
                 }
             }
             return null;
         }
     }
     return null;
 }
开发者ID:almazik,项目名称:ILSpy,代码行数:29,代码来源:Idioms.cs

示例3: VisitAssignmentExpression

 public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
 {
     tw.WriteStartElement("AssignmentExpression");
     tw.WriteAttributeString("Op", assignmentExpression.Op.ToString());
     base.VisitAssignmentExpression(assignmentExpression, data);
     tw.WriteEndElement();
     return null;
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:8,代码来源:AstXmlOutputVisitor.cs

示例4: VisitAssignmentExpression

        public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
        {
            var primitiveExpression = assignmentExpression.Right as PrimitiveExpression;
            if (primitiveExpression != null)
            {

            }
            return base.VisitAssignmentExpression(assignmentExpression, data);
        }
开发者ID:timdams,项目名称:strokes,代码行数:9,代码来源:AchievementVisitor.cs

示例5: VisitAssignmentExpression

		public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
		{
			if (!hasAssignment) {
				if (assignmentExpression.Left is IdentifierExpression) {
					hasAssignment = (((IdentifierExpression)assignmentExpression.Left).Identifier == name) &&
						(assignmentExpression.StartLocation >= startRange && assignmentExpression.EndLocation <= endRange);
				}
			}
			return base.VisitAssignmentExpression(assignmentExpression, data);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:10,代码来源:HasAssignmentsVisitor.cs

示例6: VisitTypeDeclaration

		public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
		{
			base.VisitTypeDeclaration(typeDeclaration, data); // visit methods
			typeDeclaration.Attributes.Clear();
			typeDeclaration.BaseTypes.Clear();
			
			// add constructor accepting the wrapped object and the field holding the object
			FieldDeclaration fd = new FieldDeclaration(null, // no attributes
			                                           new TypeReference(typeDeclaration.Name),
			                                           Modifiers.Private);
			fd.Fields.Add(new VariableDeclaration("wrappedObject"));
			typeDeclaration.AddChild(fd);
			
			typeDeclaration.Name += "Wrapper";
			if (typeDeclaration.Type == ClassType.Interface) {
				typeDeclaration.Type = ClassType.Class;
				typeDeclaration.Name = typeDeclaration.Name.Substring(1);
			}
			ConstructorDeclaration cd = new ConstructorDeclaration(typeDeclaration.Name,
			                                                       Modifiers.Public,
			                                                       new List<ParameterDeclarationExpression>(),
			                                                       null);
			cd.Parameters.Add(new ParameterDeclarationExpression(fd.TypeReference,
			                                                     "wrappedObject"));
			// this.wrappedObject = wrappedObject;
			Expression fieldReference = new MemberReferenceExpression(new ThisReferenceExpression(),
			                                                         "wrappedObject");
			Expression assignment = new AssignmentExpression(fieldReference,
			                                                 AssignmentOperatorType.Assign,
			                                                 new IdentifierExpression("wrappedObject"));
			cd.Body = new BlockStatement();
			cd.Body.AddChild(new ExpressionStatement(assignment));
			typeDeclaration.AddChild(cd);
			
			for (int i = 0; i < typeDeclaration.Children.Count; i++) {
				object child = typeDeclaration.Children[i];
				if (child is MethodDeclaration) {
					MethodDeclaration method = (MethodDeclaration)child;
					if (method.Parameters.Count == 0 &&
					    (method.Name.StartsWith("Is") || method.Name.StartsWith("Get")))
					{
						// replace the method with a property
						PropertyDeclaration prop = new PropertyDeclaration(method.Modifier,
						                                                   method.Attributes,
						                                                   method.Name,
						                                                   null);
						prop.TypeReference = method.TypeReference;
						prop.GetRegion = new PropertyGetRegion(method.Body, null);
						typeDeclaration.Children[i] = prop;
					}
				}
			}
			
			return null;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:55,代码来源:WrapperGeneratorVisitor.cs

示例7: VisitAssignmentExpression

		public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
		{
			// Calculate right first so that left does not get invalidated by its calculation
			Value right = ((Value)assignmentExpression.Right.AcceptVisitor(this, null)).GetPermanentReference();
			Value left = (Value)assignmentExpression.Left.AcceptVisitor(this, null);
			if (!left.IsReference && left.Type.FullName != right.Type.FullName) {
				throw new GetValueException(string.Format("Type {0} expected, {1} seen", left.Type.FullName, right.Type.FullName));
			}
			left.SetValue(right);
			return right;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:11,代码来源:EvaluateAstVisitor.cs

示例8: GetVariableNameFromAssignment

		string GetVariableNameFromAssignment(AssignmentExpression assignment)
		{
			if (assignment == null)
				return null;
			var identifier = assignment.Left as IdentifierExpression;
			if (identifier == null)
				return null;
			if (assignment.Right is ObjectCreateExpression)
				// // don't offer action for "a = new Foo()"
				return null;
			return identifier.Identifier;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:CheckAssignmentCache.cs

示例9: GetVariableNameFromAssignment

		string GetVariableNameFromAssignment(AssignmentExpression assignment)
		{
			if (assignment == null)
				return null;
			var identifier = assignment.Left as IdentifierExpression;
			if (identifier == null)
				return null;
			if ((!ExpressionCanBeNull(assignment.Right)) || ExpressionIsValueType(assignment.Right))
				// don't offer action where it makes no sense
				return null;
			return identifier.Identifier;
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:12,代码来源:CheckAssignmentCache.cs

示例10: VisitAssignmentExpression

 public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
 {
     base.VisitAssignmentExpression(assignmentExpression, data);
     if (assignmentExpression.Op == AssignmentOperatorType.Assign && !(assignmentExpression.Parent is ExpressionStatement)) {
         AddInlineAssignHelper();
         ReplaceCurrentNode(
             new InvocationExpression(
                 new IdentifierExpression("InlineAssignHelper"),
                 new List<Expression>().add(assignmentExpression.Left)
                                       .add(assignmentExpression.Right)));
     }
     return null;
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:13,代码来源:ToVBNetConvertVisitor.cs

示例11: GenerateCode

		public override void GenerateCode(List<AbstractNode> nodes, IList items)
		{
			ConstructorDeclaration ctor = new ConstructorDeclaration(currentClass.Name, Modifiers.Public, null, null);
			ctor.Body = new BlockStatement();
			foreach (FieldWrapper w in items) {
				string parameterName = codeGen.GetParameterName(w.Field.Name);
				ctor.Parameters.Add(new ParameterDeclarationExpression(ConvertType(w.Field.ReturnType),
				                                                       parameterName));
				Expression left  = new MemberReferenceExpression(new ThisReferenceExpression(), w.Field.Name);
				Expression right = new IdentifierExpression(parameterName);
				Expression expr  = new AssignmentExpression(left, AssignmentOperatorType.Assign, right);
				ctor.Body.AddChild(new ExpressionStatement(expr));
			}
			nodes.Add(ctor);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:15,代码来源:ConstructorCodeGenerator.cs

示例12: VisitAssignmentExpression

            public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
            {
                if(assignmentExpression.Right is PrimitiveExpression)
                {
                    PrimitiveExpression prim = (PrimitiveExpression) assignmentExpression.Right;

                    int number;
                    if (int.TryParse(prim.StringValue, out number))
                    {
                        if (number == 666)
                            UnlockWith(assignmentExpression);
                    }
                }
                return base.VisitAssignmentExpression(assignmentExpression, data);
            }
开发者ID:timdams,项目名称:strokes,代码行数:15,代码来源:BeastNumberAchievement.cs

示例13: TrackedVisitFieldDeclaration

        public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
        {
            VariableDeclaration field = (VariableDeclaration) fieldDeclaration.Fields[0];
            TypeDeclaration typeDeclaration = (TypeDeclaration) fieldDeclaration.Parent;

            NodeTypeExistenceVisitor nodeTypeExistenceVisitor = new NodeTypeExistenceVisitor(typeof(ThisReferenceExpression));
            NodeTypeExistenceVisitor indexerNodeExistenceVisitor = new NodeTypeExistenceVisitor(typeof(IndexerExpression));
            field.Initializer.AcceptVisitor(nodeTypeExistenceVisitor, null);
            field.Initializer.AcceptVisitor(indexerNodeExistenceVisitor, null);
            if (field.Initializer != null && (field.Initializer is InvocationExpression || IsArrayCreation(fieldDeclaration) || nodeTypeExistenceVisitor.Contains || indexerNodeExistenceVisitor.Contains)
                && !AstUtil.ContainsModifier(fieldDeclaration, Modifiers.Static))
            {
                IList constructors = AstUtil.GetChildrenWithType(typeDeclaration, typeof(ConstructorDeclaration));

                IdentifierExpression left = new IdentifierExpression(field.Name);
                Expression right = field.Initializer;
                AssignmentExpression assignmentExpression = new AssignmentExpression(left, AssignmentOperatorType.Assign, right);
                ExpressionStatement ExpressionStatement = new ExpressionStatement(assignmentExpression);
                field.Initializer = null;
                ConstructorDeclaration constructorDeclaration = null;
                ExpressionStatement.Parent = constructorDeclaration;

                foreach (ConstructorDeclaration consDec in constructors)
                {
                    if (!AstUtil.ContainsModifier(consDec, Modifiers.Static))
                    {
                        if (consDec.Parameters.Count == 0)
                        {
                            constructorDeclaration = consDec;
                            constructorDeclaration.Body.Children.Add(ExpressionStatement);
                            constructorDeclaration.Parent = typeDeclaration;
                            return base.TrackedVisitFieldDeclaration(fieldDeclaration, data);
                        }
                        else
                        {
                            consDec.ConstructorInitializer = new ConstructorInitializer();
                            consDec.ConstructorInitializer.ConstructorInitializerType = ConstructorInitializerType.This;
                        }
                    }
                }
                constructorDeclaration = GetConstructor(ExpressionStatement, typeDeclaration);
                constructorDeclaration.Parent = typeDeclaration;
                return base.TrackedVisitFieldDeclaration(fieldDeclaration, data);
            }
            return base.TrackedVisitFieldDeclaration(fieldDeclaration, data);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:46,代码来源:FieldInitializerTransformer.cs

示例14: VisitAssignmentExpression

		public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
		{
			base.VisitAssignmentExpression(assignmentExpression, data);
			
			if (vbMyFormsClass != null) {
				TypeResolveResult trr = Resolve(assignmentExpression.Right) as TypeResolveResult;
				if (trr != null && trr.ResolvedClass != null) {
					foreach (IProperty p in vbMyFormsClass.Properties) {
						if (p.ReturnType.FullyQualifiedName == trr.ResolvedClass.FullyQualifiedName) {
							assignmentExpression.Right = MakeFieldReferenceExpression("My.MyProject.Forms." + p.Name);
							break;
						}
					}
				}
			}
			
			return null;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:18,代码来源:VBNetToCSharpConvertVisitorWithMyFormsSupport.cs

示例15: VisitAssignmentExpression

            public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
            {
                if (assignmentExpression.Left is MemberReferenceExpression)
                {
                    MemberReferenceExpression left = (MemberReferenceExpression)assignmentExpression.Left;
                    if (eventVars.Contains(left.MemberName)) // I don't check against correct type yet
                    {
                        if (assignmentExpression.Right is ObjectCreateExpression)
                        {
                            ObjectCreateExpression right = (ObjectCreateExpression)assignmentExpression.Right;
                            if (right.CreateType.Type.Contains("EventHandler") && assignmentExpression.Op == AssignmentOperatorType.Add)
                                UnlockWith(assignmentExpression); // Only works when using the implicit += new SomeEventHandler() syntax
                        }
                    }
                }

                return base.VisitAssignmentExpression(assignmentExpression, data);
            }
开发者ID:timdams,项目名称:strokes,代码行数:18,代码来源:SubscribeToEventAchievement.cs


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