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


C# TypeDeclaration类代码示例

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


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

示例1: VisitTypeDeclaration

			public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
			{
				bool oldIsSealedType = isSealedType;
				isSealedType = typeDeclaration.Modifiers.HasFlag(Modifiers.Sealed);
				base.VisitTypeDeclaration(typeDeclaration);
				isSealedType = oldIsSealedType;
			}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:7,代码来源:CallToVirtualFunctionFromConstructorIssue.cs

示例2: VisitTypeDeclaration

        public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
        {
            if (!typeDeclaration.HasModifier(Modifiers.Public))
            {
                base.VisitTypeDeclaration(typeDeclaration);
                return;
            }

            this.m_TotalClasses++;
            if (this.m_TotalClasses > 1)
            {
                this.Results.Issues.Add(new LintIssue(typeDeclaration)
                {
                    Index = LintIssueIndex.MoreThanOneClassInFile,
                    Parameters = new[]
                    {
                        typeDeclaration.Name,
                        this.m_FirstClassName
                    }
                });
            }
            else
            {
                this.m_FirstClassName = typeDeclaration.Name;
            }

            base.VisitTypeDeclaration(typeDeclaration);
        }
开发者ID:ow-pastuch,项目名称:cstools,代码行数:28,代码来源:EnsureOnePublicClassPerFilePolicy.cs

示例3: GetAllPMixinAttributes

 public static IEnumerable<pMixinAttributeResolvedResult> GetAllPMixinAttributes(
     this ICreateCodeGenerationPlanPipelineState manager,
     TypeDeclaration target)
 {
     return manager.ResolveAttributesPipeline.PartialClassLevelResolvedPMixinAttributes[target]
         .OfType<pMixinAttributeResolvedResult>();
 }
开发者ID:prescottadam,项目名称:pMixins,代码行数:7,代码来源:ICreateCodeGenerationPlanPipelineState.cs

示例4: VisitTypeDeclaration

		public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
		{
			Push();
			object result = base.VisitTypeDeclaration(typeDeclaration, data);
			Pop();
			return result;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:PrefixFieldsVisitor.cs

示例5: CheckName

			void CheckName(TypeDeclaration node, AffectedEntity entity, Identifier identifier, Modifiers accessibilty)
			{
				TypeResolveResult resolveResult = ctx.Resolve(node) as TypeResolveResult;
				if (resolveResult == null)
					return;
				var type = resolveResult.Type;
				if (type.DirectBaseTypes.Any(t => t.FullName == "System.Attribute")) {
					if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.CustomAttributes, identifier, accessibilty)) {
						return;
					}
				} else if (type.DirectBaseTypes.Any(t => t.FullName == "System.EventArgs")) {
					if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.CustomEventArgs, identifier, accessibilty)) {
						return;
					}
				} else if (type.DirectBaseTypes.Any(t => t.FullName == "System.Exception")) {
					if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.CustomExceptions, identifier, accessibilty)) {
						return;
					}
				}

				var typeDef = type.GetDefinition();
				if (typeDef != null && typeDef.Attributes.Any(attr => attr.AttributeType.FullName == "NUnit.Framework.TestFixtureAttribute")) {
					if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.TestType, identifier, accessibilty)) {
						return;
					}
				}

				CheckNamedResolveResult(resolveResult, node, entity, identifier, accessibilty);
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:29,代码来源:InconsistentNamingIssue.cs

示例6: VisitTypeDeclaration

            public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
            {
                if(typeDeclaration.ClassType == ClassType.Class && typeDeclaration.Name != "Program")
                    UnlockWith(typeDeclaration);

                return base.VisitTypeDeclaration(typeDeclaration, data);
            }
开发者ID:vlad2135,项目名称:strokes,代码行数:7,代码来源:CreateClass.cs

