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


C# DestructorDeclaration类代码示例

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


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

示例1: Visit

			public override void Visit (Destructor d)
			{
				DestructorDeclaration newDestructor = new DestructorDeclaration ();
				var location = LocationsBag.GetMemberLocation (d);
				AddModifiers (newDestructor, location);
				if (location != null)
					newDestructor.AddChild (new CSharpTokenNode (Convert (location[0]), 1), DestructorDeclaration.TildeRole);
				newDestructor.AddChild (new Identifier (d.MemberName.Name, Convert (d.MemberName.Location)), AbstractNode.Roles.Identifier);
				
				if (location != null) {
					newDestructor.AddChild (new CSharpTokenNode (Convert (location[1]), 1), DestructorDeclaration.Roles.LPar);
					newDestructor.AddChild (new CSharpTokenNode (Convert (location[2]), 1), DestructorDeclaration.Roles.RPar);
				}
				
				if (d.Block != null)
					newDestructor.AddChild ((INode)d.Block.Accept (this), DestructorDeclaration.Roles.Body);
				
				typeStack.Peek ().AddChild (newDestructor, TypeDeclaration.Roles.Member);
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:19,代码来源:CSharpParser.cs

示例2: TrackedVisitDestructorDeclaration

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

示例3: VisitDestructorDeclaration

			public override void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration)
			{
				currentMethodName = "~" + destructorDeclaration.Name;
				base.VisitDestructorDeclaration(destructorDeclaration);
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:5,代码来源:CS0127ReturnMustNotBeFollowedByAnyExpression.cs

示例4: Visit

			public override void Visit(Destructor d)
			{
				var newDestructor = new DestructorDeclaration();
				AddAttributeSection(newDestructor, d);
				var location = LocationsBag.GetMemberLocation(d);
				AddModifiers(newDestructor, location);
				if (location != null && location.Count > 0)
					newDestructor.AddChild(new CSharpTokenNode(Convert(location [0]), DestructorDeclaration.TildeRole), DestructorDeclaration.TildeRole);
				newDestructor.AddChild(Identifier.Create(d.Identifier, Convert(d.MemberName.Location)), Roles.Identifier);
				
				if (location != null && location.Count > 1) {
					newDestructor.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.LPar), Roles.LPar);
					
					if (location.Count > 2)
						newDestructor.AddChild(new CSharpTokenNode(Convert(location [2]), Roles.RPar), Roles.RPar);
				}
				
				if (d.Block != null)
					newDestructor.AddChild((BlockStatement)d.Block.Accept(this), Roles.Body);
				
				typeStack.Peek().AddChild(newDestructor, Roles.TypeMemberRole);
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:22,代码来源:CSharpParser.cs

示例5: VisitDestructorDeclaration

		public override void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration)
		{
			FormatAttributedNode(destructorDeclaration);
			
			CSharpTokenNode lParen = destructorDeclaration.LParToken;
			int offset = this.document.GetOffset(lParen.StartLocation);
			ForceSpaceBefore(offset, policy.SpaceBeforeConstructorDeclarationParentheses);
			
			if (!destructorDeclaration.Body.IsNull) {
				EnforceBraceStyle(policy.DestructorBraceStyle, destructorDeclaration.Body.LBraceToken, destructorDeclaration.Body.RBraceToken);
				VisitBlockWithoutFixingBraces(destructorDeclaration.Body, policy.IndentMethodBody);
			}
			if (IsMember(destructorDeclaration.NextSibling)) {
				EnsureBlankLinesAfter(destructorDeclaration, policy.BlankLinesBetweenMembers);
			}
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:16,代码来源:AstFormattingVisitor.cs

示例6: VisitDestructorDeclaration

        public override void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration)
        {
            FixAttributesAndDocComment(destructorDeclaration);

            CSharpTokenNode lParen = destructorDeclaration.LParToken;
            ForceSpaceBefore(lParen, policy.SpaceBeforeConstructorDeclarationParentheses);

            if (!destructorDeclaration.Body.IsNull) {
                FixOpenBrace(policy.DestructorBraceStyle, destructorDeclaration.Body.LBraceToken);
                VisitBlockWithoutFixingBraces(destructorDeclaration.Body, policy.IndentMethodBody);
                FixClosingBrace(policy.DestructorBraceStyle, destructorDeclaration.Body.RBraceToken);
            }
        }
