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


C# Ast.NamespaceDeclaration类代码示例

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


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

示例1: VisitNamespaceDeclaration

 public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
 {
     currentNamepace = namespaceDeclaration.Name;
     base.VisitNamespaceDeclaration(namespaceDeclaration, data);
     currentNamepace = string.Empty;
     return null;
 }
开发者ID:almazik,项目名称:ILSpy,代码行数:7,代码来源:SimplifyTypeReferences.cs

示例2: CreateNamespace

 NamespaceDeclaration CreateNamespace(DependencyRelation relation, NamespaceDeclaration originalNamespace)
 {
     var ns = new NamespaceDeclaration(originalNamespace.Name);
     ns.Children.AddRange(originalNamespace.Children.OfType<UsingDeclaration>());
     ns.Children.Add(CreatePartialClass(relation));
     return ns;
 }
开发者ID:modulexcite,项目名称:magic-1,代码行数:7,代码来源:DependencyConstructorGenerator.cs

示例3: CreateNamespace

 NamespaceDeclaration CreateNamespace(ValueObjectDescriptor valueObject, NamespaceDeclaration originalNamespace)
 {
     var ns = new NamespaceDeclaration(originalNamespace.Name);
     ns.Children.AddRange(originalNamespace.Children.OfType<UsingDeclaration>());
     ns.Children.Add(CreatePartialClass(valueObject));
     return ns;
 }
开发者ID:modulexcite,项目名称:magic-1,代码行数:7,代码来源:ValueObjectGenerator.cs

示例4: VisitCompilationUnit

		public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
		{
			base.VisitCompilationUnit(compilationUnit, data);
			if (!string.IsNullOrEmpty(NamespacePrefixToAdd)) {
				for (int i = 0; i < compilationUnit.Children.Count; i++) {
					NamespaceDeclaration ns = compilationUnit.Children[i] as NamespaceDeclaration;
					if (ns != null) {
						ns.Name = NamespacePrefixToAdd + "." + ns.Name;
					}
					if (compilationUnit.Children[i] is TypeDeclaration || compilationUnit.Children[i] is DelegateDeclaration) {
						ns = new NamespaceDeclaration(NamespacePrefixToAdd);
						ns.AddChild(compilationUnit.Children[i]);
						compilationUnit.Children[i] = ns;
					}
				}
			}
			
			ToCSharpConvertVisitor v = new ToCSharpConvertVisitor();
			compilationUnit.AcceptVisitor(v, data);
			if (projectContent != null && projectContent.DefaultImports != null) {
				int index = 0;
				foreach (string u in projectContent.DefaultImports.Usings) {
					compilationUnit.Children.Insert(index++, new UsingDeclaration(u));
				}
			}
			return null;
		}
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Projects,代码行数:27,代码来源:VBNetToCSharpConvertVisitor.cs

