From 5c1a1498c7215935d466379d7fa85f88f4a001c7 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 30 Mar 2014 14:41:09 +0200 Subject: Maintaining owners during transformations The transformation framework needed to be changed so that contexts passed to transformations have correct owner chains. These owner chins are demanded by the Splitter phase. Note: I eliminated the contexts array in TransformInfo because it interfered with the owner computations. Generally, caching contexts with some phase is best done in Contexts, because withPhase is also used heavily in othre code, not just in Transformers. New phase: Splitter When it is complete, it will make sure that every term Ident and Select node carries a symbol. Right now, all it does is coverting self reference idents to "this"-nodes. --- src/dotty/tools/dotc/core/Contexts.scala | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/dotty/tools/dotc/core/Contexts.scala') diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 8d083b29c..8721bc548 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -277,6 +277,9 @@ object Contexts { newctx.asInstanceOf[FreshContext] } + final def withOwner(owner: Symbol): Context = + if (owner ne this.owner) fresh.setOwner(owner) else this + final def withMode(mode: Mode): Context = if (mode != this.mode) fresh.setMode(mode) else this -- cgit v1.2.3