From 697e5e38be89b3477313e86fe57ac3ba49e2344e Mon Sep 17 00:00:00 2001 From: Jonathan Rodriguez Date: Tue, 16 Feb 2016 15:04:47 -0500 Subject: Support for extending the Typer --- src/dotty/tools/dotc/typer/Namer.scala | 2 +- src/dotty/tools/dotc/typer/Typer.scala | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index ecbec7d07..c8d2b3418 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -508,7 +508,7 @@ class Namer { typer: Typer => if (sym is Module) moduleValSig(sym) else valOrDefDefSig(original, sym, Nil, Nil, identity)(localContext(sym).setNewScope) case original: DefDef => - val typer1 = new Typer + val typer1 = ctx.typer.newLikeThis nestedTyper(sym) = typer1 typer1.defDefSig(original, sym)(localContext(sym).setTyper(typer1)) case original: TypeDef => diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 6a2ff30fa..b886d8663 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -68,6 +68,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit */ private var importedFromRoot: Set[Symbol] = Set() + def newLikeThis: Typer = new Typer + /** Attribute an identifier consisting of a simple name or wildcard * * @param tree The tree representing the identifier. -- cgit v1.2.3