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 * as cdAst from '../expression_parser/ast';
|
---|
9 | import * as o from '../output/output_ast';
|
---|
10 | import { ParseSourceSpan } from '../parse_util';
|
---|
11 | export declare class EventHandlerVars {
|
---|
12 | static event: o.ReadVarExpr;
|
---|
13 | }
|
---|
14 | export interface LocalResolver {
|
---|
15 | getLocal(name: string): o.Expression | null;
|
---|
16 | notifyImplicitReceiverUse(): void;
|
---|
17 | globals?: Set<string>;
|
---|
18 | maybeRestoreView(): void;
|
---|
19 | }
|
---|
20 | export declare class ConvertActionBindingResult {
|
---|
21 | /**
|
---|
22 | * Render2 compatible statements,
|
---|
23 | */
|
---|
24 | stmts: o.Statement[];
|
---|
25 | /**
|
---|
26 | * Variable name used with render2 compatible statements.
|
---|
27 | */
|
---|
28 | allowDefault: o.ReadVarExpr;
|
---|
29 | /**
|
---|
30 | * Store statements which are render3 compatible.
|
---|
31 | */
|
---|
32 | render3Stmts: o.Statement[];
|
---|
33 | constructor(
|
---|
34 | /**
|
---|
35 | * Render2 compatible statements,
|
---|
36 | */
|
---|
37 | stmts: o.Statement[],
|
---|
38 | /**
|
---|
39 | * Variable name used with render2 compatible statements.
|
---|
40 | */
|
---|
41 | allowDefault: o.ReadVarExpr);
|
---|
42 | }
|
---|
43 | export declare type InterpolationFunction = (args: o.Expression[]) => o.Expression;
|
---|
44 | /**
|
---|
45 | * Converts the given expression AST into an executable output AST, assuming the expression is
|
---|
46 | * used in an action binding (e.g. an event handler).
|
---|
47 | */
|
---|
48 | export declare function convertActionBinding(localResolver: LocalResolver | null, implicitReceiver: o.Expression, action: cdAst.AST, bindingId: string, interpolationFunction?: InterpolationFunction, baseSourceSpan?: ParseSourceSpan, implicitReceiverAccesses?: Set<string>, globals?: Set<string>): ConvertActionBindingResult;
|
---|
49 | export interface BuiltinConverter {
|
---|
50 | (args: o.Expression[]): o.Expression;
|
---|
51 | }
|
---|
52 | export interface BuiltinConverterFactory {
|
---|
53 | createLiteralArrayConverter(argCount: number): BuiltinConverter;
|
---|
54 | createLiteralMapConverter(keys: {
|
---|
55 | key: string;
|
---|
56 | quoted: boolean;
|
---|
57 | }[]): BuiltinConverter;
|
---|
58 | createPipeConverter(name: string, argCount: number): BuiltinConverter;
|
---|
59 | }
|
---|
60 | export declare function convertPropertyBindingBuiltins(converterFactory: BuiltinConverterFactory, ast: cdAst.AST): cdAst.AST;
|
---|
61 | export declare class ConvertPropertyBindingResult {
|
---|
62 | stmts: o.Statement[];
|
---|
63 | currValExpr: o.Expression;
|
---|
64 | constructor(stmts: o.Statement[], currValExpr: o.Expression);
|
---|
65 | }
|
---|
66 | export declare enum BindingForm {
|
---|
67 | General = 0,
|
---|
68 | TrySimple = 1,
|
---|
69 | Expression = 2
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Converts the given expression AST into an executable output AST, assuming the expression
|
---|
73 | * is used in property binding. The expression has to be preprocessed via
|
---|
74 | * `convertPropertyBindingBuiltins`.
|
---|
75 | */
|
---|
76 | export declare function convertPropertyBinding(localResolver: LocalResolver | null, implicitReceiver: o.Expression, expressionWithoutBuiltins: cdAst.AST, bindingId: string, form: BindingForm, interpolationFunction?: InterpolationFunction): ConvertPropertyBindingResult;
|
---|
77 | /**
|
---|
78 | * Given some expression, such as a binding or interpolation expression, and a context expression to
|
---|
79 | * look values up on, visit each facet of the given expression resolving values from the context
|
---|
80 | * expression such that a list of arguments can be derived from the found values that can be used as
|
---|
81 | * arguments to an external update instruction.
|
---|
82 | *
|
---|
83 | * @param localResolver The resolver to use to look up expressions by name appropriately
|
---|
84 | * @param contextVariableExpression The expression representing the context variable used to create
|
---|
85 | * the final argument expressions
|
---|
86 | * @param expressionWithArgumentsToExtract The expression to visit to figure out what values need to
|
---|
87 | * be resolved and what arguments list to build.
|
---|
88 | * @param bindingId A name prefix used to create temporary variable names if they're needed for the
|
---|
89 | * arguments generated
|
---|
90 | * @returns An array of expressions that can be passed as arguments to instruction expressions like
|
---|
91 | * `o.importExpr(R3.propertyInterpolate).callFn(result)`
|
---|
92 | */
|
---|
93 | export declare function convertUpdateArguments(localResolver: LocalResolver, contextVariableExpression: o.Expression, expressionWithArgumentsToExtract: cdAst.AST, bindingId: string): {
|
---|
94 | stmts: o.Statement[];
|
---|
95 | args: o.Expression[];
|
---|
96 | };
|
---|
97 | export declare class BuiltinFunctionCall extends cdAst.FunctionCall {
|
---|
98 | converter: BuiltinConverter;
|
---|
99 | constructor(span: cdAst.ParseSpan, sourceSpan: cdAst.AbsoluteSourceSpan, args: cdAst.AST[], converter: BuiltinConverter);
|
---|
100 | }
|
---|