public virtual object Visit(CompilationUnit compilationUnit, object data)
 {
     if (compilationUnit == null) {
         return data;
     }
     return compilationUnit.AcceptChildren(this, data);
 }
 public void Refactor(CompilationUnit compilationUnit)
 {
     namespaces = new Hashtable();
     for (int i = 0; i < compilationUnit.Children.Count; ++i) {
         object o = compilationUnit.Children[i];
         if (o is UsingDeclaration ) {
             namespaces[((UsingDeclaration )o).Namespace] = "";
         } else if (o is NamespaceDeclaration) {
             Refactor(compilationUnit, (NamespaceDeclaration)o);
         }
     }
 }
 void Refactor(CompilationUnit compilationUnit, NamespaceDeclaration nsd)
 {
     for (int i = 0; i < nsd.Children.Count; ++i) {
         object o = nsd.Children[i];
         if (o is UsingDeclaration) {
             UsingDeclaration  ud = (UsingDeclaration) o;
             if (namespaces[ud.Namespace] == null) {
                 namespaces[ud.Namespace] = "";
                 compilationUnit.Children.Insert(0, ud);
             }
             nsd.Children.RemoveAt(i);
             i = -1;
         } else if (o is UsingAliasDeclaration) {
             compilationUnit.Children.Insert(0, o);
             nsd.Children.RemoveAt(i);
             i = -1;
         }
     }
 }
 public override object Visit(CompilationUnit compilationUnit, object data)
 {
     CodeNamespace globalNamespace = new CodeNamespace("Global");
     namespaces.Add(globalNamespace);
     namespaceDeclarations.Push(globalNamespace);
     compilationUnit.AcceptChildren(this, data);
     codeCompileUnit.Namespaces.Add(globalNamespace);
     return globalNamespace;
 }
 public override object Visit(CompilationUnit compilationUnit, object data)
 {
     DebugOutput(compilationUnit);
     new VBNetRefactory().Refactor(compilationUnit);
     compilationUnit.AcceptChildren(this, data);
     return null;
 }
 public override object Visit(CompilationUnit compilationUnit, object data)
 {
     Console.WriteLine(compilationUnit.ToString());
     return compilationUnit.AcceptChildren(this, data);
 }
示例#7
0
	void CS() {

#line  527 "cs.ATG" 
		compilationUnit = new CompilationUnit(); 
		while (la.kind == 70) {
			ExternAlias();
		}
		while (la.kind == 120) {
			UsingDirective();
		}
		while (
#line  531 "cs.ATG" 
IsGlobalAttrTarget()) {
			GlobalAttributeSection();
		}
		while (StartOf(1)) {
			NamespaceMemberDecl();
		}
		Expect(0);
	}
 public override object Visit(CompilationUnit compilationUnit, object data)
 {
     compilationUnit.AcceptChildren(this, data);
     outputFormatter.EndFile();
     return null;
 }