File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -2972,7 +2972,8 @@ export class Compiler extends DiagnosticEmitter {
29722972 if ( terminates || isLast || innerFlow . isAny ( FlowFlags . BREAKS | FlowFlags . CONDITIONALLY_BREAKS ) ) {
29732973 commonCategorical &= innerFlow . flags ;
29742974 }
2975- commonConditional |= innerFlow . flags & FlowFlags . ANY_CONDITIONAL ;
2975+
2976+ commonConditional |= innerFlow . deriveConditionalFlags ( ) ;
29762977
29772978 // Switch back to the parent flow
29782979 innerFlow . unset (
Original file line number Diff line number Diff line change @@ -266,6 +266,26 @@ export class Flow {
266266 /** Unsets the specified flag or flags. */
267267 unset ( flag : FlowFlags ) : void { this . flags &= ~ flag ; }
268268
269+ deriveConditionalFlags ( ) : FlowFlags {
270+ let condiFlags = this . flags & FlowFlags . ANY_CONDITIONAL ;
271+ if ( this . is ( FlowFlags . RETURNS ) ) {
272+ condiFlags |= FlowFlags . CONDITIONALLY_RETURNS ;
273+ }
274+ if ( this . is ( FlowFlags . THROWS ) ) {
275+ condiFlags |= FlowFlags . CONDITIONALLY_THROWS ;
276+ }
277+ if ( this . is ( FlowFlags . BREAKS ) ) {
278+ condiFlags |= FlowFlags . CONDITIONALLY_BREAKS ;
279+ }
280+ if ( this . is ( FlowFlags . CONTINUES ) ) {
281+ condiFlags |= FlowFlags . CONDITIONALLY_CONTINUES ;
282+ }
283+ if ( this . is ( FlowFlags . ACCESSES_THIS ) ) {
284+ condiFlags |= FlowFlags . CONDITIONALLY_ACCESSES_THIS ;
285+ }
286+ return condiFlags ;
287+ }
288+
269289 /** Forks this flow to a child flow. */
270290 fork ( resetBreakContext : bool = false ) : Flow {
271291 var branch = new Flow ( this . parentFunction ) ;
You can’t perform that action at this time.
0 commit comments