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


C# TypeDeclaration.AcceptChildren方法代码示例

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


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

示例1: VisitTypeDeclaration

 public override object VisitTypeDeclaration (TypeDeclaration node, object data)
 {
     if (CurrentType != null) {
         Console.WriteLine ("Nested types are not supported");
         //throw CreateException (node, "Nested types are not supported");
     }
     if (IsHiddenClass (node))
         return null;
     
     if ((node.Modifier & Modifiers.Partial) > 0) {
         Console.WriteLine ("Partial classes are not supported: " + node);
         //throw CreateException (node, "Partial classes are not supported");
     }
     CurrentType = new JsTypeInfo { Name = GenericsHelper.GetScriptName (node), ClassType = node.Type, Namespace = Namespace, Usings = new HashSet<string> (Usings) };
     
     Usings = new HashSet<string> ();
     
     CurrentType.IsStatic = node.Type == ClassType.Enum || HasModifier (node.Modifier, Modifiers.Static);
     
     if (node.Type != ClassType.Interface)
         node.AcceptChildren (this, null);
     
     if (CachedCctor != null) {
         if (!ProcessCctor ())
             throw CreateException (node, "Static constructor may only contain primitive or array static field initializations");
         CachedCctor = null;
     }
     
     CollectedTypes.Add (CurrentType);
     CurrentType = null;
     
     return null;
 }
开发者ID:hallvar,项目名称:Joddes.CS,代码行数:33,代码来源:JsSourceInspector.cs

示例2: VisitTypeDeclaration

        public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
        {
            Contract.Requires(typeDeclaration != null);

            // Is this a class?
            if (IsClass(typeDeclaration))
            {
                // Process for multiple partial of class in the same file
                if (!IsExist(DictClass, typeDeclaration.Name))
                {
                    var objClass = new ClassStructure
                    {
                        Name = typeDeclaration.Name,
                        Methods = new List<MethodStructure>()
                    };
                    DictClass.Add(objClass.Name, objClass);
                }
            }

            // Visit children (E.g. MethodDeclarion objects)
            typeDeclaration.AcceptChildren(this, data);

            return null;
        }
开发者ID:hikaruyh88,项目名称:ProjectAnalyzeV3.0,代码行数:24,代码来源:CounterVisitor.cs

示例3: TrackedVisitTypeDeclaration

 public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
 {
     this.codeBuilder.AppendLineIfPreviousLineIsCode();
     this.AppendIndented(string.Concat("class ", typeDeclaration.Name));
     this.AppendBaseTypes(typeDeclaration.BaseTypes);
     this.AppendLine();
     this.IncreaseIndent();
     this.AppendDocstring(this.xmlDocComments);
     if (typeDeclaration.Children.Count <= 0)
     {
         this.AppendIndentedPassStatement();
     }
     else
     {
         this.constructorInfo = PythonConstructorInfo.GetConstructorInfo(typeDeclaration);
         if (this.constructorInfo != null)
         {
             if (this.constructorInfo.Constructor == null)
             {
                 this.CreateConstructor(this.constructorInfo);
             }
         }
         typeDeclaration.AcceptChildren(this, data);
     }
     this.DecreaseIndent();
     return null;
 }
开发者ID:L3tum,项目名称:BesiegeScriptingMod,代码行数:27,代码来源:NRefactoryToPythonConverter.cs

