From 95e488eab2a686671b2a6ffd8fce05c043b3afab Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 15 Sep 2016 18:08:10 +0200 Subject: Use BodyAnnot to indicate rhs of inline method Since fundamental operations such as treeCopy have to know about inline bodies, it seems better to represent this information directly in an annotation. --- src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala') diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 1b8434129..4a94e5d71 100644 --- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -488,13 +488,12 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle sym.completer.withDecls(newScope) forkAt(templateStart).indexTemplateParams()(localContext(sym)) } - else if (annots.exists(_.symbol == defn.InlineAnnot)) { - Inliner.registerInlineInfo( - sym, - implicit ctx => forkAt(rhsStart).readTerm(), - implicit ctx => localContext(sym).addMode(Mode.ReadPositions)) - // Previous line avoids space leaks because it does not capture the current context. - } + else if (annots.exists(_.symbol == defn.InlineAnnot)) + sym.addAnnotation(LazyBodyAnnotation { ctx0 => + implicit val ctx: Context = localContext(sym)(ctx0).addMode(Mode.ReadPositions) + // avoids space leaks by not capturing the current context + forkAt(rhsStart).readTerm() + }) goto(start) sym } -- cgit v1.2.3