45 // set up basic environment for test |
45 // set up basic environment for test |
46 Context context = new Context(); |
46 Context context = new Context(); |
47 JavacFileManager.preRegister(context); // required by ClassReader which is required by Symtab |
47 JavacFileManager.preRegister(context); // required by ClassReader which is required by Symtab |
48 names = Names.instance(context); // Name.Table impls tied to an instance of Names |
48 names = Names.instance(context); // Name.Table impls tied to an instance of Names |
49 symtab = Symtab.instance(context); |
49 symtab = Symtab.instance(context); |
50 scopeCounter = ScopeCounter.instance(context); |
|
51 |
50 |
52 // determine hashMask for an empty scope |
51 // determine hashMask for an empty scope |
53 Scope emptyScope = new Scope(symtab.unnamedPackage); // any owner will do |
52 Scope emptyScope = new Scope(symtab.unnamedPackage); // any owner will do |
54 Field sHashMask = Scope.class.getDeclaredField("hashMask"); |
53 Field sHashMask = Scope.class.getDeclaredField("hashMask"); |
55 sHashMask.setAccessible(true); |
54 sHashMask.setAccessible(true); |
169 /** |
168 /** |
170 * Create a class symbol, init the members scope, and add it to owner's scope. |
169 * Create a class symbol, init the members scope, and add it to owner's scope. |
171 */ |
170 */ |
172 ClassSymbol createClass(Name name, Symbol owner) { |
171 ClassSymbol createClass(Name name, Symbol owner) { |
173 ClassSymbol sym = new ClassSymbol(0, name, owner); |
172 ClassSymbol sym = new ClassSymbol(0, name, owner); |
174 sym.members_field = new ClassScope(sym, scopeCounter); |
173 sym.members_field = new Scope(sym); |
175 if (owner != symtab.unnamedPackage) |
174 if (owner != symtab.unnamedPackage) |
176 owner.members().enter(sym); |
175 owner.members().enter(sym); |
177 return sym; |
176 return sym; |
178 } |
177 } |
179 |
178 |