-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement: Eliminate empty positions in generated NIR (#3775)
- Loading branch information
1 parent
e24a9dc
commit e40b901
Showing
13 changed files
with
193 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package scala.scalanative.nir | ||
|
||
trait Positioned { | ||
|
||
/** Returns the site in the program sources corresponding to the definition. | ||
*/ | ||
def pos: SourcePosition | ||
|
||
if (Positioned.debugEmptyPositions && pos.isEmpty) { | ||
System.err.println(s"\nFound empty position in $this, backtrace:") | ||
new RuntimeException() | ||
.getStackTrace() | ||
.take(10) | ||
.foreach(println) | ||
} | ||
} | ||
|
||
object Positioned { | ||
private final val debugEmptyPositions = | ||
sys.props.contains("scalanative.debug.nir.positions") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.