diff options
author | Martin Odersky <odersky@gmail.com> | 2013-09-05 14:55:57 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-09-05 14:56:09 +0200 |
commit | ae8cc6ff0b3c57877ae60b0b1fd30d1bcefa0518 (patch) | |
tree | 5e0965693224130caf8c0086ad2d7c2de9f02fc5 /src/dotty/tools/dotc/core/Contexts.scala | |
parent | 860fd2eb286c48d36655ad99a068a2e61bdb1381 (diff) | |
download | dotty-ae8cc6ff0b3c57877ae60b0b1fd30d1bcefa0518.tar.gz dotty-ae8cc6ff0b3c57877ae60b0b1fd30d1bcefa0518.tar.bz2 dotty-ae8cc6ff0b3c57877ae60b0b1fd30d1bcefa0518.zip |
Changes in typecomparers
1) Fixes for <:<
2) Changes in context handling type comparers that allow one to make a new type comparer that "sticks" in nested contexts.
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 531df739e..0898321e5 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -146,9 +146,10 @@ object Contexts { def moreProperties: Map[String, Any] = _moreProperties private var _typeComparer: TypeComparer = _ + protected def typeComparer_=(typeComparer: TypeComparer) = _typeComparer = typeComparer def typeComparer: TypeComparer = { - if (_typeComparer == null || (_typeComparer.ctx ne this)) - _typeComparer = new TypeComparer()(this) + if (_typeComparer.ctx ne this) + _typeComparer = _typeComparer.copyIn(this) _typeComparer } @@ -299,6 +300,7 @@ object Contexts { def withImportInfo(importInfo: ImportInfo): this.type = { this.importInfo = importInfo; this } def withRunInfo(runInfo: RunInfo): this.type = { this.runInfo = runInfo; this } def withDiagnostics(diagnostics: Option[StringBuilder]): this.type = { this.diagnostics = diagnostics; this } + def withTypeComparerFn(tcfn: Context => TypeComparer): this.type = { this.typeComparer = tcfn(this); this } def withMoreProperties(moreProperties: Map[String, Any]): this.type = { this.moreProperties = moreProperties; this } def withProperty(prop: (String, Any)): this.type = withMoreProperties(moreProperties + prop) @@ -326,6 +328,7 @@ object Contexts { runInfo = new RunInfo diagnostics = None moreProperties = Map.empty + typeComparer = new TypeComparer(this) } object NoContext extends Context { |