UNPKG

1.29 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import * as o from './output/output_ast';
9/**
10 * A constant pool allows a code emitter to share constant in an output context.
11 *
12 * The constant pool also supports sharing access to ivy definitions references.
13 */
14export declare class ConstantPool {
15 private readonly isClosureCompilerEnabled;
16 statements: o.Statement[];
17 private literals;
18 private literalFactories;
19 private nextNameIndex;
20 constructor(isClosureCompilerEnabled?: boolean);
21 getConstLiteral(literal: o.Expression, forceShared?: boolean): o.Expression;
22 getLiteralFactory(literal: o.LiteralArrayExpr | o.LiteralMapExpr): {
23 literalFactory: o.Expression;
24 literalFactoryArguments: o.Expression[];
25 };
26 private _getLiteralFactory;
27 /**
28 * Produce a unique name.
29 *
30 * The name might be unique among different prefixes if any of the prefixes end in
31 * a digit so the prefix should be a constant string (not based on user input) and
32 * must not end in a digit.
33 */
34 uniqueName(prefix: string): string;
35 private freshName;
36 private keyOf;
37}