Repository navigation
Normalize if/else blocks #10270
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
base: main
Are you sure you want to change the base?
Normalize if/else blocks #10270
Changes from all commits
5b68b92
262b13b
95174ed
6b603e7
2938c74
de87228
3f3c0f2
4a64133
2786f4b
fdc0352
bd9638b
d3b0503
b4cb9d5
c0fa094
48e32a9
446049a
8a8cf18
cb19126
0beeb84
021fed8
459f301
6f26726
cb302b2
9b2de0d
1458a5d
6bf7233
52acf3a
d2cea9a
54e5fd7
f27bcb7
67d99e3
c70fb47
470e637
14f91f1
b8e9479
790478d
207a283
ccdc74d
073dd28
206198d
279130a
c93bc4c
382b730
4bee28a
118bfbf
96231ff
38fb2bd
d53e77d
362537d
ac18a98
ac44bd1
42baabe
19a0aa5
3c6fa13
fafdf66
62b4cd4
d0f4b4c
8d5288e
4cce622
9dd8107
4e476b9
ad0946e
955e3d5
ae4df09
d82c4f4
64594ec
a0b883c
ec0109f
d549e2e
378fb80
6283b23
c141eec
9dcd9bc
7d3b621
768923f
c4137a6
1ff266f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,39 +22,35 @@ | |
| */ | ||
| public class JIfStatement extends JStatement { | ||
|
|
||
| private JStatement elseStmt; | ||
| private JBlock elseStmt; | ||
| private JExpression ifExpr; | ||
| private JStatement thenStmt; | ||
| private JBlock thenStmt; | ||
|
|
||
| public JIfStatement(SourceInfo info, JExpression ifExpr, JStatement thenStmt, JStatement elseStmt) { | ||
|
Check warning on line 29 in dev/core/src/com/google/gwt/dev/jjs/ast/JIfStatement.java
|
||
| super(info); | ||
| this.ifExpr = ifExpr; | ||
| this.thenStmt = thenStmt; | ||
| this.elseStmt = elseStmt; | ||
| this.thenStmt = JBlock.ensureBlock(info, thenStmt); | ||
| this.elseStmt = JBlock.ensureBlock(info, elseStmt); | ||
| } | ||
|
|
||
| public JStatement getElseStmt() { | ||
| public JBlock getElseStmt() { | ||
| return elseStmt; | ||
| } | ||
|
|
||
| public JExpression getIfExpr() { | ||
| return ifExpr; | ||
| } | ||
|
|
||
| public JStatement getThenStmt() { | ||
| public JBlock getThenStmt() { | ||
| return thenStmt; | ||
| } | ||
|
|
||
| @Override | ||
| public void traverse(JVisitor visitor, Context ctx) { | ||
| if (visitor.visit(this, ctx)) { | ||
| ifExpr = visitor.accept(ifExpr); | ||
| if (thenStmt != null) { | ||
| thenStmt = visitor.accept(thenStmt, true); | ||
| } | ||
| if (elseStmt != null) { | ||
| elseStmt = visitor.accept(elseStmt, true); | ||
| } | ||
| thenStmt = JBlock.ensureBlock(getSourceInfo(), visitor.accept(thenStmt, true)); | ||
| elseStmt = JBlock.ensureBlock(getSourceInfo(), visitor.accept(elseStmt, true)); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fighting against the optimization on line 310 in DeadCodeElimintation that removes empty blocks, causing tests to fail. DCE should not delete blocks that are enforced by this normalization.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes the tests pass. |
||
| } | ||
| visitor.endVisit(this, ctx); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.