示例4: VisitTypeDeclaration

        public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
        {
            TypeDeclaration oldTypeDeclaration = currentTypeDeclaration;
            this.currentTypeDeclaration = typeDeclaration;
            CodeTypeDeclaration codeTypeDeclaration = new CodeTypeDeclaration(typeDeclaration.Name);
            codeTypeDeclaration.TypeAttributes = ConvTypeAttributes(typeDeclaration.Modifier);
            codeTypeDeclaration.IsClass     = typeDeclaration.Type == ClassType.Class;
            codeTypeDeclaration.IsEnum      = typeDeclaration.Type == ClassType.Enum;
            codeTypeDeclaration.IsInterface = typeDeclaration.Type == ClassType.Interface;
            codeTypeDeclaration.IsStruct    = typeDeclaration.Type == ClassType.Struct;
            codeTypeDeclaration.IsPartial = (typeDeclaration.Modifier & Modifiers.Partial) != 0;

            if (typeDeclaration.BaseTypes != null) {
                foreach (TypeReference typeRef in typeDeclaration.BaseTypes) {
                    codeTypeDeclaration.BaseTypes.Add(ConvType(typeRef));
                }
            }

            typeDeclarations.Push(codeTypeDeclaration);
            typeDeclaration.AcceptChildren(this, data);
            typeDeclarations.Pop();

            if (typeDeclarations.Count > 0) {
                typeDeclarations.Peek().Members.Add(codeTypeDeclaration);
            } else {
                namespaceDeclarations.Peek().Types.Add(codeTypeDeclaration);
            }
            currentTypeDeclaration = oldTypeDeclaration;

            return null;
        }
开发者ID:almazik,项目名称:ILSpy,代码行数:31,代码来源:CodeDOMOutputVisitor.cs

