equal
deleted
inserted
replaced
72 public final Type booleanType = new Type(TypeTags.BOOLEAN, null); |
72 public final Type booleanType = new Type(TypeTags.BOOLEAN, null); |
73 public final Type botType = new BottomType(); |
73 public final Type botType = new BottomType(); |
74 public final JCNoType voidType = new JCNoType(TypeTags.VOID); |
74 public final JCNoType voidType = new JCNoType(TypeTags.VOID); |
75 |
75 |
76 private final Names names; |
76 private final Names names; |
|
77 private final Scope.ScopeCounter scopeCounter; |
77 private final ClassReader reader; |
78 private final ClassReader reader; |
78 private final Target target; |
79 private final Target target; |
79 |
80 |
80 /** A symbol for the root package. |
81 /** A symbol for the root package. |
81 */ |
82 */ |
338 */ |
339 */ |
339 protected Symtab(Context context) throws CompletionFailure { |
340 protected Symtab(Context context) throws CompletionFailure { |
340 context.put(symtabKey, this); |
341 context.put(symtabKey, this); |
341 |
342 |
342 names = Names.instance(context); |
343 names = Names.instance(context); |
|
344 scopeCounter = Scope.ScopeCounter.instance(context); |
343 target = Target.instance(context); |
345 target = Target.instance(context); |
344 |
346 |
345 // Create the unknown type |
347 // Create the unknown type |
346 unknownType = new Type(TypeTags.UNKNOWN, null); |
348 unknownType = new Type(TypeTags.UNKNOWN, null); |
347 |
349 |
384 // the builtin class of all methods |
386 // the builtin class of all methods |
385 methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol); |
387 methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol); |
386 |
388 |
387 // Create class to hold all predefined constants and operations. |
389 // Create class to hold all predefined constants and operations. |
388 predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage); |
390 predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage); |
389 Scope scope = new Scope(predefClass); |
391 Scope scope = new Scope.ClassScope(predefClass, scopeCounter); |
390 predefClass.members_field = scope; |
392 predefClass.members_field = scope; |
391 |
393 |
392 // Enter symbols for basic types. |
394 // Enter symbols for basic types. |
393 scope.enter(byteType.tsym); |
395 scope.enter(byteType.tsym); |
394 scope.enter(shortType.tsym); |
396 scope.enter(shortType.tsym); |
474 this.proprietaryType = proprietaryType; |
476 this.proprietaryType = proprietaryType; |
475 ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym; |
477 ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym; |
476 proprietarySymbol.completer = null; |
478 proprietarySymbol.completer = null; |
477 proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE; |
479 proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE; |
478 proprietarySymbol.erasure_field = proprietaryType; |
480 proprietarySymbol.erasure_field = proprietaryType; |
479 proprietarySymbol.members_field = new Scope(proprietarySymbol); |
481 proprietarySymbol.members_field = new Scope.ClassScope(proprietarySymbol, scopeCounter); |
480 proprietaryType.typarams_field = List.nil(); |
482 proprietaryType.typarams_field = List.nil(); |
481 proprietaryType.allparams_field = List.nil(); |
483 proprietaryType.allparams_field = List.nil(); |
482 proprietaryType.supertype_field = annotationType; |
484 proprietaryType.supertype_field = annotationType; |
483 proprietaryType.interfaces_field = List.nil(); |
485 proprietaryType.interfaces_field = List.nil(); |
484 |
486 |
486 // The class implements java.lang.Cloneable and java.io.Serializable. |
488 // The class implements java.lang.Cloneable and java.io.Serializable. |
487 // It has a final length field and a clone method. |
489 // It has a final length field and a clone method. |
488 ClassType arrayClassType = (ClassType)arrayClass.type; |
490 ClassType arrayClassType = (ClassType)arrayClass.type; |
489 arrayClassType.supertype_field = objectType; |
491 arrayClassType.supertype_field = objectType; |
490 arrayClassType.interfaces_field = List.of(cloneableType, serializableType); |
492 arrayClassType.interfaces_field = List.of(cloneableType, serializableType); |
491 arrayClass.members_field = new Scope(arrayClass); |
493 arrayClass.members_field = new Scope.ClassScope(arrayClass, scopeCounter); |
492 lengthVar = new VarSymbol( |
494 lengthVar = new VarSymbol( |
493 PUBLIC | FINAL, |
495 PUBLIC | FINAL, |
494 names.length, |
496 names.length, |
495 intType, |
497 intType, |
496 arrayClass); |
498 arrayClass); |