Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): ignore empty switch blocks (#53776)
Adds some code to the compiler so that it ignores empty `@switch` blocks instead of trying to generate code for them. Fixes #53773. PR Close #53776
- Loading branch information
Showing
7 changed files
with
99 additions
and
0 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
14 changes: 14 additions & 0 deletions
14
...ges/compiler-cli/test/compliance/test_cases/r3_view_compiler_control_flow/empty_switch.ts
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,14 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
template: ` | ||
<div> | ||
{{message}} | ||
@switch (message) {} | ||
{{message}} | ||
</div> | ||
`, | ||
}) | ||
export class MyApp { | ||
message = 'hello'; | ||
} |
14 changes: 14 additions & 0 deletions
14
...ler-cli/test/compliance/test_cases/r3_view_compiler_control_flow/empty_switch_template.js
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,14 @@ | ||
function MyApp_Template(rf, ctx) { | ||
if (rf & 1) { | ||
$r3$.ɵɵelementStart(0, "div"); | ||
$r3$.ɵɵtext(1); | ||
$r3$.ɵɵtext(2); | ||
$r3$.ɵɵelementEnd(); | ||
} | ||
if (rf & 2) { | ||
$r3$.ɵɵadvance(1); | ||
$r3$.ɵɵtextInterpolate1(" ", ctx.message, " "); | ||
$r3$.ɵɵadvance(1); | ||
$r3$.ɵɵtextInterpolate1(" ", ctx.message, " "); | ||
} | ||
} |
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