From 68608986741a3b32e2b1a328466e15ec0e7ab5b8 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 17 Oct 2016 18:37:33 +0200 Subject: Minimize inline call info in PostTyper --- src/dotty/tools/dotc/transform/PostTyper.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/dotty/tools/dotc/transform/PostTyper.scala') 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) -- cgit v1.2.3