File tree 2 files changed +22
-1
lines changed
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 {
2972
2972
if ( terminates || isLast || innerFlow . isAny ( FlowFlags . BREAKS | FlowFlags . CONDITIONALLY_BREAKS ) ) {
2973
2973
commonCategorical &= innerFlow . flags ;
2974
2974
}
2975
- commonConditional |= innerFlow . flags & FlowFlags . ANY_CONDITIONAL ;
2975
+
2976
+ commonConditional |= innerFlow . deriveConditionalFlags ( ) ;
2976
2977
2977
2978
// Switch back to the parent flow
2978
2979
innerFlow . unset (
Original file line number Diff line number Diff line change @@ -266,6 +266,26 @@ export class Flow {
266
266
/** Unsets the specified flag or flags. */
267
267
unset ( flag : FlowFlags ) : void { this . flags &= ~ flag ; }
268
268
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
+
269
289
/** Forks this flow to a child flow. */
270
290
fork ( resetBreakContext : bool = false ) : Flow {
271
291
var branch = new Flow ( this . parentFunction ) ;
You can’t perform that action at this time.
0 commit comments