diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-30 14:41:09 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-03-31 14:52:27 +0200 |
commit | 5c1a1498c7215935d466379d7fa85f88f4a001c7 (patch) | |
tree | 9825be12a157486430f8e0229f811f1f436b9847 /src/dotty/tools/dotc/core/Contexts.scala | |
parent | 9bd1e6a99e1cb09a3527e548699d1561e72e36d3 (diff) | |
download | dotty-5c1a1498c7215935d466379d7fa85f88f4a001c7.tar.gz dotty-5c1a1498c7215935d466379d7fa85f88f4a001c7.tar.bz2 dotty-5c1a1498c7215935d466379d7fa85f88f4a001c7.zip |
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.
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 3 |
1 files changed, 3 insertions, 0 deletions
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 |