Skip to content

Commit 98f5286

Browse files
committed
Rename containsQuotesSplicesOrInline to needsStaging
1 parent 8f5a4d1 commit 98f5286

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

compiler/src/dotty/tools/dotc/CompilationUnit.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class CompilationUnit(val source: SourceFile) {
2525
/** Pickled TASTY binaries, indexed by class. */
2626
var pickled: Map[ClassSymbol, Array[Byte]] = Map()
2727

28-
/** Will be reset to `true` if contains `Quote`, `Splice` or calls to inline methods.
28+
/** Will be set to `true` if contains `Quote`, `Splice` or calls to inline methods.
2929
* The information is used in phase `Staging` in order to avoid traversing a quote-less tree.
3030
*/
31-
var containsQuotesSplicesOrInline: Boolean = false
31+
var needsStaging: Boolean = false
3232

3333
/** A structure containing a temporary map for generating inline accessors */
3434
val inlineAccessors: InlineAccessors = new InlineAccessors
@@ -48,18 +48,18 @@ object CompilationUnit {
4848
if (forceTrees) {
4949
val force = new Force
5050
force.traverse(unit1.tpdTree)
51-
unit1.containsQuotesSplicesOrInline = force.containsQuotesOrInline
51+
unit1.needsStaging = force.needsStaging
5252
}
5353
unit1
5454
}
5555

5656
/** Force the tree to be loaded */
5757
private class Force extends TreeTraverser {
58-
var containsQuotesOrInline = false
58+
var needsStaging = false
5959
def traverse(tree: Tree)(implicit ctx: Context): Unit = {
6060
// Note that top-level splices are still inside the inline methods
6161
if (tree.symbol.isQuote || tpd.isInlineCall(tree))
62-
containsQuotesOrInline = true
62+
needsStaging = true
6363
traverseChildren(tree)
6464
}
6565
}

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
173173

174174
if (sym.isSplice || sym.isQuote) {
175175
markAsMacro(ctx)
176-
ctx.compilationUnit.containsQuotesSplicesOrInline = true
176+
ctx.compilationUnit.needsStaging = true
177177
}
178178
}
179179

180180
private def handleInlineCall(sym: Symbol)(implicit ctx: Context): Unit = {
181181
if (sym.is(Inline))
182-
ctx.compilationUnit.containsQuotesSplicesOrInline = true
182+
ctx.compilationUnit.needsStaging = true
183183
}
184184

185185
override def transform(tree: Tree)(implicit ctx: Context): Tree =

compiler/src/dotty/tools/dotc/transform/Staging.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class Staging extends MacroTransformWithImplicits {
9494
}
9595

9696
override def run(implicit ctx: Context): Unit =
97-
if (ctx.compilationUnit.containsQuotesSplicesOrInline) super.run
97+
if (ctx.compilationUnit.needsStaging) super.run
9898

9999
protected def newTransformer(implicit ctx: Context): Transformer =
100100
new Reifier(inQuote = false, null, 0, new LevelInfo, new Embedded, ctx)

0 commit comments

Comments
 (0)