开发者ID:porcus,项目名称:NRefactory,代码行数:13,代码来源:FormattingVisitor_TypeMembers.cs

示例7: VisitDestructorDeclaration

        public void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration)
        {
            JsonObject declaration = CreateJsonEntityDeclaration(destructorDeclaration);
            AddKeyword(declaration, DestructorDeclaration.TildeRole);
            TypeDeclaration type = destructorDeclaration.Parent as TypeDeclaration;
            if (type != null && type.Name != destructorDeclaration.Name)
            {
                declaration.AddJsonValue("name", GetIdentifier((Identifier)type.NameToken.Clone()));
            }
            else
            {
                declaration.AddJsonValue("name", GetIdentifier(destructorDeclaration.NameToken));
            }
            declaration.AddJsonValue("body", GetMethodBody(destructorDeclaration.Body));

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

示例8: ConvertDestructor

		DestructorDeclaration ConvertDestructor(IMethod dtor)
		{
			DestructorDeclaration decl = new DestructorDeclaration();
			decl.Name = dtor.DeclaringTypeDefinition.Name;
			return decl;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:6,代码来源:TypeSystemAstBuilder.cs

示例9: VisitDestructorDeclaration

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

示例10: VisitMethodDeclaration

		public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
		{
			if (!IsClassType(ClassType.Interface) && (methodDeclaration.Modifier & Modifiers.Visibility) == 0)
				methodDeclaration.Modifier |= Modifiers.Public;
			
			if ("Finalize".Equals(methodDeclaration.Name, StringComparison.InvariantCultureIgnoreCase)
			    && methodDeclaration.Parameters.Count == 0
			    && methodDeclaration.Modifier == (Modifiers.Protected | Modifiers.Override)
			    && methodDeclaration.Body.Children.Count == 1)
			{
				TryCatchStatement tcs = methodDeclaration.Body.Children[0] as TryCatchStatement;
				if (tcs != null
				    && tcs.StatementBlock is BlockStatement
				    && tcs.CatchClauses.Count == 0
				    && tcs.FinallyBlock is BlockStatement
				    && tcs.FinallyBlock.Children.Count == 1)
				{
					ExpressionStatement se = tcs.FinallyBlock.Children[0] as ExpressionStatement;
					if (se != null) {
						InvocationExpression ie = se.Expression as InvocationExpression;
						if (ie != null
						    && ie.Arguments.Count == 0
						    && ie.TargetObject is MemberReferenceExpression
						    && (ie.TargetObject as MemberReferenceExpression).TargetObject is BaseReferenceExpression
						    && "Finalize".Equals((ie.TargetObject as MemberReferenceExpression).MemberName, StringComparison.InvariantCultureIgnoreCase))
						{
							DestructorDeclaration des = new DestructorDeclaration("Destructor", Modifiers.None, methodDeclaration.Attributes);
							ReplaceCurrentNode(des);
							des.Body = (BlockStatement)tcs.StatementBlock;
							return base.VisitDestructorDeclaration(des, data);
						}
					}
				}
			}
			
			if ((methodDeclaration.Modifier & (Modifiers.Static | Modifiers.Extern)) == Modifiers.Static
			    && methodDeclaration.Body.Children.Count == 0)
			{
				foreach (AttributeSection sec in methodDeclaration.Attributes) {
					foreach (Attribute att in sec.Attributes) {
						if ("DllImport".Equals(att.Name, StringComparison.InvariantCultureIgnoreCase)) {
							methodDeclaration.Modifier |= Modifiers.Extern;
							methodDeclaration.Body = null;
						}
					}
				}
			}
			
			if (methodDeclaration.TypeReference.Type != "System.Void" && methodDeclaration.Body.Children.Count > 0) {
				if (IsAssignmentTo(methodDeclaration.Body.Children[methodDeclaration.Body.Children.Count - 1], methodDeclaration.Name))
				{
					Expression returnValue = GetAssignmentFromStatement(methodDeclaration.Body.Children[methodDeclaration.Body.Children.Count - 1]).Right;
					methodDeclaration.Body.Children.RemoveAt(methodDeclaration.Body.Children.Count - 1);
					methodDeclaration.Body.Return(returnValue);
				} else {
					ReturnStatementForFunctionAssignment visitor = new ReturnStatementForFunctionAssignment(methodDeclaration.Name);
					methodDeclaration.Body.AcceptVisitor(visitor, null);
					if (visitor.replacementCount > 0) {
						Expression init;
						init = ExpressionBuilder.CreateDefaultValueForType(methodDeclaration.TypeReference);
						methodDeclaration.Body.Children.Insert(0, new LocalVariableDeclaration(new VariableDeclaration(FunctionReturnValueName, init, methodDeclaration.TypeReference)));
						methodDeclaration.Body.Children[0].Parent = methodDeclaration.Body;
						methodDeclaration.Body.Return(new IdentifierExpression(FunctionReturnValueName));
					}
				}
			}
			
			return base.VisitMethodDeclaration(methodDeclaration, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:69,代码来源:VBNetConstructsConvertVisitor.cs

示例11: VisitDestructorDeclaration

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

示例12: ClassMemberDecl

 private void ClassMemberDecl(Modifiers m, List<ICSharpCode.NRefactory.Parser.AST.AttributeSection> attributes)
 {
     ICSharpCode.NRefactory.Parser.AST.Statement stmt = null;
     if (this.StartOf(0x10))
     {
         this.StructMemberDecl(m, attributes);
     }
     else if (this.la.kind == 0x1b)
     {
         m.Check(Modifier.Destructors);
         Point location = this.t.Location;
         base.lexer.NextToken();
         base.Expect(1);
         DestructorDeclaration childNode = new DestructorDeclaration(this.t.val, m.Modifier, attributes);
         childNode.Modifier = m.Modifier;
         childNode.StartLocation = m.GetDeclarationLocation(location);
         base.Expect(20);
         base.Expect(0x15);
         childNode.EndLocation = this.t.EndLocation;
         if (this.la.kind == 0x10)
         {
             this.Block(out stmt);
         }
         else if (this.la.kind == 11)
         {
             base.lexer.NextToken();
         }
         else
         {
             base.SynErr(0x8a);
         }
         childNode.Body = (BlockStatement) stmt;
         base.compilationUnit.AddChild(childNode);
     }
     else
     {
         base.SynErr(0x8b);
     }
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:39,代码来源:Parser.cs

示例13: VisitDestructorDeclaration

		public virtual object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
			Debug.Assert((destructorDeclaration != null));
			Debug.Assert((destructorDeclaration.Attributes != null));
			Debug.Assert((destructorDeclaration.Body != null));
			for (int i = 0; i < destructorDeclaration.Attributes.Count; i++) {
				AttributeSection o = destructorDeclaration.Attributes[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (AttributeSection)nodeStack.Pop();
				if (o == null)
					destructorDeclaration.Attributes.RemoveAt(i--);
				else
					destructorDeclaration.Attributes[i] = o;
			}
			nodeStack.Push(destructorDeclaration.Body);
			destructorDeclaration.Body.AcceptVisitor(this, data);
			destructorDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
			return null;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:20,代码来源:AbstractAstTransformer.cs

示例14: ConvertDestructor

 DestructorDeclaration ConvertDestructor(IMethod dtor)
 {
     DestructorDeclaration decl = new DestructorDeclaration();
     if (dtor.DeclaringTypeDefinition != null)
         decl.Name = dtor.DeclaringTypeDefinition.Name;
     if (AddResolveResultAnnotations) {
         decl.AddAnnotation(new MemberResolveResult(null, dtor));
     }
     decl.Body = GenerateBodyBlock();
     return decl;
 }
开发者ID:yyp2003net,项目名称:NRefactory,代码行数:11,代码来源:TypeSystemAstBuilder.cs

示例15: Process_Destructor

        private void Process_Destructor(DestructorDeclaration node)
        {
            if (node == null) throw new ArgumentNullException("node");

            Destructor destructor = new Destructor(controller);
            destructor.Name = node.Name.Text;
            destructor.IsExtern = (node.Modifiers & Modifiers.Extern) != 0;

            ProcessBodyText(node, destructor, node.Statements, node.Comments);
            destructor.BodyText = formatter.ProcessBodyText(node.Statements, node.Comments, node.BlockStartOffset, node.BlockEndOffset - node.BlockStartOffset);

            SetupBaseConstruct(node, destructor);
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:13,代码来源:VBParser.cs


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