-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Split semantic analysis of 'break' and 'continue' statements into two procedures and use `nkError` propagation instead of `localReport`. The quality of errors reported for invalid 'break' statements is also improved. ## Details * split `semBreakOrContinue` into two procedures, as the handling of both had only very little in common * refactor the analysis of 'break' statements. `ElaborateAst` is used for easier error propagation. In addition, the input AST is no longer modified * report errors through `nkError` nodes -- `AstDiagKind` counterparts for the previously used reports are added **Changed errors:** * don't report an "invalid control flow" error when the provided identifier is erroneous. The identifier error is forwarded instead * introduce the new "label expected" error and use it to replace "ill-formed AST" and "invalid control flow" errors when the AST in the label slot is not the symbol of a label Two new error message tests are added for the changed errors.
- Loading branch information
Showing
8 changed files
with
73 additions
and
25 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
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
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,7 @@ | ||
discard """ | ||
errormsg: "expected the name of a label, but got: 1 + 1" | ||
line: 7 | ||
""" | ||
|
||
block: | ||
break 1 + 1 |
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,8 @@ | ||
discard """ | ||
errormsg: "expected the name of a label, but got: a" | ||
line: 8 | ||
""" | ||
|
||
block: | ||
var a: int | ||
break a |