xmlui 0.8.6 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apiInterceptorWorker-fLBfPj2T.mjs → apiInterceptorWorker-230V_-Ds.mjs} +1 -1
- package/dist/{index-wd8FRzuM.mjs → index-DUwwx3L4.mjs} +5864 -6108
- package/dist/index.css +274 -301
- package/dist/language-server.mjs +25 -1
- package/dist/{lint-B18Ko6Sy.mjs → lint-gX2osbkz.mjs} +920 -1120
- package/dist/scripts/bin/build.js +2 -2
- package/dist/scripts/bin/start.js +3 -9
- package/dist/scripts/bin/vite-xmlui-plugin.js +2 -2
- package/dist/scripts/bin/viteConfig.js +89 -63
- package/dist/scripts/src/abstractions/scripting/ScriptingSourceTreeExp.js +1 -2
- package/dist/scripts/src/components/Accordion/Accordion.js +6 -16
- package/dist/scripts/src/components/App/AppNative.js +8 -0
- package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -5
- package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +10 -4
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +13 -19
- package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +2 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +7 -3
- package/dist/scripts/src/components/Avatar/Avatar.js +2 -9
- package/dist/scripts/src/components/Badge/Badge.js +2 -8
- package/dist/scripts/src/components/Button/Button.js +28 -60
- package/dist/scripts/src/components/Card/Card.js +1 -6
- package/dist/scripts/src/components/Checkbox/Checkbox.js +4 -12
- package/dist/scripts/src/components/ComponentProvider.js +4 -0
- package/dist/scripts/src/components/DatePicker/DatePicker.js +3 -10
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/scripts/src/components/Form/Form.js +12 -28
- package/dist/scripts/src/components/Form/FormNative.js +9 -0
- package/dist/scripts/src/components/FormItem/HelperText.js +1 -1
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +2 -2
- package/dist/scripts/src/components/Heading/HeadingNative.js +0 -1
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +4 -19
- package/dist/scripts/src/components/IconProvider.js +2 -2
- package/dist/scripts/src/components/Link/Link.js +2 -8
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +4 -4
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +1 -3
- package/dist/scripts/src/components/NavGroup/NavGroup.js +34 -3
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +24 -12
- package/dist/scripts/src/components/NavLink/NavLink.js +4 -11
- package/dist/scripts/src/components/NavPanel/NavPanel.js +1 -6
- package/dist/scripts/src/components/ProgressBar/ProgressBar.js +2 -8
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +4 -12
- package/dist/scripts/src/components/Select/Select.js +5 -13
- package/dist/scripts/src/components/Select/SelectNative.js +7 -3
- package/dist/scripts/src/components/Slider/Slider.js +2 -8
- package/dist/scripts/src/components/Spinner/Spinner.js +1 -6
- package/dist/scripts/src/components/SubNavPanel/SubNavPanel.js +22 -0
- package/dist/scripts/src/components/SubNavPanel/SubNavPanelNative.js +9 -0
- package/dist/scripts/src/components/Switch/Switch.js +6 -16
- package/dist/scripts/src/components/Table/Table.js +8 -17
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +4 -12
- package/dist/scripts/src/components/Tabs/Tabs.js +3 -10
- package/dist/scripts/src/components/Text/Text.js +10 -24
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +1 -1
- package/dist/scripts/src/components/Theme/ThemeNative.js +1 -1
- package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +3 -3
- package/dist/scripts/src/components-core/DevTools.js +5 -4
- package/dist/scripts/src/components-core/RestApiProxy.js +7 -3
- package/dist/scripts/src/components-core/action/APICall.js +2 -1
- package/dist/scripts/src/components-core/rendering/Container.js +15 -11
- package/dist/scripts/src/components-core/rendering/StateContainer.js +3 -2
- package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +0 -2
- package/dist/scripts/src/components-core/script-runner/ParameterParser.js +1 -1
- package/dist/scripts/src/components-core/script-runner/asyncProxy.js +11 -64
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +196 -175
- package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +173 -231
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +129 -100
- package/dist/scripts/src/components-core/script-runner/process-statement-async.js +170 -175
- package/dist/scripts/src/components-core/script-runner/process-statement-common.js +48 -33
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +164 -170
- package/dist/scripts/src/components-core/script-runner/statement-queue.js +5 -4
- package/dist/scripts/src/components-core/script-runner/visitors.js +124 -116
- package/dist/scripts/src/components-core/theming/themes/palette.js +1 -0
- package/dist/scripts/src/components-core/theming/themes/root.js +300 -154
- package/dist/scripts/src/components-core/theming/themes/theme-colors.js +510 -510
- package/dist/scripts/src/components-core/theming/themes/xmlui.js +0 -1
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +11 -11
- package/dist/scripts/src/components-core/utils/misc.js +13 -0
- package/dist/scripts/src/components-core/utils/statementUtils.js +56 -53
- package/dist/scripts/src/components-core/xmlui-parser.js +1 -1
- package/dist/scripts/src/parsers/scripting-exp/Lexer.js +1092 -0
- package/dist/scripts/src/parsers/scripting-exp/Parser.js +2635 -0
- package/dist/scripts/src/parsers/scripting-exp/ParserError.js +47 -0
- package/dist/scripts/src/parsers/scripting-exp/TokenTrait.js +109 -0
- package/dist/scripts/src/parsers/scripting-exp/TokenType.js +2 -4
- package/dist/scripts/src/parsers/scripting-exp/code-behind-collect.js +101 -0
- package/dist/scripts/src/parsers/scripting-exp/modules.js +107 -0
- package/dist/scripts/src/parsers/{scripting → scripting-exp}/tree-visitor.js +103 -107
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +12 -12
- package/dist/style.css +245 -286
- package/dist/xmlui-metadata.mjs +2741 -2211
- package/dist/xmlui-metadata.umd.js +2740 -2212
- package/dist/xmlui-parser.d.ts +320 -232
- package/dist/xmlui-parser.mjs +19 -19
- package/dist/xmlui-standalone.umd.js +6770 -7220
- package/dist/xmlui.d.ts +322 -230
- package/dist/xmlui.mjs +1 -1
- package/package.json +10 -6
- package/dist/_commonjsHelpers-CcAunmGO.mjs +0 -33
- package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +0 -34
- package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +0 -40
- package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +0 -40
- package/dist/scripts/src/components-core/script-runner/syncProxy.js +0 -31
- package/dist/scripts/src/parsers/scripting/code-behind-collect.js +0 -153
- package/dist/scripts/src/parsers/scripting/modules.js +0 -284
- /package/dist/scripts/src/abstractions/scripting/{LogicalThread.js → LogicalThreadExp.js} +0 -0
- /package/dist/scripts/src/abstractions/scripting/{TryScope.js → TryScopeExp.js} +0 -0
|
@@ -11,8 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.evalBindingAsync = evalBindingAsync;
|
|
13
13
|
exports.executeArrowExpression = executeArrowExpression;
|
|
14
|
-
exports.
|
|
14
|
+
exports.completeExprValue = completeExprValue;
|
|
15
15
|
const lodash_es_1 = require("lodash-es");
|
|
16
|
+
const ScriptingSourceTreeExp_1 = require("../../abstractions/scripting/ScriptingSourceTreeExp");
|
|
16
17
|
const process_statement_async_1 = require("./process-statement-async");
|
|
17
18
|
const eval_tree_common_1 = require("./eval-tree-common");
|
|
18
19
|
const process_statement_common_1 = require("./process-statement-common");
|
|
@@ -25,12 +26,14 @@ const bannedFunctions_1 = require("./bannedFunctions");
|
|
|
25
26
|
* @param thread The logical thread to use for evaluation
|
|
26
27
|
* @param onStatementCompleted Execute this function when a statement is completed
|
|
27
28
|
*/
|
|
28
|
-
function evalBindingAsync(expr, evalContext, thread
|
|
29
|
+
function evalBindingAsync(expr, evalContext, thread) {
|
|
29
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
// --- Prepare the evaluation context
|
|
30
32
|
const thisStack = [];
|
|
31
33
|
(0, process_statement_common_1.ensureMainThread)(evalContext);
|
|
32
34
|
thread !== null && thread !== void 0 ? thread : (thread = evalContext.mainThread);
|
|
33
|
-
|
|
35
|
+
// --- Evaluate the expression using the context
|
|
36
|
+
return yield evalBindingExpressionTreeAsync(thisStack, expr, evalContext, thread !== null && thread !== void 0 ? thread : evalContext.mainThread);
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
@@ -41,10 +44,10 @@ function evalBindingAsync(expr, evalContext, thread, onStatementCompleted) {
|
|
|
41
44
|
* @param thread The logical thread to use for evaluation
|
|
42
45
|
* @param args Arguments of the arrow function to execute
|
|
43
46
|
*/
|
|
44
|
-
function executeArrowExpression(expr, evalContext,
|
|
47
|
+
function executeArrowExpression(expr, evalContext, thread, ...args) {
|
|
45
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
49
|
// --- Just an extra safety check
|
|
47
|
-
if (expr.type !==
|
|
50
|
+
if (expr.type !== ScriptingSourceTreeExp_1.T_ARROW_EXPRESSION) {
|
|
48
51
|
throw new Error("executeArrowExpression expects an 'ArrowExpression' object.");
|
|
49
52
|
}
|
|
50
53
|
// --- This is the evaluator that an arrow expression uses internally
|
|
@@ -55,7 +58,7 @@ function executeArrowExpression(expr, evalContext, onStatementCompleted, thread,
|
|
|
55
58
|
// --- #1: The names of arrow function arguments
|
|
56
59
|
// --- #2: The evaluation context the arrow function runs in
|
|
57
60
|
// --- #others: The real arguments of the arrow function
|
|
58
|
-
return yield nativeFunction(expr.args, evalContext, thread !== null && thread !== void 0 ? thread : evalContext.mainThread,
|
|
61
|
+
return yield nativeFunction(expr.args, evalContext, thread !== null && thread !== void 0 ? thread : evalContext.mainThread, ...args);
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
64
|
/**
|
|
@@ -69,52 +72,49 @@ function executeArrowExpression(expr, evalContext, onStatementCompleted, thread,
|
|
|
69
72
|
* We use `thisStack` to keep track of the partial results of the evaluation tree so that we can set
|
|
70
73
|
* the real `this` context when invoking a function.
|
|
71
74
|
*/
|
|
72
|
-
function evalBindingExpressionTreeAsync(thisStack, expr, evalContext, thread
|
|
75
|
+
function evalBindingExpressionTreeAsync(thisStack, expr, evalContext, thread) {
|
|
73
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
77
|
if (!evalContext.options) {
|
|
75
78
|
evalContext.options = { defaultToOptionalMemberAccess: true };
|
|
76
79
|
}
|
|
77
80
|
// --- Prepare evaluation
|
|
78
|
-
let customOp = null;
|
|
79
81
|
const evaluator = evalBindingExpressionTreeAsync;
|
|
80
|
-
// --- Reset the expression scope
|
|
81
|
-
expr.valueScope = expr.valueIndex = undefined;
|
|
82
82
|
// --- Process the expression according to its type
|
|
83
83
|
try {
|
|
84
84
|
switch (expr.type) {
|
|
85
|
-
case
|
|
86
|
-
return evalTemplateLiteralAsync(evaluator, thisStack, expr, evalContext, thread
|
|
87
|
-
case
|
|
88
|
-
return (0, eval_tree_common_1.evalLiteral)(thisStack, expr);
|
|
89
|
-
case
|
|
85
|
+
case ScriptingSourceTreeExp_1.T_TEMPLATE_LITERAL_EXPRESSION:
|
|
86
|
+
return evalTemplateLiteralAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
87
|
+
case ScriptingSourceTreeExp_1.T_LITERAL:
|
|
88
|
+
return (0, eval_tree_common_1.evalLiteral)(thisStack, expr, thread);
|
|
89
|
+
case ScriptingSourceTreeExp_1.T_IDENTIFIER:
|
|
90
90
|
return (0, eval_tree_common_1.evalIdentifier)(thisStack, expr, evalContext, thread);
|
|
91
|
-
case
|
|
92
|
-
return yield evalMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread
|
|
93
|
-
case
|
|
94
|
-
return yield evalCalculatedMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread
|
|
95
|
-
case
|
|
96
|
-
return yield evalSequenceAsync(evaluator, thisStack, expr, evalContext, thread
|
|
97
|
-
case
|
|
98
|
-
return yield evalArrayLiteralAsync(evaluator, thisStack, expr, evalContext, thread
|
|
99
|
-
case
|
|
100
|
-
return yield evalObjectLiteralAsync(evaluator, thisStack, expr, evalContext, thread
|
|
101
|
-
case
|
|
102
|
-
return yield evalUnaryAsync(evaluator, thisStack,
|
|
103
|
-
case
|
|
104
|
-
return yield evalBinaryAsync(evaluator, thisStack,
|
|
105
|
-
case
|
|
106
|
-
return yield evalConditionalAsync(evaluator, thisStack, expr, evalContext, thread
|
|
107
|
-
case
|
|
108
|
-
return yield evalAssignmentAsync(evaluator, thisStack, expr, evalContext, thread
|
|
109
|
-
case
|
|
110
|
-
case
|
|
111
|
-
return yield evalPreOrPostAsync(evaluator, thisStack, expr, evalContext, thread
|
|
112
|
-
case
|
|
91
|
+
case ScriptingSourceTreeExp_1.T_MEMBER_ACCESS_EXPRESSION:
|
|
92
|
+
return yield evalMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
93
|
+
case ScriptingSourceTreeExp_1.T_CALCULATED_MEMBER_ACCESS_EXPRESSION:
|
|
94
|
+
return yield evalCalculatedMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
95
|
+
case ScriptingSourceTreeExp_1.T_SEQUENCE_EXPRESSION:
|
|
96
|
+
return yield evalSequenceAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
97
|
+
case ScriptingSourceTreeExp_1.T_ARRAY_LITERAL:
|
|
98
|
+
return yield evalArrayLiteralAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
99
|
+
case ScriptingSourceTreeExp_1.T_OBJECT_LITERAL:
|
|
100
|
+
return yield evalObjectLiteralAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
101
|
+
case ScriptingSourceTreeExp_1.T_UNARY_EXPRESSION:
|
|
102
|
+
return yield evalUnaryAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
103
|
+
case ScriptingSourceTreeExp_1.T_BINARY_EXPRESSION:
|
|
104
|
+
return yield evalBinaryAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
105
|
+
case ScriptingSourceTreeExp_1.T_CONDITIONAL_EXPRESSION:
|
|
106
|
+
return yield evalConditionalAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
107
|
+
case ScriptingSourceTreeExp_1.T_ASSIGNMENT_EXPRESSION:
|
|
108
|
+
return yield evalAssignmentAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
109
|
+
case ScriptingSourceTreeExp_1.T_PREFIX_OP_EXPRESSION:
|
|
110
|
+
case ScriptingSourceTreeExp_1.T_POSTFIX_OP_EXPRESSION:
|
|
111
|
+
return yield evalPreOrPostAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
112
|
+
case ScriptingSourceTreeExp_1.T_FUNCTION_INVOCATION_EXPRESSION:
|
|
113
113
|
// --- Special async handling
|
|
114
|
-
return yield evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, thread
|
|
115
|
-
case
|
|
114
|
+
return yield evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
115
|
+
case ScriptingSourceTreeExp_1.T_ARROW_EXPRESSION:
|
|
116
116
|
return (0, eval_tree_common_1.evalArrow)(thisStack, expr, thread);
|
|
117
|
-
case
|
|
117
|
+
case ScriptingSourceTreeExp_1.T_SPREAD_EXPRESSION:
|
|
118
118
|
throw new Error("Cannot use spread expression (...) with the current intermediate value.");
|
|
119
119
|
default:
|
|
120
120
|
throw new Error(`Unknown expression tree node: ${expr.type}`);
|
|
@@ -126,66 +126,72 @@ function evalBindingExpressionTreeAsync(thisStack, expr, evalContext, thread, on
|
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function evalMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread
|
|
129
|
+
function evalMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
130
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function evalCalculatedMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread, onStatementCompleted) {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
const parentObj = yield evaluator(thisStack, expr.object, evalContext, thread, onStatementCompleted);
|
|
131
|
+
yield evaluator(thisStack, expr.obj, evalContext, thread);
|
|
132
|
+
yield completeExprValue(expr.obj, thread);
|
|
138
133
|
// --- At this point we definitely keep the parent object on `thisStack`, as it will be the context object
|
|
139
134
|
// --- of a FunctionInvocationExpression, if that follows the MemberAccess. Other operations would call
|
|
140
135
|
// --- `thisStack.pop()` to remove the result from the previous `evalBindingExpressionTree` call.
|
|
141
|
-
|
|
136
|
+
return (0, eval_tree_common_1.evalMemberAccessCore)(thisStack, expr, evalContext, thread);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function evalCalculatedMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
yield evaluator(thisStack, expr.obj, evalContext, thread);
|
|
142
|
+
yield completeExprValue(expr.obj, thread);
|
|
143
|
+
yield evaluator(thisStack, expr.member, evalContext, thread);
|
|
142
144
|
thisStack.pop();
|
|
143
|
-
|
|
145
|
+
yield completeExprValue(expr.member, thread);
|
|
146
|
+
return (0, eval_tree_common_1.evalCalculatedMemberAccessCore)(thisStack, expr, evalContext, thread);
|
|
144
147
|
});
|
|
145
148
|
}
|
|
146
|
-
function evalSequenceAsync(evaluator, thisStack, expr, evalContext, thread
|
|
149
|
+
function evalSequenceAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
147
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
-
if (!expr.
|
|
151
|
+
if (!expr.exprs || expr.exprs.length === 0) {
|
|
149
152
|
throw new Error(`Missing expression sequence`);
|
|
150
153
|
}
|
|
151
|
-
const result = expr.
|
|
152
|
-
const
|
|
154
|
+
const result = expr.exprs.map((e) => __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
const value = yield evaluator(thisStack, e, evalContext, thread);
|
|
156
|
+
(0, eval_tree_common_1.setExprValue)(e, { value }, thread);
|
|
153
157
|
thisStack.pop();
|
|
154
|
-
return
|
|
158
|
+
return value;
|
|
155
159
|
}));
|
|
156
160
|
const lastObj = result[result.length - 1];
|
|
157
161
|
thisStack.push(lastObj);
|
|
158
162
|
return lastObj;
|
|
159
163
|
});
|
|
160
164
|
}
|
|
161
|
-
function evalArrayLiteralAsync(evaluator, thisStack, expr, evalContext, thread
|
|
165
|
+
function evalArrayLiteralAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
162
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
const
|
|
167
|
+
const value = [];
|
|
164
168
|
for (const item of expr.items) {
|
|
165
|
-
if (item.type ===
|
|
166
|
-
const spreadArray = yield evaluator(thisStack, item.
|
|
169
|
+
if (item.type === ScriptingSourceTreeExp_1.T_SPREAD_EXPRESSION) {
|
|
170
|
+
const spreadArray = yield evaluator(thisStack, item.expr, evalContext, thread);
|
|
167
171
|
thisStack.pop();
|
|
168
172
|
if (!Array.isArray(spreadArray)) {
|
|
169
173
|
throw new Error("Spread operator within an array literal expects an array operand.");
|
|
170
174
|
}
|
|
171
|
-
|
|
175
|
+
value.push(...spreadArray);
|
|
172
176
|
}
|
|
173
177
|
else {
|
|
174
|
-
|
|
178
|
+
value.push(yield evaluator(thisStack, item, evalContext, thread));
|
|
175
179
|
thisStack.pop();
|
|
176
|
-
thisStack.push(
|
|
180
|
+
thisStack.push(value);
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
|
-
|
|
183
|
+
// --- Done.
|
|
184
|
+
(0, eval_tree_common_1.setExprValue)(expr, { value }, thread);
|
|
185
|
+
return value;
|
|
180
186
|
});
|
|
181
187
|
}
|
|
182
|
-
function evalObjectLiteralAsync(evaluator, thisStack, expr, evalContext, thread
|
|
188
|
+
function evalObjectLiteralAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
183
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
184
190
|
const objectHash = {};
|
|
185
191
|
for (const prop of expr.props) {
|
|
186
192
|
if (!Array.isArray(prop)) {
|
|
187
193
|
// --- We're using a spread expression
|
|
188
|
-
const spreadItems = yield evaluator(thisStack, prop.
|
|
194
|
+
const spreadItems = yield evaluator(thisStack, prop.expr, evalContext, thread);
|
|
189
195
|
thisStack.pop();
|
|
190
196
|
if (Array.isArray(spreadItems)) {
|
|
191
197
|
// --- Spread of an array
|
|
@@ -204,140 +210,160 @@ function evalObjectLiteralAsync(evaluator, thisStack, expr, evalContext, thread,
|
|
|
204
210
|
// --- We're using key/[value] pairs
|
|
205
211
|
let key;
|
|
206
212
|
switch (prop[0].type) {
|
|
207
|
-
case
|
|
213
|
+
case ScriptingSourceTreeExp_1.T_LITERAL:
|
|
208
214
|
key = prop[0].value;
|
|
209
215
|
break;
|
|
210
|
-
case
|
|
216
|
+
case ScriptingSourceTreeExp_1.T_IDENTIFIER:
|
|
211
217
|
key = prop[0].name;
|
|
212
218
|
break;
|
|
213
219
|
default:
|
|
214
|
-
key = yield evaluator(thisStack, prop[0], evalContext, thread
|
|
220
|
+
key = yield evaluator(thisStack, prop[0], evalContext, thread);
|
|
215
221
|
thisStack.pop();
|
|
216
222
|
break;
|
|
217
223
|
}
|
|
218
|
-
objectHash[key] = yield evaluator(thisStack, prop[1], evalContext, thread
|
|
224
|
+
objectHash[key] = yield evaluator(thisStack, prop[1], evalContext, thread);
|
|
219
225
|
thisStack.pop();
|
|
220
226
|
}
|
|
227
|
+
// --- Done.
|
|
228
|
+
(0, eval_tree_common_1.setExprValue)(expr, { value: objectHash }, thread);
|
|
221
229
|
thisStack.push(objectHash);
|
|
222
230
|
return objectHash;
|
|
223
231
|
});
|
|
224
232
|
}
|
|
225
|
-
function evalUnaryAsync(evaluator, thisStack,
|
|
233
|
+
function evalUnaryAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
226
234
|
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
|
|
235
|
+
yield evaluator(thisStack, expr.expr, evalContext, thread);
|
|
228
236
|
thisStack.pop();
|
|
229
|
-
|
|
237
|
+
yield completeExprValue(expr.expr, thread);
|
|
238
|
+
return (0, eval_tree_common_1.evalUnaryCore)(expr, thisStack, evalContext, thread);
|
|
230
239
|
});
|
|
231
240
|
}
|
|
232
|
-
function evalBinaryAsync(evaluator, thisStack,
|
|
241
|
+
function evalBinaryAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
233
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
-
|
|
243
|
+
yield evaluator(thisStack, expr.left, evalContext, thread);
|
|
235
244
|
thisStack.pop();
|
|
236
|
-
|
|
237
|
-
|
|
245
|
+
const l = yield completeExprValue(expr.left, thread);
|
|
246
|
+
if (expr.op === "&&" && !l) {
|
|
247
|
+
(0, eval_tree_common_1.setExprValue)(expr, { value: l }, thread);
|
|
238
248
|
return l;
|
|
239
249
|
}
|
|
240
|
-
if (expr.
|
|
241
|
-
|
|
250
|
+
if (expr.op === "||" && l) {
|
|
251
|
+
(0, eval_tree_common_1.setExprValue)(expr, { value: l }, thread);
|
|
242
252
|
return l;
|
|
243
253
|
}
|
|
244
|
-
|
|
254
|
+
yield evaluator(thisStack, expr.right, evalContext, thread);
|
|
245
255
|
thisStack.pop();
|
|
246
|
-
|
|
256
|
+
yield completeExprValue(expr.right, thread);
|
|
257
|
+
return (0, eval_tree_common_1.evalBinaryCore)(expr, thisStack, evalContext, thread);
|
|
247
258
|
});
|
|
248
259
|
}
|
|
249
|
-
function evalConditionalAsync(evaluator, thisStack, expr, evalContext, thread
|
|
260
|
+
function evalConditionalAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
250
261
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
-
|
|
262
|
+
yield evaluator(thisStack, expr.cond, evalContext, thread);
|
|
252
263
|
thisStack.pop();
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
-
const updateHook = evalContext.onUpdateHook || ((updateFn) => __awaiter(this, void 0, void 0, function* () { return yield updateFn(); }));
|
|
259
|
-
return yield updateHook(() => __awaiter(this, void 0, void 0, function* () {
|
|
260
|
-
return yield doAssignment();
|
|
261
|
-
}));
|
|
264
|
+
const condition = yield completeExprValue(expr.cond, thread);
|
|
265
|
+
const value = yield evaluator(thisStack, condition ? expr.thenE : expr.elseE, evalContext, thread);
|
|
266
|
+
(0, eval_tree_common_1.setExprValue)(expr, { value }, thread);
|
|
267
|
+
return value;
|
|
262
268
|
});
|
|
263
269
|
}
|
|
264
|
-
function evalAssignmentAsync(evaluator, thisStack, expr, evalContext, thread
|
|
270
|
+
function evalAssignmentAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
265
271
|
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
const leftValue = expr.leftValue;
|
|
273
|
+
const rootScope = (0, eval_tree_common_1.getRootIdScope)(leftValue, evalContext, thread);
|
|
274
|
+
const updatesState = rootScope && rootScope.type !== "block";
|
|
275
|
+
if (updatesState && evalContext.onWillUpdate) {
|
|
276
|
+
evalContext.onWillUpdate(rootScope, rootScope.name, "assignment");
|
|
277
|
+
}
|
|
278
|
+
yield evaluator(thisStack, leftValue, evalContext, thread);
|
|
279
|
+
thisStack.pop();
|
|
280
|
+
yield completeExprValue(leftValue, thread);
|
|
281
|
+
yield evaluator(thisStack, expr.expr, evalContext, thread);
|
|
282
|
+
thisStack.pop();
|
|
283
|
+
yield completeExprValue(expr.expr, thread);
|
|
284
|
+
const value = (0, eval_tree_common_1.evalAssignmentCore)(thisStack, expr, evalContext, thread);
|
|
285
|
+
if (updatesState && evalContext.onDidUpdate) {
|
|
286
|
+
evalContext.onDidUpdate(rootScope, rootScope.name, "assignment");
|
|
287
|
+
}
|
|
288
|
+
return value;
|
|
274
289
|
});
|
|
275
290
|
}
|
|
276
|
-
function evalPreOrPostAsync(evaluator, thisStack, expr, evalContext, thread
|
|
291
|
+
function evalPreOrPostAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
277
292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
293
|
+
const rootScope = (0, eval_tree_common_1.getRootIdScope)(expr.expr, evalContext, thread);
|
|
294
|
+
const updatesState = rootScope && rootScope.type !== "block";
|
|
295
|
+
if (updatesState && evalContext.onWillUpdate) {
|
|
296
|
+
evalContext.onWillUpdate(rootScope, rootScope.name, "pre-post");
|
|
297
|
+
}
|
|
298
|
+
yield evaluator(thisStack, expr.expr, evalContext, thread);
|
|
299
|
+
thisStack.pop();
|
|
300
|
+
yield completeExprValue(expr.expr, thread);
|
|
301
|
+
const value = (0, eval_tree_common_1.evalPreOrPostCore)(thisStack, expr, evalContext, thread);
|
|
302
|
+
if (updatesState && evalContext.onDidUpdate) {
|
|
303
|
+
evalContext.onDidUpdate(rootScope, rootScope.name, "pre-post");
|
|
304
|
+
}
|
|
305
|
+
return value;
|
|
284
306
|
});
|
|
285
307
|
}
|
|
286
|
-
function evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, thread
|
|
308
|
+
function evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
287
309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
288
310
|
var _a, _b, _c, _d;
|
|
289
311
|
let functionObj;
|
|
290
312
|
let implicitContextObject = null;
|
|
291
313
|
let hostObject;
|
|
292
314
|
// --- Check for contexted object
|
|
293
|
-
if (expr.
|
|
294
|
-
hostObject = yield evaluator(thisStack, expr.
|
|
295
|
-
|
|
296
|
-
|
|
315
|
+
if (expr.obj.type === ScriptingSourceTreeExp_1.T_MEMBER_ACCESS_EXPRESSION) {
|
|
316
|
+
hostObject = yield evaluator(thisStack, expr.obj.obj, evalContext, thread);
|
|
317
|
+
yield completeExprValue(expr.obj.obj, thread);
|
|
318
|
+
functionObj = (0, eval_tree_common_1.evalMemberAccessCore)(thisStack, expr.obj, evalContext, thread);
|
|
319
|
+
if (expr.obj.obj.type === ScriptingSourceTreeExp_1.T_IDENTIFIER && (hostObject === null || hostObject === void 0 ? void 0 : hostObject._SUPPORT_IMPLICIT_CONTEXT)) {
|
|
297
320
|
implicitContextObject = hostObject;
|
|
298
321
|
}
|
|
299
322
|
}
|
|
300
323
|
else {
|
|
301
324
|
// --- Get the object on which to invoke the function
|
|
302
|
-
|
|
325
|
+
yield evaluator(thisStack, expr.obj, evalContext, thread);
|
|
326
|
+
functionObj = yield completeExprValue(expr.obj, thread);
|
|
303
327
|
}
|
|
304
328
|
thisStack.pop();
|
|
305
329
|
// --- Keep function arguments here, we pass it to the function later
|
|
306
330
|
const functionArgs = [];
|
|
307
331
|
// --- The functionObj may be an ArrowExpression. In this care we need to create the invokable arrow function
|
|
308
332
|
if (functionObj === null || functionObj === void 0 ? void 0 : functionObj._ARROW_EXPR_) {
|
|
309
|
-
functionArgs.push(functionObj.args, evalContext, thread,
|
|
333
|
+
functionArgs.push(functionObj.args, evalContext, thread, ...expr.arguments.map((a) => (Object.assign(Object.assign({}, a), { _EXPRESSION_: true }))));
|
|
310
334
|
functionObj = yield createArrowFunctionAsync(evaluator, functionObj);
|
|
311
335
|
}
|
|
312
|
-
else if (expr.
|
|
336
|
+
else if (expr.obj.type === ScriptingSourceTreeExp_1.T_ARROW_EXPRESSION) {
|
|
313
337
|
// --- We delay evaluating expression values. We pass the argument names as the first parameter, and then
|
|
314
338
|
// --- all parameter expressions
|
|
315
|
-
functionArgs.push(expr.
|
|
339
|
+
functionArgs.push(expr.obj.args.map((a) => a.name), evalContext, thread, ...expr.arguments.map((a) => (Object.assign(Object.assign({}, a), { _EXPRESSION_: true }))));
|
|
316
340
|
}
|
|
317
341
|
else {
|
|
318
342
|
// --- We evaluate the argument values to pass to a JavaScript function
|
|
319
343
|
for (let i = 0; i < expr.arguments.length; i++) {
|
|
320
344
|
const arg = expr.arguments[i];
|
|
321
|
-
if (arg.type ===
|
|
322
|
-
|
|
345
|
+
if (arg.type === ScriptingSourceTreeExp_1.T_SPREAD_EXPRESSION) {
|
|
346
|
+
yield evaluator([], arg.expr, evalContext, thread);
|
|
347
|
+
const funcArg = yield completeExprValue(arg.expr, thread);
|
|
323
348
|
if (!Array.isArray(funcArg)) {
|
|
324
349
|
throw new Error("Spread operator within a function invocation expects an array operand.");
|
|
325
350
|
}
|
|
326
351
|
functionArgs.push(...funcArg);
|
|
327
352
|
}
|
|
328
353
|
else {
|
|
329
|
-
if (arg.type ===
|
|
354
|
+
if (arg.type === ScriptingSourceTreeExp_1.T_ARROW_EXPRESSION) {
|
|
330
355
|
const funcArg = yield createArrowFunctionAsync(evaluator, arg);
|
|
331
356
|
const wrappedFunc = (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
332
|
-
return funcArg(arg.args, evalContext, thread,
|
|
357
|
+
return funcArg(arg.args, evalContext, thread, ...args);
|
|
333
358
|
});
|
|
334
359
|
functionArgs.push(wrappedFunc);
|
|
335
360
|
}
|
|
336
361
|
else {
|
|
337
|
-
|
|
362
|
+
yield evaluator([], arg, evalContext, thread);
|
|
363
|
+
const funcArg = yield completeExprValue(arg, thread);
|
|
338
364
|
if (funcArg === null || funcArg === void 0 ? void 0 : funcArg._ARROW_EXPR_) {
|
|
339
365
|
const wrappedFuncArg = yield createArrowFunctionAsync(evaluator, funcArg);
|
|
340
|
-
const wrappedFunc = (...args) => wrappedFuncArg(funcArg.args, evalContext, thread,
|
|
366
|
+
const wrappedFunc = (...args) => wrappedFuncArg(funcArg.args, evalContext, thread, ...args);
|
|
341
367
|
functionArgs.push(wrappedFunc);
|
|
342
368
|
}
|
|
343
369
|
else {
|
|
@@ -369,17 +395,22 @@ function evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, th
|
|
|
369
395
|
// --- async arguments
|
|
370
396
|
functionObj = (0, asyncProxy_1.getAsyncProxy)(functionObj, functionArgs, currentContext);
|
|
371
397
|
// --- Now, invoke the function
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
let returnValue = yield completePromise(value);
|
|
377
|
-
thisStack.push(returnValue);
|
|
378
|
-
return returnValue;
|
|
398
|
+
const rootScope = (0, eval_tree_common_1.getRootIdScope)(expr.obj, evalContext, thread);
|
|
399
|
+
const updatesState = rootScope && rootScope.type !== "block";
|
|
400
|
+
if (updatesState && evalContext.onWillUpdate) {
|
|
401
|
+
evalContext.onWillUpdate(rootScope, rootScope.name, "function-call");
|
|
379
402
|
}
|
|
380
|
-
|
|
381
|
-
|
|
403
|
+
const value = ((_d = evalContext.options) === null || _d === void 0 ? void 0 : _d.defaultToOptionalMemberAccess)
|
|
404
|
+
? functionObj === null || functionObj === void 0 ? void 0 : functionObj.call(currentContext, ...functionArgs)
|
|
405
|
+
: functionObj.call(currentContext, ...functionArgs);
|
|
406
|
+
let returnValue = yield completePromise(value);
|
|
407
|
+
if (updatesState && evalContext.onDidUpdate) {
|
|
408
|
+
evalContext.onDidUpdate(rootScope, rootScope.name, "function-call");
|
|
382
409
|
}
|
|
410
|
+
// --- Done.
|
|
411
|
+
(0, eval_tree_common_1.setExprValue)(expr, { value: returnValue }, thread);
|
|
412
|
+
thisStack.push(returnValue);
|
|
413
|
+
return returnValue;
|
|
383
414
|
});
|
|
384
415
|
}
|
|
385
416
|
function createArrowFunctionAsync(evaluator, expr) {
|
|
@@ -390,7 +421,6 @@ function createArrowFunctionAsync(evaluator, expr) {
|
|
|
390
421
|
// --- Prepare the variables to pass
|
|
391
422
|
const runTimeEvalContext = args[1];
|
|
392
423
|
const runtimeThread = args[2];
|
|
393
|
-
const runTimeOnStatementCompleted = args[3];
|
|
394
424
|
// --- Create the thread that runs the arrow function
|
|
395
425
|
const workingThread = {
|
|
396
426
|
parent: runtimeThread,
|
|
@@ -420,27 +450,27 @@ function createArrowFunctionAsync(evaluator, expr) {
|
|
|
420
450
|
const argSpec = argSpecs[i];
|
|
421
451
|
let decl;
|
|
422
452
|
switch (argSpec.type) {
|
|
423
|
-
case
|
|
453
|
+
case ScriptingSourceTreeExp_1.T_IDENTIFIER: {
|
|
424
454
|
decl = {
|
|
425
|
-
type:
|
|
455
|
+
type: ScriptingSourceTreeExp_1.T_VAR_DECLARATION,
|
|
426
456
|
id: argSpec.name,
|
|
427
457
|
};
|
|
428
458
|
break;
|
|
429
459
|
}
|
|
430
|
-
case
|
|
460
|
+
case ScriptingSourceTreeExp_1.T_DESTRUCTURE: {
|
|
431
461
|
decl = {
|
|
432
|
-
type:
|
|
462
|
+
type: ScriptingSourceTreeExp_1.T_VAR_DECLARATION,
|
|
433
463
|
id: argSpec.id,
|
|
434
|
-
|
|
435
|
-
|
|
464
|
+
aDestr: argSpec.aDestr,
|
|
465
|
+
oDestr: argSpec.oDestr,
|
|
436
466
|
};
|
|
437
467
|
break;
|
|
438
468
|
}
|
|
439
|
-
case
|
|
469
|
+
case ScriptingSourceTreeExp_1.T_SPREAD_EXPRESSION: {
|
|
440
470
|
restFound = true;
|
|
441
471
|
decl = {
|
|
442
|
-
type:
|
|
443
|
-
id: argSpec.
|
|
472
|
+
type: ScriptingSourceTreeExp_1.T_VAR_DECLARATION,
|
|
473
|
+
id: argSpec.expr.name,
|
|
444
474
|
};
|
|
445
475
|
break;
|
|
446
476
|
}
|
|
@@ -450,25 +480,25 @@ function createArrowFunctionAsync(evaluator, expr) {
|
|
|
450
480
|
if (decl) {
|
|
451
481
|
if (restFound) {
|
|
452
482
|
// --- Get the rest of the arguments
|
|
453
|
-
const restArgs = args.slice(i +
|
|
483
|
+
const restArgs = args.slice(i + 3);
|
|
454
484
|
let argVals = [];
|
|
455
485
|
for (const arg of restArgs) {
|
|
456
486
|
if (arg === null || arg === void 0 ? void 0 : arg._EXPRESSION_) {
|
|
457
|
-
argVals.push(yield evaluator([], arg, runTimeEvalContext, runtimeThread
|
|
487
|
+
argVals.push(yield evaluator([], arg, runTimeEvalContext, runtimeThread));
|
|
458
488
|
}
|
|
459
489
|
else {
|
|
460
490
|
argVals.push(arg);
|
|
461
491
|
}
|
|
462
492
|
}
|
|
463
|
-
yield (0, process_statement_async_1.processDeclarationsAsync)(arrowBlock, runTimeEvalContext, runtimeThread,
|
|
493
|
+
yield (0, process_statement_async_1.processDeclarationsAsync)(arrowBlock, runTimeEvalContext, runtimeThread, [decl], false, true, argVals);
|
|
464
494
|
}
|
|
465
495
|
else {
|
|
466
496
|
// --- Get the actual value to work with
|
|
467
|
-
let argVal = args[i +
|
|
497
|
+
let argVal = args[i + 3];
|
|
468
498
|
if (argVal === null || argVal === void 0 ? void 0 : argVal._EXPRESSION_) {
|
|
469
|
-
argVal = yield evaluator([], argVal, runTimeEvalContext, runtimeThread
|
|
499
|
+
argVal = yield evaluator([], argVal, runTimeEvalContext, runtimeThread);
|
|
470
500
|
}
|
|
471
|
-
yield (0, process_statement_async_1.processDeclarationsAsync)(arrowBlock, runTimeEvalContext, runtimeThread,
|
|
501
|
+
yield (0, process_statement_async_1.processDeclarationsAsync)(arrowBlock, runTimeEvalContext, runtimeThread, [decl], false, true, argVal);
|
|
472
502
|
}
|
|
473
503
|
}
|
|
474
504
|
}
|
|
@@ -476,27 +506,27 @@ function createArrowFunctionAsync(evaluator, expr) {
|
|
|
476
506
|
let returnValue;
|
|
477
507
|
let statements;
|
|
478
508
|
switch (expr.statement.type) {
|
|
479
|
-
case
|
|
509
|
+
case ScriptingSourceTreeExp_1.T_EMPTY_STATEMENT:
|
|
480
510
|
statements = [];
|
|
481
511
|
break;
|
|
482
|
-
case
|
|
512
|
+
case ScriptingSourceTreeExp_1.T_EXPRESSION_STATEMENT:
|
|
483
513
|
// --- Create a new thread for the call
|
|
484
514
|
statements = [
|
|
485
515
|
{
|
|
486
|
-
type:
|
|
487
|
-
|
|
516
|
+
type: ScriptingSourceTreeExp_1.T_RETURN_STATEMENT,
|
|
517
|
+
expr: expr.statement.expr,
|
|
488
518
|
},
|
|
489
519
|
];
|
|
490
520
|
break;
|
|
491
|
-
case
|
|
521
|
+
case ScriptingSourceTreeExp_1.T_BLOCK_STATEMENT:
|
|
492
522
|
// --- Create a new thread for the call
|
|
493
|
-
statements = expr.statement.
|
|
523
|
+
statements = expr.statement.stmts;
|
|
494
524
|
break;
|
|
495
525
|
default:
|
|
496
526
|
throw new Error(`Arrow expression with a body of '${expr.statement.type}' is not supported yet.`);
|
|
497
527
|
}
|
|
498
528
|
// --- Process the statement with a new processor
|
|
499
|
-
yield (0, process_statement_async_1.processStatementQueueAsync)(statements, runTimeEvalContext, workingThread
|
|
529
|
+
yield (0, process_statement_async_1.processStatementQueueAsync)(statements, runTimeEvalContext, workingThread);
|
|
500
530
|
// --- Return value is in a return value slot
|
|
501
531
|
returnValue = workingThread.returnValue;
|
|
502
532
|
// --- Remove the current working thread
|
|
@@ -562,32 +592,23 @@ function completePromise(input) {
|
|
|
562
592
|
}
|
|
563
593
|
});
|
|
564
594
|
}
|
|
565
|
-
|
|
566
|
-
* Gets the context of the variable
|
|
567
|
-
* @param id Identifier to test
|
|
568
|
-
* @param thread Thread to use for evaluation
|
|
569
|
-
*/
|
|
570
|
-
function isConstVar(id, thread) {
|
|
571
|
-
var _a;
|
|
572
|
-
// --- Start search the block context
|
|
573
|
-
if (thread.blocks) {
|
|
574
|
-
for (let idx = thread.blocks.length; idx >= 0; idx--) {
|
|
575
|
-
const constContext = (_a = thread.blocks[idx]) === null || _a === void 0 ? void 0 : _a.constVars;
|
|
576
|
-
if (constContext && constContext.has(id))
|
|
577
|
-
return true;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
// --- Not in block context
|
|
581
|
-
return false;
|
|
582
|
-
}
|
|
583
|
-
function evalTemplateLiteralAsync(evaluator, thisStack, expr, evalContext, thread, onStatementCompleted) {
|
|
595
|
+
function evalTemplateLiteralAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
584
596
|
return __awaiter(this, void 0, void 0, function* () {
|
|
585
597
|
const segmentValues = new Array(expr.segments.length);
|
|
586
598
|
for (let i = 0; i < expr.segments.length; ++i) {
|
|
587
|
-
|
|
599
|
+
yield evaluator(thisStack, expr.segments[i], evalContext, thread);
|
|
588
600
|
thisStack.pop();
|
|
589
|
-
|
|
601
|
+
const evaledValue = yield completeExprValue(expr.segments[i], thread);
|
|
602
|
+
segmentValues[i] = evaledValue;
|
|
590
603
|
}
|
|
591
604
|
return (0, eval_tree_common_1.evalTemplateLiteralCore)(segmentValues);
|
|
592
605
|
});
|
|
593
606
|
}
|
|
607
|
+
function completeExprValue(expr, thread) {
|
|
608
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
609
|
+
const exprValue = (0, eval_tree_common_1.getExprValue)(expr, thread);
|
|
610
|
+
const awaited = yield completePromise(exprValue === null || exprValue === void 0 ? void 0 : exprValue.value);
|
|
611
|
+
(0, eval_tree_common_1.setExprValue)(expr, Object.assign(Object.assign({}, exprValue), { value: awaited }), thread);
|
|
612
|
+
return awaited;
|
|
613
|
+
});
|
|
614
|
+
}
|