示例5: VisitNamespaceDeclaration

 public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
 {
     CSharpLanguage.VisitorData data2 = (CSharpLanguage.VisitorData) data;
     data2.CurrentNamespaces.Push(namespaceDeclaration.Name);
     namespaceDeclaration.AcceptChildren(this, data2);
     data2.CurrentNamespaces.Pop();
     return null;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:8,代码来源:CSharpLanguage.cs

示例6: VisitNamespaceDeclaration

 public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
 {
   CSharpLanguage.VisitorData visitorData = (CSharpLanguage.VisitorData) data;
   visitorData.CurrentNamespaces.Push(namespaceDeclaration.get_Name());
   ((AbstractNode) namespaceDeclaration).AcceptChildren((IAstVisitor) this, (object) visitorData);
   visitorData.CurrentNamespaces.Pop();
   return (object) null;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:8,代码来源:CSharpLanguage.cs

示例7: add_Namespace

 public static NamespaceDeclaration add_Namespace(this CompilationUnit compilationUnit, string @namespace)
 {
     var newNamespace = compilationUnit.namespaces(@namespace);		// check if already exists and if it does return it
     if (newNamespace != null)
         return newNamespace;
     newNamespace = new NamespaceDeclaration(@namespace);
     compilationUnit.Children.Add(newNamespace);
     return newNamespace;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:9,代码来源:NamespaceDeclaration_ExtensionMethods.cs

示例8: TrackedVisitNamespaceDeclaration

        public override object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
        {
            NamespaceDeclaration replacedNamespace = namespaceDeclaration;
            UsingDeclaration usingDeclaration = new UsingDeclaration("java.lang.*");
            replacedNamespace.Children.Insert(0, usingDeclaration);

            ReplaceCurrentNode(replacedNamespace);

            return base.TrackedVisitNamespaceDeclaration(namespaceDeclaration, data);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:10,代码来源:DefaultImportTransformer.cs

示例9: Setup

		public void Setup()
		{
			mocks = new MockRepository();
			typeResolver = mocks.DynamicMock<ITypeResolver>();
			visitor = new TypeInspectionVisitor(typeResolver);

			type = new TypeDeclaration(Modifiers.Public, new List<AttributeSection>()) {Name = "SomeType"};
			@namespace = new NamespaceDeclaration("SomeNamespace");
			@namespace.AddChild(type);
			type.Parent = @namespace;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:11,代码来源:TypeInspectionVisitorTests.cs

示例10: VisitingNamespace_MustAddParentNamespacesToTypeResolver

		public void VisitingNamespace_MustAddParentNamespacesToTypeResolver()
		{
			var typeTables = new List<TypeTableEntry>();
			var usings = new List<String>();
			var aliases = new Dictionary<string, string>();
			var resolver = new TypeResolver(typeTables, usings, aliases);
			var nsDecl = new NamespaceDeclaration("System.Collections.Specialized");
			var visitor = new TypeResolvingVisitor(resolver);

			visitor.VisitNamespaceDeclaration(nsDecl, null);

			Assert.AreEqual(3, usings.Count);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:13,代码来源:TypeResolvingVisitorTests.cs

示例11: TrackedVisitNamespaceDeclaration

        public override object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
        {
            Removeables.Clear();
            UsedTypes.Clear();

            NamespaceDeclaration replaced = namespaceDeclaration;
            IList types = AstUtil.GetChildrenWithType(replaced, typeof(TypeDeclaration));
            foreach (TypeDeclaration typeDeclaration in types)
            {
                VisitTypeDeclaration(typeDeclaration, data);
            }
            ReplaceCurrentNode(replaced);
            return base.TrackedVisitNamespaceDeclaration(namespaceDeclaration, data);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:14,代码来源:UsageRemoverTransformer.cs

示例12: CreateTypeDeclarations

        private void CreateTypeDeclarations(string jarFile)
        {
            LoadClasses(Path.GetFullPath(jarFile));

            foreach (string package in classes.Keys)
            {
                if (!IsIncluded(package))
                    continue;
                Console.WriteLine(package);
                IDictionary types = new Hashtable();
                IList packageClasses = (IList) classes[package];
                foreach (ClassFile cf in packageClasses)
                {
                    if (cf.IsPublic)
                    {
                        TypeDeclaration type = GetTypeDeclaration(cf);
                        types.Add(type.Name, type);
                    }
                }

                foreach (TypeDeclaration type in types.Values)
                {
                    if (type.Name.IndexOf("$") == -1)
                    {
                        NamespaceDeclaration nameSpace = new NamespaceDeclaration(package);
                        type.Parent = nameSpace;
                        nameSpace.AddChild(type);

                        CompilationUnit cu = new CompilationUnit();
                        cu.Children.Add(nameSpace);
                        compilationUnits.Add(cu);
                    }
                    else
                    {
                        string parentName = type.Name.Substring(0, type.Name.IndexOf("$"));
                        TypeDeclaration parent = (TypeDeclaration) types[GetTypeName(parentName)];
                        if (parent != null)
                        {
                            type.Name = GetTypeName(type.Name);
                            parent.AddChild(type);
                        }
                    }
                }
            }
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:45,代码来源:JavaArchiveToCodeSkeleton.cs

示例13: TrackedVisitNamespaceDeclaration

 public override object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
 {
     similarTypes = new Hashtable();
     IList usings = AstUtil.GetChildrenWithType(namespaceDeclaration, typeof(UsingDeclaration));
     foreach (UsingDeclaration usingDeclaration in usings)
     {
         Using usi = (Using) usingDeclaration.Usings[0];
         string fullName = GetFullyQualifiedName(usi);
         string type = GetShortReferenceTypeName(usi);
         string projectType = namespaceDeclaration.Name + "." + type;
         if (CodeBase.Types.Contains(projectType))
             similarTypes.Add(type, fullName);
     }
     if (similarTypes.Count < 1)
         return null;
     else
         return base.TrackedVisitNamespaceDeclaration(namespaceDeclaration, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:18,代码来源:SameProjectAndExternalTypeNameTransformer.cs

示例14: VisitNamespaceDeclaration

 public override object VisitNamespaceDeclaration (NamespaceDeclaration node, object data)
 {
     if (!String.IsNullOrEmpty (Namespace))
         throw CreateException (node, "Nested namespaces are not supported");
     
     string prevNamespace = Namespace;
     //var prevUsings = Usings;
     
     Namespace = node.Name;
     //Usings = new HashSet<string> ();
     
     node.AcceptChildren (this, null);
     
     Namespace = prevNamespace;
     //Usings = prevUsings;
     
     return null;
 }
开发者ID:hallvar,项目名称:Joddes.CS,代码行数:18,代码来源:JsSourceInspector.cs

示例15: VisitNamespaceDeclaration

		public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
		{
			if (RootNamespaceToRemove != null) {
				if (namespaceDeclaration.Name == RootNamespaceToRemove) {
					// remove namespace declaration
					INode insertAfter = namespaceDeclaration;
					foreach (INode child in namespaceDeclaration.Children) {
						InsertAfterSibling(insertAfter, child);
						insertAfter = child;
					}
					namespaceDeclaration.Children.Clear();
					RemoveCurrentNode();
				} else if (namespaceDeclaration.Name.StartsWith(RootNamespaceToRemove + ".")) {
					namespaceDeclaration.Name = namespaceDeclaration.Name.Substring(RootNamespaceToRemove.Length + 1);
				}
			}
			base.VisitNamespaceDeclaration(namespaceDeclaration, data);
			return null;
		}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:19,代码来源:CSharpToVBNetConvertVisitor.cs


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