source: trip-planner-front/node_modules/@angular/compiler/src/output/output_ast.d.ts@ 59329aa

Last change on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 33.1 KB
Line 
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 { ParseSourceSpan } from '../parse_util';
9import { I18nMeta } from '../render3/view/i18n/meta';
10export declare enum TypeModifier {
11 Const = 0
12}
13export declare abstract class Type {
14 modifiers: TypeModifier[];
15 constructor(modifiers?: TypeModifier[]);
16 abstract visitType(visitor: TypeVisitor, context: any): any;
17 hasModifier(modifier: TypeModifier): boolean;
18}
19export declare enum BuiltinTypeName {
20 Dynamic = 0,
21 Bool = 1,
22 String = 2,
23 Int = 3,
24 Number = 4,
25 Function = 5,
26 Inferred = 6,
27 None = 7
28}
29export declare class BuiltinType extends Type {
30 name: BuiltinTypeName;
31 constructor(name: BuiltinTypeName, modifiers?: TypeModifier[]);
32 visitType(visitor: TypeVisitor, context: any): any;
33}
34export declare class ExpressionType extends Type {
35 value: Expression;
36 typeParams: Type[] | null;
37 constructor(value: Expression, modifiers?: TypeModifier[], typeParams?: Type[] | null);
38 visitType(visitor: TypeVisitor, context: any): any;
39}
40export declare class ArrayType extends Type {
41 of: Type;
42 constructor(of: Type, modifiers?: TypeModifier[]);
43 visitType(visitor: TypeVisitor, context: any): any;
44}
45export declare class MapType extends Type {
46 valueType: Type | null;
47 constructor(valueType: Type | null | undefined, modifiers?: TypeModifier[]);
48 visitType(visitor: TypeVisitor, context: any): any;
49}
50export declare const DYNAMIC_TYPE: BuiltinType;
51export declare const INFERRED_TYPE: BuiltinType;
52export declare const BOOL_TYPE: BuiltinType;
53export declare const INT_TYPE: BuiltinType;
54export declare const NUMBER_TYPE: BuiltinType;
55export declare const STRING_TYPE: BuiltinType;
56export declare const FUNCTION_TYPE: BuiltinType;
57export declare const NONE_TYPE: BuiltinType;
58export interface TypeVisitor {
59 visitBuiltinType(type: BuiltinType, context: any): any;
60 visitExpressionType(type: ExpressionType, context: any): any;
61 visitArrayType(type: ArrayType, context: any): any;
62 visitMapType(type: MapType, context: any): any;
63}
64export declare enum UnaryOperator {
65 Minus = 0,
66 Plus = 1
67}
68export declare enum BinaryOperator {
69 Equals = 0,
70 NotEquals = 1,
71 Identical = 2,
72 NotIdentical = 3,
73 Minus = 4,
74 Plus = 5,
75 Divide = 6,
76 Multiply = 7,
77 Modulo = 8,
78 And = 9,
79 Or = 10,
80 BitwiseAnd = 11,
81 Lower = 12,
82 LowerEquals = 13,
83 Bigger = 14,
84 BiggerEquals = 15,
85 NullishCoalesce = 16
86}
87export declare function nullSafeIsEquivalent<T extends {
88 isEquivalent(other: T): boolean;
89}>(base: T | null, other: T | null): boolean;
90export declare function areAllEquivalent<T extends {
91 isEquivalent(other: T): boolean;
92}>(base: T[], other: T[]): boolean;
93export declare abstract class Expression {
94 type: Type | null;
95 sourceSpan: ParseSourceSpan | null;
96 constructor(type: Type | null | undefined, sourceSpan?: ParseSourceSpan | null);
97 abstract visitExpression(visitor: ExpressionVisitor, context: any): any;
98 /**
99 * Calculates whether this expression produces the same value as the given expression.
100 * Note: We don't check Types nor ParseSourceSpans nor function arguments.
101 */
102 abstract isEquivalent(e: Expression): boolean;
103 /**
104 * Return true if the expression is constant.
105 */
106 abstract isConstant(): boolean;
107 prop(name: string, sourceSpan?: ParseSourceSpan | null): ReadPropExpr;
108 key(index: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null): ReadKeyExpr;
109 callMethod(name: string | BuiltinMethod, params: Expression[], sourceSpan?: ParseSourceSpan | null): InvokeMethodExpr;
110 callFn(params: Expression[], sourceSpan?: ParseSourceSpan | null, pure?: boolean): InvokeFunctionExpr;
111 instantiate(params: Expression[], type?: Type | null, sourceSpan?: ParseSourceSpan | null): InstantiateExpr;
112 conditional(trueCase: Expression, falseCase?: Expression | null, sourceSpan?: ParseSourceSpan | null): ConditionalExpr;
113 equals(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
114 notEquals(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
115 identical(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
116 notIdentical(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
117 minus(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
118 plus(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
119 divide(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
120 multiply(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
121 modulo(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
122 and(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
123 bitwiseAnd(rhs: Expression, sourceSpan?: ParseSourceSpan | null, parens?: boolean): BinaryOperatorExpr;
124 or(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
125 lower(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
126 lowerEquals(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
127 bigger(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
128 biggerEquals(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
129 isBlank(sourceSpan?: ParseSourceSpan | null): Expression;
130 cast(type: Type, sourceSpan?: ParseSourceSpan | null): Expression;
131 nullishCoalesce(rhs: Expression, sourceSpan?: ParseSourceSpan | null): BinaryOperatorExpr;
132 toStmt(): Statement;
133}
134export declare enum BuiltinVar {
135 This = 0,
136 Super = 1,
137 CatchError = 2,
138 CatchStack = 3
139}
140export declare class ReadVarExpr extends Expression {
141 name: string | null;
142 builtin: BuiltinVar | null;
143 constructor(name: string | BuiltinVar, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
144 isEquivalent(e: Expression): boolean;
145 isConstant(): boolean;
146 visitExpression(visitor: ExpressionVisitor, context: any): any;
147 set(value: Expression): WriteVarExpr;
148}
149export declare class TypeofExpr extends Expression {
150 expr: Expression;
151 constructor(expr: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
152 visitExpression(visitor: ExpressionVisitor, context: any): any;
153 isEquivalent(e: Expression): boolean;
154 isConstant(): boolean;
155}
156export declare class WrappedNodeExpr<T> extends Expression {
157 node: T;
158 constructor(node: T, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
159 isEquivalent(e: Expression): boolean;
160 isConstant(): boolean;
161 visitExpression(visitor: ExpressionVisitor, context: any): any;
162}
163export declare class WriteVarExpr extends Expression {
164 name: string;
165 value: Expression;
166 constructor(name: string, value: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
167 isEquivalent(e: Expression): boolean;
168 isConstant(): boolean;
169 visitExpression(visitor: ExpressionVisitor, context: any): any;
170 toDeclStmt(type?: Type | null, modifiers?: StmtModifier[]): DeclareVarStmt;
171 toConstDecl(): DeclareVarStmt;
172}
173export declare class WriteKeyExpr extends Expression {
174 receiver: Expression;
175 index: Expression;
176 value: Expression;
177 constructor(receiver: Expression, index: Expression, value: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
178 isEquivalent(e: Expression): boolean;
179 isConstant(): boolean;
180 visitExpression(visitor: ExpressionVisitor, context: any): any;
181}
182export declare class WritePropExpr extends Expression {
183 receiver: Expression;
184 name: string;
185 value: Expression;
186 constructor(receiver: Expression, name: string, value: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
187 isEquivalent(e: Expression): boolean;
188 isConstant(): boolean;
189 visitExpression(visitor: ExpressionVisitor, context: any): any;
190}
191export declare enum BuiltinMethod {
192 ConcatArray = 0,
193 SubscribeObservable = 1,
194 Bind = 2
195}
196export declare class InvokeMethodExpr extends Expression {
197 receiver: Expression;
198 args: Expression[];
199 name: string | null;
200 builtin: BuiltinMethod | null;
201 constructor(receiver: Expression, method: string | BuiltinMethod, args: Expression[], type?: Type | null, sourceSpan?: ParseSourceSpan | null);
202 isEquivalent(e: Expression): boolean;
203 isConstant(): boolean;
204 visitExpression(visitor: ExpressionVisitor, context: any): any;
205}
206export declare class InvokeFunctionExpr extends Expression {
207 fn: Expression;
208 args: Expression[];
209 pure: boolean;
210 constructor(fn: Expression, args: Expression[], type?: Type | null, sourceSpan?: ParseSourceSpan | null, pure?: boolean);
211 isEquivalent(e: Expression): boolean;
212 isConstant(): boolean;
213 visitExpression(visitor: ExpressionVisitor, context: any): any;
214}
215export declare class TaggedTemplateExpr extends Expression {
216 tag: Expression;
217 template: TemplateLiteral;
218 constructor(tag: Expression, template: TemplateLiteral, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
219 isEquivalent(e: Expression): boolean;
220 isConstant(): boolean;
221 visitExpression(visitor: ExpressionVisitor, context: any): any;
222}
223export declare class InstantiateExpr extends Expression {
224 classExpr: Expression;
225 args: Expression[];
226 constructor(classExpr: Expression, args: Expression[], type?: Type | null, sourceSpan?: ParseSourceSpan | null);
227 isEquivalent(e: Expression): boolean;
228 isConstant(): boolean;
229 visitExpression(visitor: ExpressionVisitor, context: any): any;
230}
231export declare class LiteralExpr extends Expression {
232 value: number | string | boolean | null | undefined;
233 constructor(value: number | string | boolean | null | undefined, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
234 isEquivalent(e: Expression): boolean;
235 isConstant(): boolean;
236 visitExpression(visitor: ExpressionVisitor, context: any): any;
237}
238export declare class TemplateLiteral {
239 elements: TemplateLiteralElement[];
240 expressions: Expression[];
241 constructor(elements: TemplateLiteralElement[], expressions: Expression[]);
242}
243export declare class TemplateLiteralElement {
244 text: string;
245 sourceSpan?: ParseSourceSpan | undefined;
246 rawText: string;
247 constructor(text: string, sourceSpan?: ParseSourceSpan | undefined, rawText?: string);
248}
249export declare abstract class MessagePiece {
250 text: string;
251 sourceSpan: ParseSourceSpan;
252 constructor(text: string, sourceSpan: ParseSourceSpan);
253}
254export declare class LiteralPiece extends MessagePiece {
255}
256export declare class PlaceholderPiece extends MessagePiece {
257}
258export declare class LocalizedString extends Expression {
259 readonly metaBlock: I18nMeta;
260 readonly messageParts: LiteralPiece[];
261 readonly placeHolderNames: PlaceholderPiece[];
262 readonly expressions: Expression[];
263 constructor(metaBlock: I18nMeta, messageParts: LiteralPiece[], placeHolderNames: PlaceholderPiece[], expressions: Expression[], sourceSpan?: ParseSourceSpan | null);
264 isEquivalent(e: Expression): boolean;
265 isConstant(): boolean;
266 visitExpression(visitor: ExpressionVisitor, context: any): any;
267 /**
268 * Serialize the given `meta` and `messagePart` into "cooked" and "raw" strings that can be used
269 * in a `$localize` tagged string. The format of the metadata is the same as that parsed by
270 * `parseI18nMeta()`.
271 *
272 * @param meta The metadata to serialize
273 * @param messagePart The first part of the tagged string
274 */
275 serializeI18nHead(): CookedRawString;
276 getMessagePartSourceSpan(i: number): ParseSourceSpan | null;
277 getPlaceholderSourceSpan(i: number): ParseSourceSpan;
278 /**
279 * Serialize the given `placeholderName` and `messagePart` into "cooked" and "raw" strings that
280 * can be used in a `$localize` tagged string.
281 *
282 * @param placeholderName The placeholder name to serialize
283 * @param messagePart The following message string after this placeholder
284 */
285 serializeI18nTemplatePart(partIndex: number): CookedRawString;
286}
287/**
288 * A structure to hold the cooked and raw strings of a template literal element, along with its
289 * source-span range.
290 */
291export interface CookedRawString {
292 cooked: string;
293 raw: string;
294 range: ParseSourceSpan | null;
295}
296export declare class ExternalExpr extends Expression {
297 value: ExternalReference;
298 typeParams: Type[] | null;
299 constructor(value: ExternalReference, type?: Type | null, typeParams?: Type[] | null, sourceSpan?: ParseSourceSpan | null);
300 isEquivalent(e: Expression): boolean;
301 isConstant(): boolean;
302 visitExpression(visitor: ExpressionVisitor, context: any): any;
303}
304export declare class ExternalReference {
305 moduleName: string | null;
306 name: string | null;
307 runtime?: any;
308 constructor(moduleName: string | null, name: string | null, runtime?: any);
309}
310export declare class ConditionalExpr extends Expression {
311 condition: Expression;
312 falseCase: Expression | null;
313 trueCase: Expression;
314 constructor(condition: Expression, trueCase: Expression, falseCase?: Expression | null, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
315 isEquivalent(e: Expression): boolean;
316 isConstant(): boolean;
317 visitExpression(visitor: ExpressionVisitor, context: any): any;
318}
319export declare class NotExpr extends Expression {
320 condition: Expression;
321 constructor(condition: Expression, sourceSpan?: ParseSourceSpan | null);
322 isEquivalent(e: Expression): boolean;
323 isConstant(): boolean;
324 visitExpression(visitor: ExpressionVisitor, context: any): any;
325}
326export declare class AssertNotNull extends Expression {
327 condition: Expression;
328 constructor(condition: Expression, sourceSpan?: ParseSourceSpan | null);
329 isEquivalent(e: Expression): boolean;
330 isConstant(): boolean;
331 visitExpression(visitor: ExpressionVisitor, context: any): any;
332}
333export declare class CastExpr extends Expression {
334 value: Expression;
335 constructor(value: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
336 isEquivalent(e: Expression): boolean;
337 isConstant(): boolean;
338 visitExpression(visitor: ExpressionVisitor, context: any): any;
339}
340export declare class FnParam {
341 name: string;
342 type: Type | null;
343 constructor(name: string, type?: Type | null);
344 isEquivalent(param: FnParam): boolean;
345}
346export declare class FunctionExpr extends Expression {
347 params: FnParam[];
348 statements: Statement[];
349 name?: string | null | undefined;
350 constructor(params: FnParam[], statements: Statement[], type?: Type | null, sourceSpan?: ParseSourceSpan | null, name?: string | null | undefined);
351 isEquivalent(e: Expression): boolean;
352 isConstant(): boolean;
353 visitExpression(visitor: ExpressionVisitor, context: any): any;
354 toDeclStmt(name: string, modifiers?: StmtModifier[]): DeclareFunctionStmt;
355}
356export declare class UnaryOperatorExpr extends Expression {
357 operator: UnaryOperator;
358 expr: Expression;
359 parens: boolean;
360 constructor(operator: UnaryOperator, expr: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null, parens?: boolean);
361 isEquivalent(e: Expression): boolean;
362 isConstant(): boolean;
363 visitExpression(visitor: ExpressionVisitor, context: any): any;
364}
365export declare class BinaryOperatorExpr extends Expression {
366 operator: BinaryOperator;
367 rhs: Expression;
368 parens: boolean;
369 lhs: Expression;
370 constructor(operator: BinaryOperator, lhs: Expression, rhs: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null, parens?: boolean);
371 isEquivalent(e: Expression): boolean;
372 isConstant(): boolean;
373 visitExpression(visitor: ExpressionVisitor, context: any): any;
374}
375export declare class ReadPropExpr extends Expression {
376 receiver: Expression;
377 name: string;
378 constructor(receiver: Expression, name: string, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
379 isEquivalent(e: Expression): boolean;
380 isConstant(): boolean;
381 visitExpression(visitor: ExpressionVisitor, context: any): any;
382 set(value: Expression): WritePropExpr;
383}
384export declare class ReadKeyExpr extends Expression {
385 receiver: Expression;
386 index: Expression;
387 constructor(receiver: Expression, index: Expression, type?: Type | null, sourceSpan?: ParseSourceSpan | null);
388 isEquivalent(e: Expression): boolean;
389 isConstant(): boolean;
390 visitExpression(visitor: ExpressionVisitor, context: any): any;
391 set(value: Expression): WriteKeyExpr;
392}
393export declare class LiteralArrayExpr extends Expression {
394 entries: Expression[];
395 constructor(entries: Expression[], type?: Type | null, sourceSpan?: ParseSourceSpan | null);
396 isConstant(): boolean;
397 isEquivalent(e: Expression): boolean;
398 visitExpression(visitor: ExpressionVisitor, context: any): any;
399}
400export declare class LiteralMapEntry {
401 key: string;
402 value: Expression;
403 quoted: boolean;
404 constructor(key: string, value: Expression, quoted: boolean);
405 isEquivalent(e: LiteralMapEntry): boolean;
406}
407export declare class LiteralMapExpr extends Expression {
408 entries: LiteralMapEntry[];
409 valueType: Type | null;
410 constructor(entries: LiteralMapEntry[], type?: MapType | null, sourceSpan?: ParseSourceSpan | null);
411 isEquivalent(e: Expression): boolean;
412 isConstant(): boolean;
413 visitExpression(visitor: ExpressionVisitor, context: any): any;
414}
415export declare class CommaExpr extends Expression {
416 parts: Expression[];
417 constructor(parts: Expression[], sourceSpan?: ParseSourceSpan | null);
418 isEquivalent(e: Expression): boolean;
419 isConstant(): boolean;
420 visitExpression(visitor: ExpressionVisitor, context: any): any;
421}
422export interface ExpressionVisitor {
423 visitReadVarExpr(ast: ReadVarExpr, context: any): any;
424 visitWriteVarExpr(expr: WriteVarExpr, context: any): any;
425 visitWriteKeyExpr(expr: WriteKeyExpr, context: any): any;
426 visitWritePropExpr(expr: WritePropExpr, context: any): any;
427 visitInvokeMethodExpr(ast: InvokeMethodExpr, context: any): any;
428 visitInvokeFunctionExpr(ast: InvokeFunctionExpr, context: any): any;
429 visitTaggedTemplateExpr(ast: TaggedTemplateExpr, context: any): any;
430 visitInstantiateExpr(ast: InstantiateExpr, context: any): any;
431 visitLiteralExpr(ast: LiteralExpr, context: any): any;
432 visitLocalizedString(ast: LocalizedString, context: any): any;
433 visitExternalExpr(ast: ExternalExpr, context: any): any;
434 visitConditionalExpr(ast: ConditionalExpr, context: any): any;
435 visitNotExpr(ast: NotExpr, context: any): any;
436 visitAssertNotNullExpr(ast: AssertNotNull, context: any): any;
437 visitCastExpr(ast: CastExpr, context: any): any;
438 visitFunctionExpr(ast: FunctionExpr, context: any): any;
439 visitUnaryOperatorExpr(ast: UnaryOperatorExpr, context: any): any;
440 visitBinaryOperatorExpr(ast: BinaryOperatorExpr, context: any): any;
441 visitReadPropExpr(ast: ReadPropExpr, context: any): any;
442 visitReadKeyExpr(ast: ReadKeyExpr, context: any): any;
443 visitLiteralArrayExpr(ast: LiteralArrayExpr, context: any): any;
444 visitLiteralMapExpr(ast: LiteralMapExpr, context: any): any;
445 visitCommaExpr(ast: CommaExpr, context: any): any;
446 visitWrappedNodeExpr(ast: WrappedNodeExpr<any>, context: any): any;
447 visitTypeofExpr(ast: TypeofExpr, context: any): any;
448}
449export declare const THIS_EXPR: ReadVarExpr;
450export declare const SUPER_EXPR: ReadVarExpr;
451export declare const CATCH_ERROR_VAR: ReadVarExpr;
452export declare const CATCH_STACK_VAR: ReadVarExpr;
453export declare const NULL_EXPR: LiteralExpr;
454export declare const TYPED_NULL_EXPR: LiteralExpr;
455export declare enum StmtModifier {
456 Final = 0,
457 Private = 1,
458 Exported = 2,
459 Static = 3
460}
461export declare class LeadingComment {
462 text: string;
463 multiline: boolean;
464 trailingNewline: boolean;
465 constructor(text: string, multiline: boolean, trailingNewline: boolean);
466 toString(): string;
467}
468export declare class JSDocComment extends LeadingComment {
469 tags: JSDocTag[];
470 constructor(tags: JSDocTag[]);
471 toString(): string;
472}
473export declare abstract class Statement {
474 modifiers: StmtModifier[];
475 sourceSpan: ParseSourceSpan | null;
476 leadingComments?: LeadingComment[] | undefined;
477 constructor(modifiers?: StmtModifier[], sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[] | undefined);
478 /**
479 * Calculates whether this statement produces the same value as the given statement.
480 * Note: We don't check Types nor ParseSourceSpans nor function arguments.
481 */
482 abstract isEquivalent(stmt: Statement): boolean;
483 abstract visitStatement(visitor: StatementVisitor, context: any): any;
484 hasModifier(modifier: StmtModifier): boolean;
485 addLeadingComment(leadingComment: LeadingComment): void;
486}
487export declare class DeclareVarStmt extends Statement {
488 name: string;
489 value?: Expression | undefined;
490 type: Type | null;
491 constructor(name: string, value?: Expression | undefined, type?: Type | null, modifiers?: StmtModifier[], sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[]);
492 isEquivalent(stmt: Statement): boolean;
493 visitStatement(visitor: StatementVisitor, context: any): any;
494}
495export declare class DeclareFunctionStmt extends Statement {
496 name: string;
497 params: FnParam[];
498 statements: Statement[];
499 type: Type | null;
500 constructor(name: string, params: FnParam[], statements: Statement[], type?: Type | null, modifiers?: StmtModifier[], sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[]);
501 isEquivalent(stmt: Statement): boolean;
502 visitStatement(visitor: StatementVisitor, context: any): any;
503}
504export declare class ExpressionStatement extends Statement {
505 expr: Expression;
506 constructor(expr: Expression, sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[]);
507 isEquivalent(stmt: Statement): boolean;
508 visitStatement(visitor: StatementVisitor, context: any): any;
509}
510export declare class ReturnStatement extends Statement {
511 value: Expression;
512 constructor(value: Expression, sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[]);
513 isEquivalent(stmt: Statement): boolean;
514 visitStatement(visitor: StatementVisitor, context: any): any;
515}
516export declare class AbstractClassPart {
517 type: Type | null;
518 modifiers: StmtModifier[];
519 constructor(type?: Type | null, modifiers?: StmtModifier[]);
520 hasModifier(modifier: StmtModifier): boolean;
521}
522export declare class ClassField extends AbstractClassPart {
523 name: string;
524 initializer?: Expression | undefined;
525 constructor(name: string, type?: Type | null, modifiers?: StmtModifier[], initializer?: Expression | undefined);
526 isEquivalent(f: ClassField): boolean;
527}
528export declare class ClassMethod extends AbstractClassPart {
529 name: string | null;
530 params: FnParam[];
531 body: Statement[];
532 constructor(name: string | null, params: FnParam[], body: Statement[], type?: Type | null, modifiers?: StmtModifier[]);
533 isEquivalent(m: ClassMethod): boolean;
534}
535export declare class ClassGetter extends AbstractClassPart {
536 name: string;
537 body: Statement[];
538 constructor(name: string, body: Statement[], type?: Type | null, modifiers?: StmtModifier[]);
539 isEquivalent(m: ClassGetter): boolean;
540}
541export declare class ClassStmt extends Statement {
542 name: string;
543 parent: Expression | null;
544 fields: ClassField[];
545 getters: ClassGetter[];
546 constructorMethod: ClassMethod;
547 methods: ClassMethod[];
548 constructor(name: string, parent: Expression | null, fields: ClassField[], getters: ClassGetter[], constructorMethod: ClassMethod, methods: ClassMethod[], modifiers?: StmtModifier[], sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[]);
549 isEquivalent(stmt: Statement): boolean;
550 visitStatement(visitor: StatementVisitor, context: any): any;
551}
552export declare class IfStmt extends Statement {
553 condition: Expression;
554 trueCase: Statement[];
555 falseCase: Statement[];
556 constructor(condition: Expression, trueCase: Statement[], falseCase?: Statement[], sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[]);
557 isEquivalent(stmt: Statement): boolean;
558 visitStatement(visitor: StatementVisitor, context: any): any;
559}
560export declare class TryCatchStmt extends Statement {
561 bodyStmts: Statement[];
562 catchStmts: Statement[];
563 constructor(bodyStmts: Statement[], catchStmts: Statement[], sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[]);
564 isEquivalent(stmt: Statement): boolean;
565 visitStatement(visitor: StatementVisitor, context: any): any;
566}
567export declare class ThrowStmt extends Statement {
568 error: Expression;
569 constructor(error: Expression, sourceSpan?: ParseSourceSpan | null, leadingComments?: LeadingComment[]);
570 isEquivalent(stmt: ThrowStmt): boolean;
571 visitStatement(visitor: StatementVisitor, context: any): any;
572}
573export interface StatementVisitor {
574 visitDeclareVarStmt(stmt: DeclareVarStmt, context: any): any;
575 visitDeclareFunctionStmt(stmt: DeclareFunctionStmt, context: any): any;
576 visitExpressionStmt(stmt: ExpressionStatement, context: any): any;
577 visitReturnStmt(stmt: ReturnStatement, context: any): any;
578 visitDeclareClassStmt(stmt: ClassStmt, context: any): any;
579 visitIfStmt(stmt: IfStmt, context: any): any;
580 visitTryCatchStmt(stmt: TryCatchStmt, context: any): any;
581 visitThrowStmt(stmt: ThrowStmt, context: any): any;
582}
583export declare class AstTransformer implements StatementVisitor, ExpressionVisitor {
584 transformExpr(expr: Expression, context: any): Expression;
585 transformStmt(stmt: Statement, context: any): Statement;
586 visitReadVarExpr(ast: ReadVarExpr, context: any): any;
587 visitWrappedNodeExpr(ast: WrappedNodeExpr<any>, context: any): any;
588 visitTypeofExpr(expr: TypeofExpr, context: any): any;
589 visitWriteVarExpr(expr: WriteVarExpr, context: any): any;
590 visitWriteKeyExpr(expr: WriteKeyExpr, context: any): any;
591 visitWritePropExpr(expr: WritePropExpr, context: any): any;
592 visitInvokeMethodExpr(ast: InvokeMethodExpr, context: any): any;
593 visitInvokeFunctionExpr(ast: InvokeFunctionExpr, context: any): any;
594 visitTaggedTemplateExpr(ast: TaggedTemplateExpr, context: any): any;
595 visitInstantiateExpr(ast: InstantiateExpr, context: any): any;
596 visitLiteralExpr(ast: LiteralExpr, context: any): any;
597 visitLocalizedString(ast: LocalizedString, context: any): any;
598 visitExternalExpr(ast: ExternalExpr, context: any): any;
599 visitConditionalExpr(ast: ConditionalExpr, context: any): any;
600 visitNotExpr(ast: NotExpr, context: any): any;
601 visitAssertNotNullExpr(ast: AssertNotNull, context: any): any;
602 visitCastExpr(ast: CastExpr, context: any): any;
603 visitFunctionExpr(ast: FunctionExpr, context: any): any;
604 visitUnaryOperatorExpr(ast: UnaryOperatorExpr, context: any): any;
605 visitBinaryOperatorExpr(ast: BinaryOperatorExpr, context: any): any;
606 visitReadPropExpr(ast: ReadPropExpr, context: any): any;
607 visitReadKeyExpr(ast: ReadKeyExpr, context: any): any;
608 visitLiteralArrayExpr(ast: LiteralArrayExpr, context: any): any;
609 visitLiteralMapExpr(ast: LiteralMapExpr, context: any): any;
610 visitCommaExpr(ast: CommaExpr, context: any): any;
611 visitAllExpressions<T extends Expression>(exprs: T[], context: any): T[];
612 visitDeclareVarStmt(stmt: DeclareVarStmt, context: any): any;
613 visitDeclareFunctionStmt(stmt: DeclareFunctionStmt, context: any): any;
614 visitExpressionStmt(stmt: ExpressionStatement, context: any): any;
615 visitReturnStmt(stmt: ReturnStatement, context: any): any;
616 visitDeclareClassStmt(stmt: ClassStmt, context: any): any;
617 visitIfStmt(stmt: IfStmt, context: any): any;
618 visitTryCatchStmt(stmt: TryCatchStmt, context: any): any;
619 visitThrowStmt(stmt: ThrowStmt, context: any): any;
620 visitAllStatements(stmts: Statement[], context: any): Statement[];
621}
622export declare class RecursiveAstVisitor implements StatementVisitor, ExpressionVisitor {
623 visitType(ast: Type, context: any): any;
624 visitExpression(ast: Expression, context: any): any;
625 visitBuiltinType(type: BuiltinType, context: any): any;
626 visitExpressionType(type: ExpressionType, context: any): any;
627 visitArrayType(type: ArrayType, context: any): any;
628 visitMapType(type: MapType, context: any): any;
629 visitWrappedNodeExpr(ast: WrappedNodeExpr<any>, context: any): any;
630 visitTypeofExpr(ast: TypeofExpr, context: any): any;
631 visitReadVarExpr(ast: ReadVarExpr, context: any): any;
632 visitWriteVarExpr(ast: WriteVarExpr, context: any): any;
633 visitWriteKeyExpr(ast: WriteKeyExpr, context: any): any;
634 visitWritePropExpr(ast: WritePropExpr, context: any): any;
635 visitInvokeMethodExpr(ast: InvokeMethodExpr, context: any): any;
636 visitInvokeFunctionExpr(ast: InvokeFunctionExpr, context: any): any;
637 visitTaggedTemplateExpr(ast: TaggedTemplateExpr, context: any): any;
638 visitInstantiateExpr(ast: InstantiateExpr, context: any): any;
639 visitLiteralExpr(ast: LiteralExpr, context: any): any;
640 visitLocalizedString(ast: LocalizedString, context: any): any;
641 visitExternalExpr(ast: ExternalExpr, context: any): any;
642 visitConditionalExpr(ast: ConditionalExpr, context: any): any;
643 visitNotExpr(ast: NotExpr, context: any): any;
644 visitAssertNotNullExpr(ast: AssertNotNull, context: any): any;
645 visitCastExpr(ast: CastExpr, context: any): any;
646 visitFunctionExpr(ast: FunctionExpr, context: any): any;
647 visitUnaryOperatorExpr(ast: UnaryOperatorExpr, context: any): any;
648 visitBinaryOperatorExpr(ast: BinaryOperatorExpr, context: any): any;
649 visitReadPropExpr(ast: ReadPropExpr, context: any): any;
650 visitReadKeyExpr(ast: ReadKeyExpr, context: any): any;
651 visitLiteralArrayExpr(ast: LiteralArrayExpr, context: any): any;
652 visitLiteralMapExpr(ast: LiteralMapExpr, context: any): any;
653 visitCommaExpr(ast: CommaExpr, context: any): any;
654 visitAllExpressions(exprs: Expression[], context: any): void;
655 visitDeclareVarStmt(stmt: DeclareVarStmt, context: any): any;
656 visitDeclareFunctionStmt(stmt: DeclareFunctionStmt, context: any): any;
657 visitExpressionStmt(stmt: ExpressionStatement, context: any): any;
658 visitReturnStmt(stmt: ReturnStatement, context: any): any;
659 visitDeclareClassStmt(stmt: ClassStmt, context: any): any;
660 visitIfStmt(stmt: IfStmt, context: any): any;
661 visitTryCatchStmt(stmt: TryCatchStmt, context: any): any;
662 visitThrowStmt(stmt: ThrowStmt, context: any): any;
663 visitAllStatements(stmts: Statement[], context: any): void;
664}
665export declare function findReadVarNames(stmts: Statement[]): Set<string>;
666export declare function collectExternalReferences(stmts: Statement[]): ExternalReference[];
667export declare function applySourceSpanToStatementIfNeeded(stmt: Statement, sourceSpan: ParseSourceSpan | null): Statement;
668export declare function applySourceSpanToExpressionIfNeeded(expr: Expression, sourceSpan: ParseSourceSpan | null): Expression;
669export declare function leadingComment(text: string, multiline?: boolean, trailingNewline?: boolean): LeadingComment;
670export declare function jsDocComment(tags?: JSDocTag[]): JSDocComment;
671export declare function variable(name: string, type?: Type | null, sourceSpan?: ParseSourceSpan | null): ReadVarExpr;
672export declare function importExpr(id: ExternalReference, typeParams?: Type[] | null, sourceSpan?: ParseSourceSpan | null): ExternalExpr;
673export declare function importType(id: ExternalReference, typeParams?: Type[] | null, typeModifiers?: TypeModifier[]): ExpressionType | null;
674export declare function expressionType(expr: Expression, typeModifiers?: TypeModifier[], typeParams?: Type[] | null): ExpressionType;
675export declare function typeofExpr(expr: Expression): TypeofExpr;
676export declare function literalArr(values: Expression[], type?: Type | null, sourceSpan?: ParseSourceSpan | null): LiteralArrayExpr;
677export declare function literalMap(values: {
678 key: string;
679 quoted: boolean;
680 value: Expression;
681}[], type?: MapType | null): LiteralMapExpr;
682export declare function unary(operator: UnaryOperator, expr: Expression, type?: Type, sourceSpan?: ParseSourceSpan | null): UnaryOperatorExpr;
683export declare function not(expr: Expression, sourceSpan?: ParseSourceSpan | null): NotExpr;
684export declare function assertNotNull(expr: Expression, sourceSpan?: ParseSourceSpan | null): AssertNotNull;
685export declare function fn(params: FnParam[], body: Statement[], type?: Type | null, sourceSpan?: ParseSourceSpan | null, name?: string | null): FunctionExpr;
686export declare function ifStmt(condition: Expression, thenClause: Statement[], elseClause?: Statement[], sourceSpan?: ParseSourceSpan, leadingComments?: LeadingComment[]): IfStmt;
687export declare function taggedTemplate(tag: Expression, template: TemplateLiteral, type?: Type | null, sourceSpan?: ParseSourceSpan | null): TaggedTemplateExpr;
688export declare function literal(value: any, type?: Type | null, sourceSpan?: ParseSourceSpan | null): LiteralExpr;
689export declare function localizedString(metaBlock: I18nMeta, messageParts: LiteralPiece[], placeholderNames: PlaceholderPiece[], expressions: Expression[], sourceSpan?: ParseSourceSpan | null): LocalizedString;
690export declare function isNull(exp: Expression): boolean;
691export declare const enum JSDocTagName {
692 Desc = "desc",
693 Id = "id",
694 Meaning = "meaning"
695}
696export declare type JSDocTag = {
697 tagName: JSDocTagName | string;
698 text?: string;
699} | {
700 tagName?: undefined;
701 text: string;
702};
Note: See TracBrowser for help on using the repository browser.