-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: switch branch stmts #3043
base: master
Are you sure you want to change the base?
fix: switch branch stmts #3043
Conversation
5f5172c
to
c5dcb0a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3043 +/- ##
==========================================
- Coverage 63.37% 63.37% -0.01%
==========================================
Files 566 566
Lines 79490 79506 +16
==========================================
+ Hits 50374 50384 +10
- Misses 25727 25732 +5
- Partials 3389 3390 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -2125,8 +2130,19 @@ func preprocess1(store Store, ctx BlockNode, n Node) Node { | |||
|
|||
// TRANS_LEAVE ----------------------- | |||
case *BranchStmt: | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this line for consistency.
@@ -2139,6 +2155,8 @@ func preprocess1(store Store, ctx BlockNode, n Node) Node { | |||
} | |||
} | |||
case CONTINUE: | |||
notAllowedFunc("continue") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this logic be merged into findContinuableNode
and findBranchLabel
, seems what we need to do is to make these two funcs correct.
|
||
if n.GetAttribute(ATTR_LAST_BLOCK_STMT) != true { | ||
// no more clause after the one executed, this is not allowed | ||
panic("fallthrough statement out of place") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any test targeting this?
ATTR_LOOP_DEFINES GnoAttribute = "ATTR_LOOP_DEFINES" // []Name defined within loops. | ||
ATTR_LOOP_USES GnoAttribute = "ATTR_LOOP_USES" // []Name loop defines actually used. | ||
ATTR_SHIFT_RHS GnoAttribute = "ATTR_SHIFT_RHS" | ||
ATTR_LAST_BLOCK_STMT GnoAttribute = "ATTR_LAST_BLOCK_STMT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a better name?
Adds validation for
break
,continue
andfallthrough
to disallow invalid code.Moves existing validation from the runtime to the preprocessor.
Associated issue