File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -624,21 +624,22 @@ object Symbols {
624
624
type DontUseSymbolOnSymbol
625
625
626
626
/** The source file from which this class was generated, null if not applicable. */
627
- final def sourceFile (implicit ctx : Context ): AbstractFile = {
628
- val file = associatedFile
629
- if (file != null && file.extension != " class" ) file
630
- else if (! defTree.isEmpty) defTree.source.file
627
+ final def sourceFile (implicit ctx : Context ): AbstractFile =
628
+ if (! defTree.isEmpty) defTree.source.file
631
629
else {
632
- val topLevelCls = denot.topLevelClass(ctx.withPhaseNoLater(ctx.flattenPhase))
633
- topLevelCls.unforcedAnnotation(defn.SourceFileAnnot ) match {
634
- case Some (sourceAnnot) => sourceAnnot.argumentConstant(0 ) match {
635
- case Some (Constant (path : String )) => AbstractFile .getFile(path)
630
+ val file = associatedFile
631
+ if (file != null && file.extension != " class" ) file
632
+ else {
633
+ val topLevelCls = denot.topLevelClass(ctx.withPhaseNoLater(ctx.flattenPhase))
634
+ topLevelCls.unforcedAnnotation(defn.SourceFileAnnot ) match {
635
+ case Some (sourceAnnot) => sourceAnnot.argumentConstant(0 ) match {
636
+ case Some (Constant (path : String )) => AbstractFile .getFile(path)
637
+ case none => null
638
+ }
636
639
case none => null
637
640
}
638
- case none => null
639
641
}
640
642
}
641
- }
642
643
643
644
def source (implicit ctx : Context ): SourceFile = ctx.getSource(sourceFile)
644
645
You can’t perform that action at this time.
0 commit comments