@@ -663,19 +663,9 @@ abstract class TreeInfo {
663
663
unapply(dissectApplied(tree))
664
664
}
665
665
666
- /** Does list of trees start with a definition of
667
- * a class of module with given name (ignoring imports)
668
- */
669
- def firstDefinesClassOrObject (trees : List [Tree ], name : Name ): Boolean = trees match {
670
- case Import (_, _) :: xs => firstDefinesClassOrObject(xs, name)
671
- case Annotated (_, tree1) :: _ => firstDefinesClassOrObject(List (tree1), name)
672
- case ModuleDef (_, `name`, _) :: _ => true
673
- case ClassDef (_, `name`, _, _) :: _ => true
674
- case _ => false
675
- }
676
-
677
666
/** Is this file the body of a compilation unit which should not
678
- * have Predef imported?
667
+ * have Predef imported? This is the case iff the first import in the
668
+ * unit explicitly refers to Predef.
679
669
*/
680
670
def noPredefImportForUnit (body : Tree ) = {
681
671
// Top-level definition whose leading imports include Predef.
@@ -684,13 +674,7 @@ abstract class TreeInfo {
684
674
case Import (expr, _) => isReferenceToPredef(expr)
685
675
case _ => false
686
676
}
687
- // Compilation unit is class or object 'name' in package 'scala'
688
- def isUnitInScala (tree : Tree , name : Name ) = tree match {
689
- case PackageDef (Ident (nme.scala_), defs) => firstDefinesClassOrObject(defs, name)
690
- case _ => false
691
- }
692
-
693
- isUnitInScala(body, nme.Predef ) || isLeadingPredefImport(body)
677
+ isLeadingPredefImport(body)
694
678
}
695
679
696
680
def isAbsTypeDef (tree : Tree ) = tree match {
0 commit comments