示例5: TrackedVisitTypeDeclaration

		/// <summary>
		/// Visits a class.
		/// </summary>
		public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
		{
			codeBuilder.AppendLineIfPreviousLineIsCode();
			AppendIndented("class " + typeDeclaration.Name);
			AppendBaseTypes(typeDeclaration.BaseTypes);
			AppendLine();
			IncreaseIndent();
			AppendDocstring(xmlDocComments);
			if (typeDeclaration.Children.Count > 0) {
				// Look for fields or a constructor for the type.
				constructorInfo = PythonConstructorInfo.GetConstructorInfo(typeDeclaration);
				if (constructorInfo != null) {
					if (constructorInfo.Constructor != null) {
						// Generate constructor later when VisitConstructorDeclaration method is called.
						// This allows the constructor comments to be converted in the right place.
					} else {
						CreateConstructor(constructorInfo);
					}
				}
				
				// Visit the rest of the class.
				typeDeclaration.AcceptChildren(this, data);
			} else {
				AppendIndentedPassStatement();
			}
			DecreaseIndent();

			return null;
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:32,代码来源:NRefactoryToPythonConverter.cs

示例6: VisitTypeDeclaration

		public object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
		{
			if (typeDeclaration.Templates.Count > 0) {
				AddError(typeDeclaration, "Generic type definitions are not supported.");
			}
			B.TypeDefinition oldType = currentType;
			B.TypeDefinition typeDef;
			switch (typeDeclaration.Type) {
				case ClassType.Class:
					typeDef = new B.ClassDefinition(GetLexicalInfo(typeDeclaration));
					break;
				case ClassType.Interface:
					typeDef = new B.InterfaceDefinition(GetLexicalInfo(typeDeclaration));
					break;
				case ClassType.Enum:
					typeDef = new B.EnumDefinition(GetLexicalInfo(typeDeclaration));
					break;
				case ClassType.Struct:
					typeDef = new B.StructDefinition(GetLexicalInfo(typeDeclaration));
					break;
				case ClassType.Module:
					typeDef = new B.ClassDefinition(GetLexicalInfo(typeDeclaration));
					typeDeclaration.Modifier |= Modifiers.Static;
					break;
				default:
					AddError(typeDeclaration, "Unknown class type.");
					return null;
			}
			if (currentType != null)
				typeDef.Modifiers = ConvertModifier(typeDeclaration, B.TypeMemberModifiers.Private);
			else
				typeDef.Modifiers = ConvertModifier(typeDeclaration, B.TypeMemberModifiers.Internal);
			typeDef.Name = typeDeclaration.Name;
			typeDef.EndSourceLocation = GetLocation(typeDeclaration.EndLocation);
			ConvertAttributes(typeDeclaration.Attributes, typeDef.Attributes);
			ConvertTypeReferences(typeDeclaration.BaseTypes, typeDef.BaseTypes);
			
			if (currentType != null)
				currentType.Members.Add(typeDef);
			else
				module.Members.Add(typeDef);
			currentType = typeDef;
			typeDeclaration.AcceptChildren(this, data);
			currentType = oldType;
			return typeDef;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:46,代码来源:ConvertVisitorGlobal.cs

示例7: VisitTypeDeclaration

 public virtual object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
 {
     Debug.Assert((typeDeclaration != null));
     Debug.Assert((typeDeclaration.Attributes != null));
     Debug.Assert((typeDeclaration.BaseTypes != null));
     Debug.Assert((typeDeclaration.Templates != null));
     foreach (AttributeSection o in typeDeclaration.Attributes) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     foreach (TypeReference o in typeDeclaration.BaseTypes) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     foreach (TemplateDefinition o in typeDeclaration.Templates) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     return typeDeclaration.AcceptChildren(this, data);
 }
开发者ID:pusp,项目名称:o2platform,代码行数:20,代码来源:AbstractASTVisitor.cs

示例8: VisitTypeDeclaration

 public virtual bool VisitTypeDeclaration(TypeDeclaration typeDeclaration, object d)
 {
     if ((typeDeclaration == null)) {
         return SetFailure();
     }
     if ((d == null)) {
         return SetFailure();
     }
     if ((typeDeclaration.Attributes == null)) {
         return SetFailure();
     }
     if ((typeDeclaration.BaseTypes == null)) {
         return SetFailure();
     }
     if ((typeDeclaration.Templates == null)) {
         return SetFailure();
     }
     if(typeDeclaration.GetType() != d.GetType()) {return SetFailure();}
     var data = (TypeDeclaration)d;
     if (!IsMatch(typeDeclaration, data)) {
         return SetFailure();
     }
     if (typeDeclaration.Attributes.Count == data.Attributes.Count) {
     for (int i=0; i<typeDeclaration.Attributes.Count;i++) {
         AttributeSection o = typeDeclaration.Attributes[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Attributes[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     if (typeDeclaration.BaseTypes.Count == data.BaseTypes.Count) {
     for (int i=0; i<typeDeclaration.BaseTypes.Count;i++) {
         TypeReference o = typeDeclaration.BaseTypes[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.BaseTypes[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     if (typeDeclaration.Templates.Count == data.Templates.Count) {
     for (int i=0; i<typeDeclaration.Templates.Count;i++) {
         TemplateDefinition o = typeDeclaration.Templates[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Templates[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     return typeDeclaration.AcceptChildren(this, d);
 }
开发者ID:jbuedel,项目名称:AgentRalphPlugin,代码行数:42,代码来源:AstComparisonVisitor.Generated.cs

示例9: VisitTypeDeclaration

        public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
        {
            Contract.Requires(typeDeclaration != null);

            // Is this a class but not a test fixture?
            if (IsClass(typeDeclaration) && !HasTestFixtureAttribute(typeDeclaration))
            {
                var parent = new JsClass()
                {
                    Name = typeDeclaration.Name,
                    Properties = new List<JsProperty>()
                };

                if (typeDeclaration.Attributes.Count > 0)
                {
                    foreach (var attribute in typeDeclaration.Attributes)
                    {
                        var jsAttributes = new List<JsAttribute>();
                        var a = attribute.Attributes[0];

                        jsAttributes.Add(new JsAttribute()
                        {
                            Name = a.Name
                        });

                        parent.Attributes = jsAttributes;
                    }
                }

                if (Model == null) Model = new JsFile();

                if (Model.Files == null) Model.Files = new List<JsClass>();

                Model.Files.Add(parent);

                CurrentParent = parent;
            }

            // Visit children (E.g. MethodDeclarion objects)
            typeDeclaration.AcceptChildren(this, data);

            return null;
        }
开发者ID:chinaniit,项目名称:KnockoutGenerator,代码行数:43,代码来源:AstVisitor.cs


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