UNPKG

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