1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.Rook
.Compiler
.AST
19 using Castle
.Rook
.Compiler
.Visitors
;
22 public class SourceUnit
: ASTNode
24 private readonly CompilationUnit compilationUnit
;
25 private readonly string filename
;
27 private ASTNodeCollection statements
;
28 private ASTNodeCollection namespaces
;
30 public SourceUnit(CompilationUnit compilationUnit
, String filename
)
32 statements
= new ASTNodeCollection(this);
33 namespaces
= new ASTNodeCollection(this);
34 this.compilationUnit
= compilationUnit
;
35 this.filename
= filename
;
38 public CompilationUnit CompilationUnit
40 get { return compilationUnit; }
43 public ASTNodeCollection Statements
45 get { return statements; }
48 public ASTNodeCollection Namespaces
50 get { return namespaces; }
53 public string Filename
55 get { return filename; }
58 public override void RemoveChild(IASTNode node
)
60 statements
.Remove( node
);
61 namespaces
.Remove( node
);
64 public override bool Accept(IASTVisitor visitor
)
66 visitor
.VisitSourceUnit(this);