Skip to content

Commit 661fdcd

Browse files
matskojasonaden
authored andcommitted
refactor(animations): instantiate Set-matching code with values in constructor (#20725)
For some reason, prior to this fix, the boolean set matching code (within `animation_transition_expr.ts`) failed to remain the same when compiled with closure. This refactor makes sure that the code stays in tact. Reproduction Details: Passes without `ng build --prod`: https://burger.stackblitz.io/ Fails with `ng build --prod`: http://burger.fxck.cz/ Closes #20374 PR Close #20725
1 parent 590d93b commit 661fdcd

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎packages/animations/browser/src/dsl/animation_transition_expr.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,12 @@ function parseAnimationAlias(alias: string, errors: string[]): string|Transition
6565
}
6666
}
6767

68-
const TRUE_BOOLEAN_VALUES = new Set<string>();
69-
TRUE_BOOLEAN_VALUES.add('true');
70-
TRUE_BOOLEAN_VALUES.add('1');
71-
72-
const FALSE_BOOLEAN_VALUES = new Set<string>();
73-
FALSE_BOOLEAN_VALUES.add('false');
74-
FALSE_BOOLEAN_VALUES.add('0');
68+
// DO NOT REFACTOR ... keep the follow set instantiations
69+
// with the values intact (closure compiler for some reason
70+
// removes follow-up lines that add the values outside of
71+
// the constructor...
72+
const TRUE_BOOLEAN_VALUES = new Set<string>(['true', '1']);
73+
const FALSE_BOOLEAN_VALUES = new Set<string>(['false', '0']);
7574

7675
function makeLambdaFromStates(lhs: string, rhs: string): TransitionMatcherFn {
7776
const LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs);

0 commit comments

Comments
 (0)