
1 // 2 // Copyright (c) 2006, Brian Frank and Andy Frank 3 // Licensed under the Academic Free License version 3.0 4 // 5 // History: 6 // 15 Sep 05 Brian Frank Creation 7 // 3 Jun 06 Brian Frank Ported from Java to Fan - Megan's b-day! 8 // 9 10 ** 11 ** CompilationUnit models the top level compilation unit of a source file. 12 ** 13 class CompilationUnit : Node 14 { 15 16 ////////////////////////////////////////////////////////////////////////// 17 // Construction 18 ////////////////////////////////////////////////////////////////////////// 19 20 new make(Location location, CPod pod) 21 : super(location) 22 { 23 this.pod = pod 24 this.usings = Using[,] 25 this.types = TypeDef[,] 26 } 27 28 ////////////////////////////////////////////////////////////////////////// 29 // Debug 30 ////////////////////////////////////////////////////////////////////////// 31 32 override Void print(AstWriter out) 33 { 34 out.nl 35 usings.each |Using u| { u.print(out) } 36 types.each |TypeDef t| { t.print(out) } 37 } 38 39 override Str toStr() 40 { 41 return location.toStr 42 } 43 44 ////////////////////////////////////////////////////////////////////////// 45 // Fields 46 ////////////////////////////////////////////////////////////////////////// 47 48 CPod pod // ctor 49 TokenVal[] tokens // Tokenize 50 Using[] usings // ScanForUsingsAndTypes 51 TypeDef[] types // ScanForUsingsAndTypes 52 Str:CType[] importedTypes // ResolveImports (includes my pod) 53 54 }