@@ -243,20 +243,6 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
243
243
case y => y
244
244
}
245
245
246
- /** The largest subset of {NoInits, PureInterface} that a
247
- * trait or class enclosing this statement can have as flags.
248
- */
249
- def defKind (tree : Tree )(implicit ctx : Context ): FlagSet = unsplice(tree) match {
250
- case EmptyTree | _ : Import => NoInitsInterface
251
- case tree : TypeDef => if (tree.isClassDef) NoInits else NoInitsInterface
252
- case tree : DefDef =>
253
- if (tree.unforcedRhs == EmptyTree &&
254
- tree.vparamss.forall(_.forall(_.rhs.isEmpty))) NoInitsInterface
255
- else NoInits
256
- case tree : ValDef => if (tree.unforcedRhs == EmptyTree ) NoInitsInterface else EmptyFlags
257
- case _ => EmptyFlags
258
- }
259
-
260
246
/** The largest subset of {NoInits, PureInterface} that a
261
247
* trait or class with these parents can have as flags.
262
248
*/
@@ -266,12 +252,6 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
266
252
case _ :: parents1 => parentsKind(parents1)
267
253
}
268
254
269
- /** The largest subset of {NoInits, PureInterface} that a
270
- * trait or class with this body can have as flags.
271
- */
272
- def bodyKind (body : List [Tree ])(implicit ctx : Context ): FlagSet =
273
- (NoInitsInterface /: body)((fs, stat) => fs & defKind(stat))
274
-
275
255
/** Checks whether predicate `p` is true for all result parts of this expression,
276
256
* where we zoom into Ifs, Matches, and Blocks.
277
257
*/
@@ -342,6 +322,28 @@ trait UntypedTreeInfo extends TreeInfo[Untyped] { self: Trees.Instance[Untyped]
342
322
case _ => false
343
323
}
344
324
325
+ /** The largest subset of {NoInits, PureInterface} that a
326
+ * trait or class enclosing this statement can have as flags.
327
+ */
328
+ def defKind (tree : Tree )(implicit ctx : Context ): FlagSet = unsplice(tree) match {
329
+ case EmptyTree | _ : Import => NoInitsInterface
330
+ case tree : TypeDef => if (tree.isClassDef) NoInits else NoInitsInterface
331
+ case tree : DefDef =>
332
+ if (tree.unforcedRhs == EmptyTree &&
333
+ tree.vparamss.forall(_.forall(_.rhs.isEmpty))) NoInitsInterface
334
+ else if (tree.mods.is(Given ) && tree.tparams.isEmpty && tree.vparamss.isEmpty)
335
+ EmptyFlags // might become a lazy val: TODO: check whether we need to suppress NoInits once we have new lazy val impl
336
+ else NoInits
337
+ case tree : ValDef => if (tree.unforcedRhs == EmptyTree ) NoInitsInterface else EmptyFlags
338
+ case _ => EmptyFlags
339
+ }
340
+
341
+ /** The largest subset of {NoInits, PureInterface} that a
342
+ * trait or class with this body can have as flags.
343
+ */
344
+ def bodyKind (body : List [Tree ])(implicit ctx : Context ): FlagSet =
345
+ (NoInitsInterface /: body)((fs, stat) => fs & defKind(stat))
346
+
345
347
// todo: fill with other methods from TreeInfo that only apply to untpd.Tree's
346
348
}
347
349
0 commit comments