Commit c20a7c7
committed
[Parser] Hoist up 'try' exprs out from sequence exprs in the parser.
If the left-most sequence expr is a 'try', hoist it up to turn
'(try x) + y' into 'try (x + y)'. This is necessary to do in the
parser because 'try' nodes are represented in the ASTScope tree
to look up catch nodes. The scope tree must be syntactic because
it's constructed before sequence folding happens during preCheckExpr.
Otherwise, catch node lookup would find the incorrect catch node for
'try x + y' at the source location for 'y'.
'try' has restrictions for where it can appear within a sequence
expr. This is still diagnosed in TypeChecker::foldSequence.
(cherry picked from commit 8d64344)1 parent 1284437 commit c20a7c7
1 file changed
+17
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
375 | 392 | | |
376 | 393 | | |
377 | 394 | | |
| |||
0 commit comments