diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-16 07:09:07 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-01-16 13:27:08 -0800 |
commit | bf6ce00f2146ae2c3feb5d2c8a2ed5f5d441ba3b (patch) | |
tree | 985b1dd8ea85476c73c03a09390a9d513ccc1017 /src/compiler/scala/reflect/internal/Symbols.scala | |
parent | 44d783a5eaa4e77c45c6565a70395525712ded23 (diff) | |
download | scala-bf6ce00f2146ae2c3feb5d2c8a2ed5f5d441ba3b.tar.gz scala-bf6ce00f2146ae2c3feb5d2c8a2ed5f5d441ba3b.tar.bz2 scala-bf6ce00f2146ae2c3feb5d2c8a2ed5f5d441ba3b.zip |
Symbol creation followup.
Changed most symbol creations to be consistent with all the others.
Opportunistically streamlined various call sites. Moved some phase-specific
methods out of Symbol to somewhere more appropriate (like that phase.)
Diffstat (limited to 'src/compiler/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/Symbols.scala | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala index 1b9ff54141..20e4362ae4 100644 --- a/src/compiler/scala/reflect/internal/Symbols.scala +++ b/src/compiler/scala/reflect/internal/Symbols.scala @@ -212,17 +212,6 @@ trait Symbols extends api.Symbols { self: SymbolTable => setInfo OverloadedType(pre, alternatives) ) - /** for explicit outer phase */ - final def newOuterAccessor(pos: Position) = { - val accFlags = METHOD | STABLE | SYNTHETIC | ( - if (isTrait) DEFERRED else 0 - ) - val sym = newMethodSymbol(nme.OUTER, pos, accFlags) - sym.expandName(this) - sym.referenced = this - sym - } - final def newErrorValue(name: TermName) = newTermSymbol(name, pos, SYNTHETIC | IS_ERROR) setInfo ErrorType @@ -285,6 +274,14 @@ trait Symbols extends api.Symbols { self: SymbolTable => final def newClass(name: TypeName, pos: Position = NoPosition, newFlags: Long = 0L) = newClassSymbol(name, pos, newFlags) + + /** A new class with its info set to a ClassInfoType with given scope and parents. */ + def newClassWithInfo(name: TypeName, parents: List[Type], scope: Scope, pos: Position = NoPosition, newFlags: Long = 0L) = { + val clazz = newClass(name, pos, newFlags) + clazz setInfo ClassInfoType(parents, scope, clazz) + } + final def newErrorClass(name: TypeName) = + newClassWithInfo(name, Nil, new ErrorScope(this), pos, SYNTHETIC | IS_ERROR) final def newModuleClass(name: TypeName, pos: Position = NoPosition) = newModuleClassSymbol(name, pos) @@ -312,11 +309,6 @@ trait Symbols extends api.Symbols { self: SymbolTable => setInfo MethodType(Nil, tpe) ) - final def newErrorClass(name: TypeName) = { - val clazz = newClassSymbol(name, pos, SYNTHETIC | IS_ERROR) - clazz setInfo ClassInfoType(Nil, new ErrorScope(this), clazz) - } - final def newErrorSymbol(name: Name): Symbol = name match { case x: TypeName => newErrorClass(x) case x: TermName => newErrorValue(x) @@ -1196,7 +1188,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => oldsymbuf += sym newsymbuf += ( if (sym.isClass) - tp.typeSymbol.newAbstractType(sym.pos, sym.name.toTypeName).setInfo(sym.existentialBound) + tp.typeSymbol.newAbstractType(sym.name.toTypeName, sym.pos).setInfo(sym.existentialBound) else sym.cloneSymbol(tp.typeSymbol)) } @@ -1346,15 +1338,15 @@ trait Symbols extends api.Symbols { self: SymbolTable => cloneSymbol(owner) /** A clone of this symbol, but with given owner. */ - final def cloneSymbol(owner: Symbol): Symbol = { - val newSym = cloneSymbolImpl(owner, this.rawflags) + final def cloneSymbol(owner: Symbol): Symbol = cloneSymbol(owner, this.rawflags) + final def cloneSymbol(owner: Symbol, newFlags: Long): Symbol = { + val newSym = cloneSymbolImpl(owner, newFlags) ( newSym setPrivateWithin privateWithin setInfo (info cloneInfo newSym) setAnnotations this.annotations ) } - /** Internal method to clone a symbol's implementation with the given flags and no info. */ def cloneSymbolImpl(owner: Symbol, newFlags: Long): Symbol def cloneSymbolImpl(owner: Symbol): Symbol = cloneSymbolImpl(owner, 0L) |