示例7: AddSerializibility

		/// <summary>
		/// Makes sure that the PHP-visible type is serializable.
		/// </summary>
		private void AddSerializibility(TypeDeclaration type, TypeDeclaration outType)
		{
			// make the type serializable
			if (!Utility.IsDecoratedByAttribute(type, "System.SerializableAttribute"))
			{
				AttributeSection section = new AttributeSection();
				section.Attributes.Add(new ICSharpCode.NRefactory.Parser.AST.Attribute("Serializable", null, null));
				outType.Attributes.Add(section);

				ConstructorDeclaration ctor = new ConstructorDeclaration(type.Name, 
					((type.Modifier & Modifier.Sealed) == Modifier.Sealed ? Modifier.Private : Modifier.Protected),
					new List<ParameterDeclarationExpression>(), null);

				ctor.Parameters.Add(
					new ParameterDeclarationExpression(new TypeReference("System.Runtime.Serialization.SerializationInfo"), "info"));
				ctor.Parameters.Add(
					new ParameterDeclarationExpression(new TypeReference("System.Runtime.Serialization.StreamingContext"), "context"));

				ctor.ConstructorInitializer = new ConstructorInitializer();
				ctor.ConstructorInitializer.ConstructorInitializerType = ConstructorInitializerType.Base;
					
				ctor.ConstructorInitializer.Arguments.Add(new IdentifierExpression("info"));
				ctor.ConstructorInitializer.Arguments.Add(new IdentifierExpression("context"));

				ctor.Body = new BlockStatement();

				outType.AddChild(ctor);
			}
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:32,代码来源:Dynamizer.cs

示例8: VisitTypeDeclaration

            public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
            {
                if(typeDeclaration.ClassType == ClassType.Interface)
                    UnlockWith(typeDeclaration);

                return base.VisitTypeDeclaration(typeDeclaration, data);
            }
开发者ID:clausjoergensen,项目名称:strokes,代码行数:7,代码来源:CreateInterface.cs

示例9: VisitTypeDeclaration

            public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
            {
                if (typeDeclaration.ClassType == ClassType.Class && typeDeclaration.Modifiers.HasFlag(Modifiers.Abstract))
                    UnlockWith(typeDeclaration);

                return base.VisitTypeDeclaration(typeDeclaration, data);
            }
开发者ID:vlad2135,项目名称:strokes,代码行数:7,代码来源:AbstractClass.cs

示例10: VisitTypeDeclaration

        public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
        {
            if (!typeDeclaration.HasModifier(Modifiers.Public))
            {
                base.VisitTypeDeclaration(typeDeclaration);
                return;
            }

            var idx = this.Results.BaseName.LastIndexOf('.');
            var filename = this.Results.BaseName;
            if (idx != -1)
                filename = filename.Substring(0, idx);
            if (typeDeclaration.Name != filename)
            {
                this.Results.Issues.Add(new LintIssue(typeDeclaration)
                {
                    Index = LintIssueIndex.ClassNameDoesNotMatchFileName,
                    Parameters = new[]
                    {
                        typeDeclaration.Name,
                        filename
                    }
                });
            }

            base.VisitTypeDeclaration(typeDeclaration);
        }
开发者ID:ow-pastuch,项目名称:cstools,代码行数:27,代码来源:EnsureClassNameMatchesFileNamePolicy.cs

示例11: TypeDeclaration

 public TypeDeclaration(Position pos, Symbol name, Type type, TypeDeclaration next)
 {
     Pos = pos;
     Name = name;
     Type = type;
     Next = next;
 }
开发者ID:Nxun,项目名称:Naive-Tiger,代码行数:7,代码来源:AbstractSyntax.Declaration.cs

示例12: VisitTypeDeclaration

 public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
 {
     if (typeDeclaration.TypeKeyword.ToString() == "enum")
     {
         _currentEnumMembers = new List<NameNode>();
         EnumMembers.Add(typeDeclaration, _currentEnumMembers);
     }
     base.VisitTypeDeclaration(typeDeclaration);
 }
开发者ID:KvanTTT,项目名称:CSharp-Minifier,代码行数:9,代码来源:MinifyEnumsAstVisitor.cs

示例13: CreateTypeSignature

 public static string CreateTypeSignature(TypeDeclaration type)
 {
     var @namespace = type.GetParent<NamespaceDeclaration>();
     var builder = new StringBuilder();
     builder.Append(@namespace.FullName.ToJavaNamespace());
     builder.Append("/");
     builder.Append(type.Name);
     return builder.ToString();
 }
开发者ID:hach-que,项目名称:cscjvm,代码行数:9,代码来源:JavaSignature.cs

示例14: VisitTypeDeclaration

			public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
			{
				var oldGenericStatus = isInGenericType;

				isInGenericType = typeDeclaration.TypeParameters.Count > 0;

				base.VisitTypeDeclaration(typeDeclaration);
				isInGenericType = oldGenericStatus;
			}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:9,代码来源:StaticFieldInGenericTypeIssue.cs

示例15: AddImplementation

        static void AddImplementation(RefactoringContext context, TypeDeclaration result, ICSharpCode.NRefactory.TypeSystem.IType guessedType)
        {
            foreach (var property in guessedType.GetProperties ()) {
                if (!property.IsAbstract)
                    continue;
                if (property.IsIndexer) {
                    var indexerDecl = new IndexerDeclaration() {
                        ReturnType = context.CreateShortType(property.ReturnType),
                        Modifiers = GetModifiers(property),
                        Name = property.Name
                    };
                    indexerDecl.Parameters.AddRange(ConvertParameters(context, property.Parameters));
                    if (property.CanGet)
                        indexerDecl.Getter = new Accessor();
                    if (property.CanSet)
                        indexerDecl.Setter = new Accessor();
                    result.AddChild(indexerDecl, Roles.TypeMemberRole);
                    continue;
                }
                var propDecl = new PropertyDeclaration() {
                    ReturnType = context.CreateShortType(property.ReturnType),
                    Modifiers = GetModifiers (property),
                    Name = property.Name
                };
                if (property.CanGet)
                    propDecl.Getter = new Accessor();
                if (property.CanSet)
                    propDecl.Setter = new Accessor();
                result.AddChild(propDecl, Roles.TypeMemberRole);
            }

            foreach (var method in guessedType.GetMethods ()) {
                if (!method.IsAbstract)
                    continue;
                var decl = new MethodDeclaration() {
                    ReturnType = context.CreateShortType(method.ReturnType),
                    Modifiers = GetModifiers (method),
                    Name = method.Name,
                    Body = new BlockStatement() {
                        new ThrowStatement(new ObjectCreateExpression(context.CreateShortType("System", "NotImplementedException")))
                    }
                };
                decl.Parameters.AddRange(ConvertParameters(context, method.Parameters));
                result.AddChild(decl, Roles.TypeMemberRole);
            }

            foreach (var evt in guessedType.GetEvents ()) {
                if (!evt.IsAbstract)
                    continue;
                var decl = new EventDeclaration() {
                    ReturnType = context.CreateShortType(evt.ReturnType),
                    Modifiers = GetModifiers (evt),
                    Name = evt.Name
                };
                result.AddChild(decl, Roles.TypeMemberRole);
            }
        }
开发者ID:Xiaoqing,项目名称:NRefactory,代码行数:57,代码来源:CreateClassDeclarationAction.cs


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