fix(compiler): fix a few non-tree-shakeable code patterns (#24677)

This change makes @angular/compiler more tree-shakeable by changing
an enum to a const enum and by getting rid of a top-level map that
the tree-shaker was seeing as a reference which caused r3_identifiers
to be retained.

This drops a few hundred bytes of JS from tree-shaken ngtsc compiled
apps.

PR Close #24677
This commit is contained in:
Alex Rickabaugh
2018-06-20 16:00:48 -07:00
committed by Miško Hevery
parent 69510acb20
commit 50d4a4fe5c
3 changed files with 16 additions and 17 deletions

View File

@ -58,7 +58,7 @@ export class AttrAst implements TemplateAst {
visit(visitor: TemplateAstVisitor, context: any): any { return visitor.visitAttr(this, context); }
}
export enum PropertyBindingType {
export const enum PropertyBindingType {
// A normal binding to a property (e.g. `[property]="expression"`).
Property,
// A binding to an element attribute (e.g. `[attr.name]="expression"`).