public override object Visit(NamespaceDeclaration namespaceDeclaration, object data)
        {
            CodeNamespace currentNamespace = new CodeNamespace(namespaceDeclaration.NameSpace);
            namespaces.Add(currentNamespace);
            // add imports from mother namespace
            foreach (CodeNamespaceImport import in ((CodeNamespace)namespaceDeclarations.Peek()).Imports) {
                currentNamespace.Imports.Add(import);
            }
            namespaceDeclarations.Push(currentNamespace);
            namespaceDeclaration.AcceptChildren(this, data);
            namespaceDeclarations.Pop();
            codeCompileUnit.Namespaces.Add(currentNamespace);

            // TODO : Nested namespaces allowed in CodeDOM ? Doesn't seem so :(
            return null;
        }
 public object Visit(NamespaceDeclaration namespaceDeclaration, object data)
 {
     DebugOutput(namespaceDeclaration);
     AppendIndentation();
     sourceText.Append("namespace ");
     sourceText.Append(namespaceDeclaration.NameSpace);
     AppendNewLine();
     sourceText.Append("{");
     AppendNewLine();
     ++indentLevel;
     namespaceDeclaration.AcceptChildren(this, data);
     --indentLevel;
     AppendIndentation();
     sourceText.Append("}");
     AppendNewLine();
     return null;
 }
示例#3
0
	void NamespaceMemberDecl() {

#line  526 "VBNET.ATG" 
		Modifiers m = new Modifiers(this);
		AttributeSection section;
		ArrayList attributes = new ArrayList();
		string qualident;
		
		if (la.kind == 127) {
			lexer.NextToken();

#line  533 "VBNET.ATG" 
			Point startPos = t.Location;
			
			Qualident(
#line  535 "VBNET.ATG" 
out qualident);

#line  537 "VBNET.ATG" 
			INode node =  new NamespaceDeclaration(qualident);
			node.StartLocation = startPos;
			compilationUnit.AddChild(node);
			compilationUnit.BlockStart(node);
			
			Expect(1);
			NamespaceBody();

#line  545 "VBNET.ATG" 
			node.EndLocation = t.Location;
			compilationUnit.BlockEnd();
			
		} else if (StartOf(2)) {
			while (la.kind == 28) {
				AttributeSection(
#line  549 "VBNET.ATG" 
out section);

#line  549 "VBNET.ATG" 
				attributes.Add(section); 
			}
			while (StartOf(3)) {
				TypeModifier(
#line  550 "VBNET.ATG" 
m);
			}
			NonModuleDeclaration(
#line  550 "VBNET.ATG" 
m, attributes);
		} else SynErr(192);
	}
 public virtual object Visit(NamespaceDeclaration namespaceDeclaration, object data)
 {
     return namespaceDeclaration.AcceptChildren(this, data);
 }