File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,18 @@ object Inliner {
37
37
def attachBody (inlineAnnot : Annotation , tree : => Tree )(implicit ctx : Context ): Unit =
38
38
inlineAnnot.tree.putAttachment(InlinedBody , new InlinedBody (tree))
39
39
40
- def inlinedBody (sym : SymDenotation )(implicit ctx : Context ): Option [Tree ] =
41
- sym.getAnnotation(defn.InlineAnnot ).get.tree
42
- .getAttachment(InlinedBody ).map(_.body)
40
+ private def inlinedBodyAttachment (sym : SymDenotation )(implicit ctx : Context ): Option [InlinedBody ] =
41
+ sym.getAnnotation(defn.InlineAnnot ).get.tree.getAttachment(InlinedBody )
42
+
43
+ def hasInlinedBody (sym : SymDenotation )(implicit ctx : Context ): Boolean =
44
+ inlinedBodyAttachment(sym).isDefined
45
+
46
+ def inlinedBody (sym : SymDenotation )(implicit ctx : Context ): Tree =
47
+ inlinedBodyAttachment(sym).get.body
43
48
44
49
def inlineCall (tree : Tree , pt : Type )(implicit ctx : Context ): Tree =
45
50
if (enclosingInlineds.length < ctx.settings.xmaxInlines.value)
46
- new Inliner (tree, inlinedBody(tree.symbol).get ).inlined(pt)
51
+ new Inliner (tree, inlinedBody(tree.symbol)).inlined(pt)
47
52
else errorTree(tree,
48
53
i """ Maximal number of successive inlines ( ${ctx.settings.xmaxInlines.value}) exceeded,
49
54
| Maybe this is caused by a recursive inline method?
Original file line number Diff line number Diff line change @@ -1757,7 +1757,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1757
1757
}
1758
1758
else if (tree.tpe <:< pt)
1759
1759
if (tree.symbol.isInlineMethod &&
1760
- Inliner .inlinedBody (tree.symbol).isDefined &&
1760
+ Inliner .hasInlinedBody (tree.symbol) &&
1761
1761
! ctx.owner.ownersIterator.exists(_.isInlineMethod) &&
1762
1762
! ctx.settings.YnoInline .value &&
1763
1763
! ctx.isAfterTyper)
You can’t perform that action at this time.
0 commit comments