diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-07-27 01:38:45 -0700 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-07-27 14:09:39 -0700 |
commit | e5121c888239b3a18ea7b341981d41bb4c9a1c07 (patch) | |
tree | baf179d23d2901cae7a9400307e623f0472c42bd /src/compiler/scala/tools/nsc/Global.scala | |
parent | ced7214959c05eb5fcf55b79f4a6691d2d8dc987 (diff) | |
download | scala-e5121c888239b3a18ea7b341981d41bb4c9a1c07.tar.gz scala-e5121c888239b3a18ea7b341981d41bb4c9a1c07.tar.bz2 scala-e5121c888239b3a18ea7b341981d41bb4c9a1c07.zip |
Remove dependency on typer phase in ClassfileParser.
ClassfileParser depends on forcing infos during typer phase.
It's not entirely clear why this is needed (git blame doesn't
help much) but I decided to preserve the logic.
Therefore, I introduced an abstract method called
`lookupMemberAtTyperPhaseIfPossible` which preserves the original
semantics but is implemented outside of ClassfileParser so the
ClassfileParser itself doesn't need to depend on typer phase and
phase mutation utilities.
I removed `loaders` override in `test/files/presentation/doc`.
I would have to update it to implement the
`lookupMemberAtTyperPhaseIfPossible` method. However, the override
doesn't seem to be doing anything useful so I just removed it.
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index ea6543bb71..ee03aa1ac2 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -356,6 +356,15 @@ class Global(var currentSettings: Settings, var reporter: Reporter) lazy val loaders = new SymbolLoaders { val global: Global.this.type = Global.this + def lookupMemberAtTyperPhaseIfPossible(sym: Symbol, name: Name): Symbol = { + def lookup = sym.info.member(name) + // if loading during initialization of `definitions` typerPhase is not yet set. + // in that case we simply load the member at the current phase + if (currentRun.typerPhase eq null) + lookup + else + enteringTyper { lookup } + } } /** Returns the mirror that loaded given symbol */ |