diff options
author | Martin Odersky <odersky@gmail.com> | 2016-09-10 18:17:36 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-02 16:11:21 +0200 |
commit | e93b7bfe770c8950a52d17bb0aebd3e0a5e93b3c (patch) | |
tree | 065ffb8c2b84ce2a6ec9f3ba050473c7af307c7d /src/dotty/tools/dotc/typer/Inliner.scala | |
parent | 8e66f5384837ba662eb6243e221e18e7364757ee (diff) | |
download | dotty-e93b7bfe770c8950a52d17bb0aebd3e0a5e93b3c.tar.gz dotty-e93b7bfe770c8950a52d17bb0aebd3e0a5e93b3c.tar.bz2 dotty-e93b7bfe770c8950a52d17bb0aebd3e0a5e93b3c.zip |
Don't add inline accessors twice
Make sure that inline accessors are not added twice. We got lucky so far
because the fact that annotations are lazy meant that attachments did not
persist. But if @inline was made into a strict annotation, inline accessors were indeed
added twice.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Inliner.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Inliner.scala | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Inliner.scala b/src/dotty/tools/dotc/typer/Inliner.scala index e865c0596..cd042c476 100644 --- a/src/dotty/tools/dotc/typer/Inliner.scala +++ b/src/dotty/tools/dotc/typer/Inliner.scala @@ -192,9 +192,11 @@ object Inliner { /** The accessor defs to non-public members which need to be defined * together with the inline method */ - def accessors(implicit ctx: Context): List[MemberDef] = { + def removeAccessors(implicit ctx: Context): List[MemberDef] = { ensureEvaluated() - myAccessors.toList + val res = myAccessors.toList + myAccessors.clear() + res } } @@ -242,8 +244,8 @@ object Inliner { * @pre hasBodyToInline(sym) */ - def inlineAccessors(sym: SymDenotation)(implicit ctx: Context): List[MemberDef] = - inlineInfo(sym).get.accessors + def removeInlineAccessors(sym: SymDenotation)(implicit ctx: Context): List[MemberDef] = + inlineInfo(sym).get.removeAccessors /** Try to inline a call to a `@inline` method. Fail with error if the maximal * inline depth is exceeded. |