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 | */
|
---|
8 | import { ParseSourceSpan } from '../parse_util';
|
---|
9 | import * as o from './output_ast';
|
---|
10 | import { SourceMapGenerator } from './source_map';
|
---|
11 | export declare const CATCH_ERROR_VAR: o.ReadVarExpr;
|
---|
12 | export declare const CATCH_STACK_VAR: o.ReadVarExpr;
|
---|
13 | export interface OutputEmitter {
|
---|
14 | emitStatements(genFilePath: string, stmts: o.Statement[], preamble?: string | null): string;
|
---|
15 | }
|
---|
16 | export declare class EmitterVisitorContext {
|
---|
17 | private _indent;
|
---|
18 | static createRoot(): EmitterVisitorContext;
|
---|
19 | private _lines;
|
---|
20 | private _classes;
|
---|
21 | private _preambleLineCount;
|
---|
22 | constructor(_indent: number);
|
---|
23 | println(from?: {
|
---|
24 | sourceSpan: ParseSourceSpan | null;
|
---|
25 | } | null, lastPart?: string): void;
|
---|
26 | lineIsEmpty(): boolean;
|
---|
27 | lineLength(): number;
|
---|
28 | print(from: {
|
---|
29 | sourceSpan: ParseSourceSpan | null;
|
---|
30 | } | null, part: string, newLine?: boolean): void;
|
---|
31 | removeEmptyLastLine(): void;
|
---|
32 | incIndent(): void;
|
---|
33 | decIndent(): void;
|
---|
34 | pushClass(clazz: o.ClassStmt): void;
|
---|
35 | popClass(): o.ClassStmt;
|
---|
36 | get currentClass(): o.ClassStmt | null;
|
---|
37 | toSource(): string;
|
---|
38 | toSourceMapGenerator(genFilePath: string, startsAtLine?: number): SourceMapGenerator;
|
---|
39 | setPreambleLineCount(count: number): number;
|
---|
40 | spanOf(line: number, column: number): ParseSourceSpan | null;
|
---|
41 | }
|
---|
42 | export declare abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.ExpressionVisitor {
|
---|
43 | private _escapeDollarInStrings;
|
---|
44 | constructor(_escapeDollarInStrings: boolean);
|
---|
45 | protected printLeadingComments(stmt: o.Statement, ctx: EmitterVisitorContext): void;
|
---|
46 | visitExpressionStmt(stmt: o.ExpressionStatement, ctx: EmitterVisitorContext): any;
|
---|
47 | visitReturnStmt(stmt: o.ReturnStatement, ctx: EmitterVisitorContext): any;
|
---|
48 | abstract visitCastExpr(ast: o.CastExpr, context: any): any;
|
---|
49 | abstract visitDeclareClassStmt(stmt: o.ClassStmt, ctx: EmitterVisitorContext): any;
|
---|
50 | visitIfStmt(stmt: o.IfStmt, ctx: EmitterVisitorContext): any;
|
---|
51 | abstract visitTryCatchStmt(stmt: o.TryCatchStmt, ctx: EmitterVisitorContext): any;
|
---|
52 | visitThrowStmt(stmt: o.ThrowStmt, ctx: EmitterVisitorContext): any;
|
---|
53 | abstract visitDeclareVarStmt(stmt: o.DeclareVarStmt, ctx: EmitterVisitorContext): any;
|
---|
54 | visitWriteVarExpr(expr: o.WriteVarExpr, ctx: EmitterVisitorContext): any;
|
---|
55 | visitWriteKeyExpr(expr: o.WriteKeyExpr, ctx: EmitterVisitorContext): any;
|
---|
56 | visitWritePropExpr(expr: o.WritePropExpr, ctx: EmitterVisitorContext): any;
|
---|
57 | visitInvokeMethodExpr(expr: o.InvokeMethodExpr, ctx: EmitterVisitorContext): any;
|
---|
58 | abstract getBuiltinMethodName(method: o.BuiltinMethod): string;
|
---|
59 | visitInvokeFunctionExpr(expr: o.InvokeFunctionExpr, ctx: EmitterVisitorContext): any;
|
---|
60 | visitTaggedTemplateExpr(expr: o.TaggedTemplateExpr, ctx: EmitterVisitorContext): any;
|
---|
61 | visitWrappedNodeExpr(ast: o.WrappedNodeExpr<any>, ctx: EmitterVisitorContext): any;
|
---|
62 | visitTypeofExpr(expr: o.TypeofExpr, ctx: EmitterVisitorContext): any;
|
---|
63 | visitReadVarExpr(ast: o.ReadVarExpr, ctx: EmitterVisitorContext): any;
|
---|
64 | visitInstantiateExpr(ast: o.InstantiateExpr, ctx: EmitterVisitorContext): any;
|
---|
65 | visitLiteralExpr(ast: o.LiteralExpr, ctx: EmitterVisitorContext): any;
|
---|
66 | visitLocalizedString(ast: o.LocalizedString, ctx: EmitterVisitorContext): any;
|
---|
67 | abstract visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any;
|
---|
68 | visitConditionalExpr(ast: o.ConditionalExpr, ctx: EmitterVisitorContext): any;
|
---|
69 | visitNotExpr(ast: o.NotExpr, ctx: EmitterVisitorContext): any;
|
---|
70 | visitAssertNotNullExpr(ast: o.AssertNotNull, ctx: EmitterVisitorContext): any;
|
---|
71 | abstract visitFunctionExpr(ast: o.FunctionExpr, ctx: EmitterVisitorContext): any;
|
---|
72 | abstract visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, context: any): any;
|
---|
73 | visitUnaryOperatorExpr(ast: o.UnaryOperatorExpr, ctx: EmitterVisitorContext): any;
|
---|
74 | visitBinaryOperatorExpr(ast: o.BinaryOperatorExpr, ctx: EmitterVisitorContext): any;
|
---|
75 | visitReadPropExpr(ast: o.ReadPropExpr, ctx: EmitterVisitorContext): any;
|
---|
76 | visitReadKeyExpr(ast: o.ReadKeyExpr, ctx: EmitterVisitorContext): any;
|
---|
77 | visitLiteralArrayExpr(ast: o.LiteralArrayExpr, ctx: EmitterVisitorContext): any;
|
---|
78 | visitLiteralMapExpr(ast: o.LiteralMapExpr, ctx: EmitterVisitorContext): any;
|
---|
79 | visitCommaExpr(ast: o.CommaExpr, ctx: EmitterVisitorContext): any;
|
---|
80 | visitAllExpressions(expressions: o.Expression[], ctx: EmitterVisitorContext, separator: string): void;
|
---|
81 | visitAllObjects<T>(handler: (t: T) => void, expressions: T[], ctx: EmitterVisitorContext, separator: string): void;
|
---|
82 | visitAllStatements(statements: o.Statement[], ctx: EmitterVisitorContext): void;
|
---|
83 | }
|
---|
84 | export declare function escapeIdentifier(input: string, escapeDollar: boolean, alwaysQuote?: boolean): any;
|
---|