diff options
author | Martin Odersky <odersky@gmail.com> | 2007-02-19 13:56:55 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-02-19 13:56:55 +0000 |
commit | 68508bdd74fbb6e14143132b5e9bdaf89e4adf06 (patch) | |
tree | 53d5c39fe5d0f77aaca88484cc8b1479a58a67ce /src/compiler/scala/tools/nsc/typechecker/Namers.scala | |
parent | ce7fe41d5f7d831648068c8d82b7c6caa27aa3f5 (diff) | |
download | scala-68508bdd74fbb6e14143132b5e9bdaf89e4adf06.tar.gz scala-68508bdd74fbb6e14143132b5e9bdaf89e4adf06.tar.bz2 scala-68508bdd74fbb6e14143132b5e9bdaf89e4adf06.zip |
added explicit self defs
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index d7025f3dc1..000c57d766 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -432,11 +432,25 @@ trait Namers requires Analyzer { ClassInfoType(parents, decls, clazz) } - private def classSig(tparams: List[AbsTypeDef], tpt: Tree, impl: Template): Type = { + private def classSig(tparams: List[AbsTypeDef], self: ValDef, impl: Template): Type = { + val clazz = context.owner val tparamSyms = typer.reenterTypeParams(tparams) - if (!tpt.isEmpty) - context.owner.typeOfThis = selfTypeCompleter(tpt) - else tpt.tpe = NoType + if (!self.tpt.isEmpty) { + clazz.typeOfThis = selfTypeCompleter(self.tpt) + self.symbol = clazz.thisSym + } else { + self.tpt.tpe = NoType + if (self.name != nme.WILDCARD) { + clazz.typeOfThis = clazz.tpe + self.symbol = clazz.thisSym + } else { + self.symbol = clazz.newThisSym(self.pos) setInfo clazz.tpe + } + } + if (self.name != nme.WILDCARD) { + context.scope enter self.symbol + clazz.thisSym.name = self.name + } makePolyType(tparamSyms, templateSig(impl)) } @@ -561,8 +575,8 @@ trait Namers requires Analyzer { try { val sym: Symbol = tree.symbol tree match { - case ClassDef(_, _, tparams, tpt, impl) => - new Namer(makeNewScope(context, tree, sym)).classSig(tparams, tpt, impl) + case ClassDef(_, _, tparams, self, impl) => + new Namer(makeNewScope(context, tree, sym)).classSig(tparams, self, impl) case ModuleDef(_, _, impl) => val clazz = sym.moduleClass |