Skip to content

Commit af6f371

Browse files
committed
Populate addresses of symbols after pickler
To allow other phases to generate their info.
1 parent 0d13962 commit af6f371

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/dotty/tools/dotc/CompilationUnit.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package dotty.tools
22
package dotc
33

4+
import dotty.tools.dotc.core.Types.Type
45
import dotty.tools.dotc.core.pickling.{TastyBuffer, TastyPickler}
56
import util.SourceFile
67
import ast.{tpd, untpd}
78
import TastyBuffer._
9+
import dotty.tools.dotc.core.Symbols._
810

911
class CompilationUnit(val source: SourceFile) {
1012

@@ -19,4 +21,6 @@ class CompilationUnit(val source: SourceFile) {
1921
lazy val pickled: TastyPickler = new TastyPickler()
2022

2123
var addrOfTree: tpd.Tree => Option[Addr] = (_ => None)
24+
25+
var addrOfSym: Symbol => Option[Addr] = (_ => None)
2226
}

src/dotty/tools/dotc/core/pickling/TreePickler.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ class TreePickler(pickler: TastyPickler) {
2626
op
2727
fillRef(lengthAddr, currentAddr, relative = true)
2828
}
29-
29+
30+
def addrOfSym(sym: Symbol): Option[Addr] = {
31+
symRefs.get(sym)
32+
}
33+
3034
private var makeSymbolicRefsTo: Symbol = NoSymbol
3135

3236
/** All references to members of class `sym` are pickled

src/dotty/tools/dotc/transform/Pickler.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Pickler extends Phase {
3636
val treePkl = new TreePickler(pickler)
3737
treePkl.pickle(tree :: Nil)
3838
unit.addrOfTree = treePkl.buf.addrOfTree
39+
unit.addrOfSym = treePkl.addrOfSym
3940
if (tree.pos.exists)
4041
new PositionPickler(pickler, treePkl.buf.addrOfTree).picklePositions(tree :: Nil, tree.pos)
4142

0 commit comments

Comments
 (0)