aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-10-17 18:37:33 +0200
committerMartin Odersky <odersky@gmail.com>2016-10-17 18:37:33 +0200
commit68608986741a3b32e2b1a328466e15ec0e7ab5b8 (patch)
treebb9029cec2bd1b8123db93bb156e41892b19a461
parent6ce403eb0c6b630f925db38b7538e0f9b8c892ea (diff)
downloaddotty-68608986741a3b32e2b1a328466e15ec0e7ab5b8.tar.gz
dotty-68608986741a3b32e2b1a328466e15ec0e7ab5b8.tar.bz2
dotty-68608986741a3b32e2b1a328466e15ec0e7ab5b8.zip
Minimize inline call info in PostTyper
-rw-r--r--src/dotty/tools/dotc/transform/PostTyper.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/transform/PostTyper.scala b/src/dotty/tools/dotc/transform/PostTyper.scala
index 51851a589..fe542ca0a 100644
--- a/src/dotty/tools/dotc/transform/PostTyper.scala
+++ b/src/dotty/tools/dotc/transform/PostTyper.scala
@@ -224,6 +224,19 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran
}
case tree @ Assign(sel: Select, _) =>
superAcc.transformAssign(super.transform(tree))
+ case Inlined(call, bindings, expansion) =>
+ // Leave only a call trace consisting of
+ // - a reference to the top-level class from which the call was inlined,
+ // - the call's position
+ // in the call field of an Inlined node.
+ // The trace has enough info to completely reconstruct positions.
+ // The minimization is done for two reasons:
+ // 1. To save space (calls might contain large inline arguments, which would otherwise
+ // be duplicated
+ // 2. To enable correct pickling (calls can share symbols with the inlined code, which
+ // would trigger an assertion when pickling).
+ val callTrace = Ident(call.symbol.topLevelClass.typeRef).withPos(call.pos)
+ cpy.Inlined(tree)(callTrace, transformSub(bindings), transform(expansion))
case tree: Template =>
val saved = parentNews
parentNews ++= tree.parents.flatMap(newPart)