aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-09-02 17:23:54 +0200
committerMartin Odersky <odersky@gmail.com>2016-10-02 16:11:21 +0200
commit96d057364703a9b89ca49f2ac16f2cdb140d396d (patch)
treee597ebb61fc730c3c1ba6c08fd027f7712adecb1 /src/dotty/tools/dotc
parenta47a8008023ea04ff7f8d708567fb6a2c516caaa (diff)
downloaddotty-96d057364703a9b89ca49f2ac16f2cdb140d396d.tar.gz
dotty-96d057364703a9b89ca49f2ac16f2cdb140d396d.tar.bz2
dotty-96d057364703a9b89ca49f2ac16f2cdb140d396d.zip
Support separate compilation
Inline trees can now be read form TASTY. However, positions are not set correctly. This remains to be implemented.
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala7
-rw-r--r--src/dotty/tools/dotc/typer/Inliner.scala6
2 files changed, 10 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
index 56bb8498a..11f2eddac 100644
--- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -7,6 +7,7 @@ import Contexts._, Symbols._, Types._, Scopes._, SymDenotations._, Names._, Name
import StdNames._, Denotations._, Flags._, Constants._, Annotations._
import util.Positions._
import ast.{tpd, Trees, untpd}
+import typer.Inliner
import Trees._
import Decorators._
import TastyUnpickler._, TastyBuffer._, PositionPickler._
@@ -468,6 +469,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
val isClass = ttag == TEMPLATE
val templateStart = currentAddr
skipTree() // tpt
+ val rhsStart = currentAddr
val rhsIsEmpty = noRhs(end)
if (!rhsIsEmpty) skipTree()
val (givenFlags, annots, privateWithin) = readModifiers(end)
@@ -504,6 +506,11 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
sym.completer.withDecls(newScope)
forkAt(templateStart).indexTemplateParams()(localContext(sym))
}
+ else (annots.find(_.symbol == defn.InlineAnnot)) match {
+ case Some(inlineAnnot) =>
+ Inliner.attachBody(inlineAnnot, forkAt(rhsStart).readTerm()(localContext(sym)))
+ case none =>
+ }
goto(start)
sym
}
diff --git a/src/dotty/tools/dotc/typer/Inliner.scala b/src/dotty/tools/dotc/typer/Inliner.scala
index 06eea9113..68bc55860 100644
--- a/src/dotty/tools/dotc/typer/Inliner.scala
+++ b/src/dotty/tools/dotc/typer/Inliner.scala
@@ -82,12 +82,12 @@ object Inliner {
| You can use -Xmax:inlines to change the limit.""")
}
- def dropInlined(tree: tpd.Inlined)(implicit ctx: Context): Tree = {
+ def dropInlined(inlined: tpd.Inlined)(implicit ctx: Context): Tree = {
val reposition = new TreeMap {
override def transform(tree: Tree)(implicit ctx: Context): Tree =
- tree.withPos(tree.pos)
+ tree.withPos(inlined.call.pos)
}
- tpd.seq(tree.bindings, reposition.transform(tree.expansion))
+ tpd.seq(inlined.bindings, reposition.transform(inlined.expansion))
}
def inlineContext(tree: untpd.Inlined)(implicit ctx: Context): Context =