@@ -371,10 +371,9 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
371
371
}
372
372
373
373
/** Create symbol of definition node and enter in symAtAddr map
374
- * @return the largest subset of {NoInits, PureInterface} that a
375
- * trait owning this symbol can have as flags.
374
+ * @return the created symbol
376
375
*/
377
- def createSymbol ()(implicit ctx : Context ): FlagSet = {
376
+ def createSymbol ()(implicit ctx : Context ): Symbol = {
378
377
val start = currentAddr
379
378
val tag = readByte()
380
379
val end = readEnd()
@@ -434,10 +433,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
434
433
sym.completer.withDecls(newScope)
435
434
forkAt(templateStart).indexTemplateParams()(localContext(sym))
436
435
}
437
- if (isClass) NoInits
438
- else if (sym.isType || sym.isConstructor || flags.is(Deferred )) NoInitsInterface
439
- else if (tag == VALDEF ) EmptyFlags
440
- else NoInits
436
+ sym
441
437
}
442
438
443
439
/** Read modifier list into triplet of flags, annotations and a privateWithin
@@ -504,28 +500,33 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
504
500
(flags, annots.toList, privateWithin)
505
501
}
506
502
507
- /** Create symbols for a definitions in statement sequence between
503
+ /** Create symbols for the definitions in the statement sequence between
508
504
* current address and `end`.
509
505
* @return the largest subset of {NoInits, PureInterface} that a
510
506
* trait owning the indexed statements can have as flags.
511
507
*/
512
508
def indexStats (end : Addr )(implicit ctx : Context ): FlagSet = {
513
- val flagss =
514
- until(end) {
515
- nextByte match {
516
- case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM =>
517
- createSymbol()
518
- case IMPORT =>
519
- skipTree()
520
- NoInitsInterface
521
- case PACKAGE =>
522
- processPackage { (pid, end) => implicit ctx => indexStats(end) }
523
- case _ =>
524
- skipTree()
525
- EmptyFlags
526
- }
509
+ var initsFlags = NoInitsInterface
510
+ while (currentAddr.index < end.index) {
511
+ nextByte match {
512
+ case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM =>
513
+ val sym = createSymbol()
514
+ if (sym.isTerm && ! sym.is(MethodOrLazyOrDeferred ))
515
+ initsFlags = EmptyFlags
516
+ else if (sym.isClass ||
517
+ sym.is(Method , butNot = Deferred ) && ! sym.isConstructor)
518
+ initsFlags &= NoInits
519
+ case IMPORT =>
520
+ skipTree()
521
+ case PACKAGE =>
522
+ processPackage { (pid, end) => implicit ctx => indexStats(end) }
523
+ case _ =>
524
+ skipTree()
525
+ initsFlags = EmptyFlags
527
526
}
528
- (NoInitsInterface /: flagss)(_ & _)
527
+ }
528
+ assert(currentAddr.index == end.index)
529
+ initsFlags
529
530
}
530
531
531
532
/** Process package with given operation `op`. The operation takes as arguments
0 commit comments