occam-furtle 2.0.63 → 2.0.65

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.
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ import dom from "../dom";
4
+
5
+ import { nodeQuery } from "../utilities/query";
6
+ import { domAssigned } from "../dom";
7
+
8
+ const ifValueNodeQuery = nodeQuery("/ternary/value[0]"),
9
+ ternaryNodeQuery = nodeQuery("/value/ternary"),
10
+ conditionNodeQuery = nodeQuery("/ternary/condition"),
11
+ elseValueNodeQuery = nodeQuery("/ternary/value[1]");
12
+
13
+ export default domAssigned(class Ternary {
14
+ constructor(string, condition, ifValue, elseValue) {
15
+ this.string = string;
16
+ this.condition = condition;
17
+ this.ifValue = ifValue;
18
+ this.elseValue = elseValue;
19
+ }
20
+
21
+ getString() {
22
+ return this.string;
23
+ }
24
+
25
+ getCondition() {
26
+ return this.condition;
27
+ }
28
+
29
+ getConditionBlock() {
30
+ return this.ifValue;
31
+ }
32
+
33
+ getElseBlock() {
34
+ return this.elseValue;
35
+ }
36
+
37
+ evaluate(context) {
38
+ let value;
39
+
40
+ const ternaryString = this.string; ///
41
+
42
+ context.trace(`Evaluating the '${ternaryString}' ternary...`);
43
+
44
+ value = this.condition.evaluate(context);
45
+
46
+ const boolean = value.getBoolean();
47
+
48
+ value = boolean ?
49
+ this.ifValue.evaluate(context) :
50
+ this.elseValue.evaluate(context);
51
+
52
+ context.debug(`...evaluated the '${ternaryString}' ternary.`);
53
+
54
+ return value;
55
+ }
56
+
57
+ static name = "Ternary";
58
+
59
+ static fromValueNode(valueNode, context) {
60
+ let ternary = null;
61
+
62
+ const ternaryNode = ternaryNodeQuery(valueNode);
63
+
64
+ if (ternaryNode !== null) {
65
+ const { Value, Condition } = dom,
66
+ string = stringFromTernaryNode(ternaryNode, context),
67
+ ifValueNode = ifValueNodeQuery(ternaryNode),
68
+ elseValueNode = elseValueNodeQuery(ternaryNode),
69
+ condition = Condition.fromTernaryNode(ternaryNode, context),
70
+ ifValue = Value.fromValueNode(ifValueNode, context),
71
+ elseValue = Value.fromValueNode(elseValueNode, context);
72
+
73
+ ternary = new Ternary(string, condition, ifValue, elseValue);
74
+ }
75
+
76
+ return ternary;
77
+ }
78
+ });
79
+
80
+ function stringFromTernaryNode(ternaryNode, context) {
81
+ let string;
82
+
83
+ const ifValueNode = ifValueNodeQuery(ternaryNode),
84
+ elseValueNode = elseValueNodeQuery(ternaryNode),
85
+ conditionNode = conditionNodeQuery(ternaryNode),
86
+ ifValueString = context.nodeAsString(ifValueNode),
87
+ elseValueString = context.nodeAsString(elseValueNode),
88
+ conditionString = context.nodeAsString(conditionNode);
89
+
90
+ string = `If (${conditionString}) ${ifValueString} ${elseValueString}`;
91
+
92
+ return string;
93
+ }
package/src/dom/value.js CHANGED
@@ -3,6 +3,7 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import dom from "../dom";
6
+ import nullNode from "../nullNode";
6
7
 
7
8
  import { nodeQuery } from "../utilities/query";
8
9
  import { domAssigned } from "../dom";
@@ -19,15 +20,18 @@ const numberTerminalNodeQuery = nodeQuery("/value/@number"),
19
20
  stringLiteralTerminalNodeQuery = nodeQuery("/value/@string-literal");
20
21
 
21
22
  export default domAssigned(class Value {
22
- constructor(node, nodes, number, string, boolean, variable, nodeQuery, nodesQuery, procedureCall) {
23
+ constructor(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, procedureCall) {
23
24
  this.node = node;
24
25
  this.nodes = nodes;
25
26
  this.number = number;
26
27
  this.string = string;
27
28
  this.boolean = boolean;
29
+ this.some = some;
30
+ this.ternary = ternary;
28
31
  this.variable = variable;
29
32
  this.nodeQuery = nodeQuery;
30
33
  this.nodesQuery = nodesQuery;
34
+ this.comparison = comparison;
31
35
  this.procedureCall = procedureCall;
32
36
  }
33
37
 
@@ -51,6 +55,14 @@ export default domAssigned(class Value {
51
55
  return this.boolean;
52
56
  }
53
57
 
58
+ getSome() {
59
+ return this.some;
60
+ }
61
+
62
+ getTernary() {
63
+ return this.ternay;
64
+ }
65
+
54
66
  getVariable() {
55
67
  return this.variable;
56
68
  }
@@ -63,6 +75,10 @@ export default domAssigned(class Value {
63
75
  return this.nodesQuery;
64
76
  }
65
77
 
78
+ getComparison() {
79
+ return this.comparison;
80
+ }
81
+
66
82
  getProcedureCall() {
67
83
  return this.procedureCall;
68
84
  }
@@ -82,12 +98,18 @@ export default domAssigned(class Value {
82
98
  type = STRING_TYPE;
83
99
  } else if (this.boolean !== null) {
84
100
  type = BOOLEAN_TYPE;
101
+ } else if (this.some !== null) {
102
+ type = this.some.getType();
103
+ } else if (this.ternary !== null) {
104
+ type = this.ternary.getType();
85
105
  } else if (this.variable !== null) {
86
106
  type = this.variable.getType();
87
107
  } else if (this.nodeQuery !== null) {
88
108
  type = this.nodeQuery.getType();
89
109
  } else if (this.nodesQuery !== null) {
90
110
  type = this.nodesQuery.getType();
111
+ } else if (this.comparison !== null) {
112
+ type = this.comparison.getType();
91
113
  } else if (this.procedureCall !== null) {
92
114
  type = this.procedureCall.getType();
93
115
  }
@@ -110,12 +132,18 @@ export default domAssigned(class Value {
110
132
  string = stringAsString(this.string, context)
111
133
  } else if (this.boolean !== null) {
112
134
  string = booleanAsString(this.boolean, context)
135
+ } else if (this.some !== null) {
136
+ string = this.some.asString(context);
137
+ } else if (this.ternary !== null) {
138
+ string = this.ternary.asString(context);
113
139
  } else if (this.variable !== null) {
114
140
  string = this.variable.asString(context);
115
141
  } else if (this.nodeQuery !== null) {
116
142
  string = this.nodeQuery.asString(context);
117
143
  } else if (this.nodesQuery !== null) {
118
144
  string = this.nodesQuery.asString(context);
145
+ } else if (this.comparison !== null) {
146
+ string = this.comparison.asString(context);
119
147
  } else if (this.procedureCall !== null) {
120
148
  string = this.procedureCall.asString(context);
121
149
  }
@@ -134,12 +162,18 @@ export default domAssigned(class Value {
134
162
  (this.string !== null) ||
135
163
  (this.boolean !== null)) {
136
164
  value = this;
165
+ } else if (this.some !== null) {
166
+ value = this.some.evaluate(context);
167
+ } else if (this.ternary !== null) {
168
+ value = this.ternary.evaluate(context);
137
169
  } else if (this.variable !== null) {
138
170
  value = this.variable.evaluate(context);
139
171
  } else if (this.nodeQuery !== null) {
140
172
  value = this.nodeQuery.evaluate(context);
141
173
  } else if (this.nodesQuery !== null) {
142
174
  value = this.nodesQuery.evaluate(context);
175
+ } else if (this.comparison !== null) {
176
+ value = this.comparison.evaluate(context);
143
177
  } else if (this.procedureCall !== null) {
144
178
  value = this.procedureCall.evaluate(context);
145
179
  }
@@ -153,15 +187,29 @@ export default domAssigned(class Value {
153
187
  if (false) {
154
188
  ///
155
189
  } else if (this.node !== null) {
156
- const node = value.getNode(),
157
- nodeMatches = matchNode(this.node, node);
190
+ const node = value.getNode();
158
191
 
159
- equalTo = nodeMatches; ///
192
+ if (node === null) {
193
+ equalTo = false;
194
+ } else {
195
+ const nodeA = this.node, ///
196
+ nodeB = node, ///
197
+ nodeMatches = matchNode(nodeA, nodeB);
198
+
199
+ equalTo = nodeMatches; ///
200
+ }
160
201
  } else if (this.nodes !== null) {
161
- const nodes = value.getNode(),
162
- nodesMatch = matchNodes(this.nodes, nodes);
202
+ const nodes = value.getNode();
163
203
 
164
- equalTo = nodesMatch; ///
204
+ if (nodes === null) {
205
+ equalTo = false;
206
+ } else {
207
+ const nodesA = this.nodes, ///
208
+ nodesB = nodes, ///
209
+ nodesMatch = matchNodes(nodesA, nodesB);
210
+
211
+ equalTo = nodesMatch; ///
212
+ }
165
213
  } else if (this.number !== null) {
166
214
  const number = value.getNumber();
167
215
 
@@ -185,18 +233,21 @@ export default domAssigned(class Value {
185
233
 
186
234
  static fromNode(node, context) {
187
235
  if (node === null) {
188
- node = nullValue;
236
+ node = nullNode;
189
237
  }
190
238
 
191
239
  const nodes = null,
192
240
  number = null,
193
241
  string = null,
194
242
  boolean = null,
243
+ some = null,
244
+ ternary = null,
195
245
  variable = null,
196
246
  nodeQuery = null,
197
247
  nodesQuery = null,
248
+ comparison = null,
198
249
  procedureCall = null,
199
- value = new Value(node, nodes, number, string, boolean, variable, nodeQuery, nodesQuery, procedureCall);
250
+ value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, procedureCall);
200
251
 
201
252
  return value;
202
253
  }
@@ -206,11 +257,14 @@ export default domAssigned(class Value {
206
257
  number = null,
207
258
  string = null,
208
259
  boolean = null,
260
+ ternary = null,
261
+ some = null,
209
262
  variable = null,
210
263
  nodeQuery = null,
211
264
  nodesQuery = null,
265
+ comparison = null,
212
266
  procedureCall = null,
213
- value = new Value(node, nodes, number, string, boolean, variable, nodeQuery, nodesQuery, procedureCall);
267
+ value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, procedureCall);
214
268
 
215
269
  return value;
216
270
  }
@@ -220,11 +274,14 @@ export default domAssigned(class Value {
220
274
  nodes = null,
221
275
  number = null,
222
276
  boolean = null,
277
+ some = null,
278
+ ternary = null,
223
279
  variable = null,
224
280
  nodeQuery = null,
225
281
  nodesQuery = null,
282
+ comparison = null,
226
283
  procedureCall = null,
227
- value = new Value(node, nodes, number, string, boolean, variable, nodeQuery, nodesQuery, procedureCall);
284
+ value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, procedureCall);
228
285
 
229
286
  return value;
230
287
  }
@@ -234,11 +291,14 @@ export default domAssigned(class Value {
234
291
  nodes = null,
235
292
  number = null,
236
293
  string = null,
294
+ some = null,
295
+ ternary = null,
237
296
  variable = null,
238
297
  nodeQuery = null,
239
298
  nodesQuery = null,
299
+ comparison = null,
240
300
  procedureCall = null,
241
- value = new Value(node, nodes, number, string, boolean, variable, nodeQuery, nodesQuery, procedureCall);
301
+ value = new Value(node, nodes, number, string, boolean, some, ternary, variable, nodeQuery, nodesQuery, comparison, procedureCall);
242
302
 
243
303
  return value;
244
304
  }
@@ -295,7 +355,7 @@ export default domAssigned(class Value {
295
355
  function matchNode(nodeA, nodeB) {
296
356
  let nodeMatches;
297
357
 
298
- if ((nodeA === null) || (nodeB === null)) {
358
+ if ((nodeA === nullNode) || (nodeB === nullNode)) {
299
359
  nodeMatches = (nodeA === nodeB);
300
360
  } else {
301
361
  const nodeAEqualToNodeA = nodeA.isEqualTo(nodeB);
@@ -309,17 +369,13 @@ function matchNode(nodeA, nodeB) {
309
369
  function matchNodes(nodesA, nodesB) {
310
370
  let nodesMatch;
311
371
 
312
- if ((nodesA === null) || (nodesB === null)) {
313
- nodesMatch = (nodesA === nodesB);
314
- } else {
315
- nodesMatch = match(nodesA, nodesB, (nodeA, nodeB) => {
316
- const nodeMatches = matchNode(nodeA, nodeB);
372
+ nodesMatch = match(nodesA, nodesB, (nodeA, nodeB) => {
373
+ const nodeMatches = matchNode(nodeA, nodeB);
317
374
 
318
- if (nodeMatches) {
319
- return true;
320
- }
321
- });
322
- }
375
+ if (nodeMatches) {
376
+ return true;
377
+ }
378
+ });
323
379
 
324
380
  return nodesMatch;
325
381
  }
@@ -327,7 +383,7 @@ function matchNodes(nodesA, nodesB) {
327
383
  function nodeAsString(node, context) {
328
384
  let string;
329
385
 
330
- const nodeString = (node === nullValue) ?
386
+ const nodeString = (node === nullNode) ?
331
387
  NULL :
332
388
  context.nodeAsString(node);
333
389
 
@@ -369,23 +425,39 @@ function booleanAsString(boolean, context) {
369
425
  }
370
426
 
371
427
  function valueFromValueNode(valueNode, context) {
372
- const { Value, Variable, NodeQuery, NodesQuery, ProcedureCall } = dom,
428
+ const { Value, Ternary, Variable, NodeQuery, NodesQuery, Comparison, ProcedureCall } = dom,
373
429
  node = nodeFromValueNode(valueNode, context),
374
430
  nodes = nodesFromValueNode(valueNode, context),
375
431
  number = numberFromValueNode(valueNode, context),
376
432
  string = stringFromValueNode(valueNode, context),
377
433
  boolean = booleanFromValueNode(valueNode, context),
434
+ ternary = Ternary.fromValueNode(valueNode, context),
378
435
  variable = Variable.fromValueNode(valueNode, context),
379
436
  nodeQuery = NodeQuery.fromValueNode(valueNode, context),
380
437
  nodesQuery = NodesQuery.fromValueNode(valueNode, context),
438
+ comparison = Comparison.fromValueNode(valueNode, context),
381
439
  procedureCall = ProcedureCall.fromValueNode(valueNode, context),
382
- value = new Value(node, nodes, number, string, boolean, variable, nodeQuery, nodesQuery, procedureCall);
440
+ value = new Value(node, nodes, number, string, boolean, ternary, variable, nodeQuery, nodesQuery, comparison, procedureCall);
383
441
 
384
442
  return value;
385
443
  }
386
444
 
387
445
  function nodeFromValueNode(valueNode, context) {
388
- const node = null; ///
446
+ let node = null;
447
+
448
+ const primitiveTerminalNode = primitiveTerminalNodeQuery(valueNode);
449
+
450
+ if (primitiveTerminalNode !== null) {
451
+ const primitiveTerminalNodeContent = primitiveTerminalNode.getContent();
452
+
453
+ switch (primitiveTerminalNodeContent) {
454
+ case NULL: {
455
+ node = nullNode;
456
+
457
+ break;
458
+ }
459
+ }
460
+ }
389
461
 
390
462
  return node;
391
463
  }
@@ -456,13 +528,3 @@ function stringFromStringLiteral(stringLiteral, context) {
456
528
 
457
529
  return string;
458
530
  }
459
-
460
- class NullValue {
461
- static fromNothing() {
462
- const nullValue = new NullValue();
463
-
464
- return nullValue;
465
- }
466
- }
467
-
468
- export const nullValue = NullValue.fromNothing();
@@ -6,10 +6,10 @@ import Exception from "../exception";
6
6
  import { nodeQuery } from "../utilities/query";
7
7
  import { domAssigned } from "../dom";
8
8
 
9
- const valueVariableNodeQuery = nodeQuery("/value/variable"),
9
+ const someVariableNodeQuery = nodeQuery("/some/variable"),
10
+ valueVariableNodeQuery = nodeQuery("/value/variable"),
10
11
  nodeQueryVariableNodeQuery = nodeQuery("/nodeQuery/variable"),
11
12
  nodesQueryVariableNodeQuery = nodeQuery("/nodesQuery/variable"),
12
- forEachLoopVariableNodeQuery = nodeQuery("/forEachLoop/variable"),
13
13
  variableNameTerminalNodeQuery = nodeQuery("/variable/@name"),
14
14
  arrayAssignmentVariableNodeQuery = nodeQuery("/arrayAssignment/variable"),
15
15
  objectAssignmentVariableNodeQuery = nodeQuery("/objectAssignment/variable"),
@@ -133,6 +133,14 @@ export default domAssigned(class Variable {
133
133
 
134
134
  static name = "Variable";
135
135
 
136
+ static fromSomeNode(someLoopNode, context) {
137
+ const someVariableNode = someVariableNodeQuery(someLoopNode),
138
+ variableNode = someVariableNode, ///
139
+ variable = variableFromVariableNode(variableNode, context);
140
+
141
+ return variable;
142
+ }
143
+
136
144
  static fromValueNode(valueNode, context) {
137
145
  let variable = null;
138
146
 
@@ -163,14 +171,6 @@ export default domAssigned(class Variable {
163
171
  return variable;
164
172
  }
165
173
 
166
- static fromForEachLoopNode(forEachLoopLoopNode, context) {
167
- const forEachLoopVariableNode = forEachLoopVariableNodeQuery(forEachLoopLoopNode),
168
- variableNode = forEachLoopVariableNode, ///
169
- variable = variableFromVariableNode(variableNode, context);
170
-
171
- return variable;
172
- }
173
-
174
174
  static fromValueAndParameter(value, parameter, context) {
175
175
  const type = parameter.getType(),
176
176
  name = parameter.getName(),
package/src/index.js CHANGED
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  import Step from "./dom/step";
4
+ import Some from "./dom/some";
4
5
  import Label from "./dom/label";
5
6
  import Block from "./dom/block";
6
7
  import Error from "./dom/error";
7
8
  import Value from "./dom/value";
8
9
  import Values from "./dom/values";
10
+ import Ternary from "./dom/ternary";
9
11
  import Variable from "./dom/variable";
10
12
  import Condition from "./dom/condition";
11
13
  import Reference from "./dom/reference";
@@ -17,7 +19,6 @@ import NodesQuery from "./dom/query/nodes";
17
19
  import Comparison from "./dom/comparison";
18
20
  import Assignment from "./dom/assignment";
19
21
  import ReturnBlock from "./dom/block/return";
20
- import ForEachLoop from "./dom/forEachLoop";
21
22
  import ProcedureCall from "./dom/procedureCall";
22
23
  import ArrayAssigment from "./dom/assignment/array";
23
24
  import ReturnStatement from "./dom/returnStatement";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ class NullNode {
4
+ static fromNothing() {
5
+ const nullNode = new NullNode();
6
+
7
+ return nullNode;
8
+ }
9
+ }
10
+
11
+ const nullNode = NullNode.fromNothing();
12
+
13
+ export default nullNode;
14
+
@@ -1,161 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _dom = /*#__PURE__*/ _interop_require_wildcard(require("../dom"));
12
- var _exception = /*#__PURE__*/ _interop_require_default(require("../exception"));
13
- var _query = require("../utilities/query");
14
- var _types = require("../types");
15
- function _class_call_check(instance, Constructor) {
16
- if (!(instance instanceof Constructor)) {
17
- throw new TypeError("Cannot call a class as a function");
18
- }
19
- }
20
- function _defineProperties(target, props) {
21
- for(var i = 0; i < props.length; i++){
22
- var descriptor = props[i];
23
- descriptor.enumerable = descriptor.enumerable || false;
24
- descriptor.configurable = true;
25
- if ("value" in descriptor) descriptor.writable = true;
26
- Object.defineProperty(target, descriptor.key, descriptor);
27
- }
28
- }
29
- function _create_class(Constructor, protoProps, staticProps) {
30
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
31
- if (staticProps) _defineProperties(Constructor, staticProps);
32
- return Constructor;
33
- }
34
- function _define_property(obj, key, value) {
35
- if (key in obj) {
36
- Object.defineProperty(obj, key, {
37
- value: value,
38
- enumerable: true,
39
- configurable: true,
40
- writable: true
41
- });
42
- } else {
43
- obj[key] = value;
44
- }
45
- return obj;
46
- }
47
- function _interop_require_default(obj) {
48
- return obj && obj.__esModule ? obj : {
49
- default: obj
50
- };
51
- }
52
- function _getRequireWildcardCache(nodeInterop) {
53
- if (typeof WeakMap !== "function") return null;
54
- var cacheBabelInterop = new WeakMap();
55
- var cacheNodeInterop = new WeakMap();
56
- return (_getRequireWildcardCache = function(nodeInterop) {
57
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
58
- })(nodeInterop);
59
- }
60
- function _interop_require_wildcard(obj, nodeInterop) {
61
- if (!nodeInterop && obj && obj.__esModule) {
62
- return obj;
63
- }
64
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
65
- return {
66
- default: obj
67
- };
68
- }
69
- var cache = _getRequireWildcardCache(nodeInterop);
70
- if (cache && cache.has(obj)) {
71
- return cache.get(obj);
72
- }
73
- var newObj = {
74
- __proto__: null
75
- };
76
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
77
- for(var key in obj){
78
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
79
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
80
- if (desc && (desc.get || desc.set)) {
81
- Object.defineProperty(newObj, key, desc);
82
- } else {
83
- newObj[key] = obj[key];
84
- }
85
- }
86
- }
87
- newObj.default = obj;
88
- if (cache) {
89
- cache.set(obj, newObj);
90
- }
91
- return newObj;
92
- }
93
- var _ForEachLoop;
94
- var variableNodeQuery = (0, _query.nodeQuery)("/forEachLoop/variable"), parametersNodeQuery = (0, _query.nodeQuery)("/forEachLoop/anonymousProcedure/parameters"), forEachLoopNodeQuery = (0, _query.nodeQuery)("/step/forEachLoop");
95
- var _default = (0, _dom.domAssigned)((_ForEachLoop = /*#__PURE__*/ function() {
96
- function ForEachLoop(string, variable, anonymousProcedure) {
97
- _class_call_check(this, ForEachLoop);
98
- this.string = string;
99
- this.variable = variable;
100
- this.anonymousProcedure = anonymousProcedure;
101
- }
102
- _create_class(ForEachLoop, [
103
- {
104
- key: "getString",
105
- value: function getString() {
106
- return this.string;
107
- }
108
- },
109
- {
110
- key: "getVariable",
111
- value: function getVariable() {
112
- return this.variable;
113
- }
114
- },
115
- {
116
- key: "getAnonymousProcedure",
117
- value: function getAnonymousProcedure() {
118
- return this.anonymousProcedure;
119
- }
120
- },
121
- {
122
- key: "evaluate",
123
- value: function evaluate(context) {
124
- var _this = this;
125
- var forEachLoopString = this.getString();
126
- context.trace("Evaluating the '".concat(forEachLoopString, "' for-each loop..."));
127
- var value = this.variable.evaluate(context), valueType = value.getType();
128
- if (valueType !== _types.NODES_TYPE) {
129
- var valueString = value.asString(context), message = "The ".concat(valueString, " value's '").concat(valueType, "' type should be '").concat(_types.NODES_TYPE, "'."), exception = _exception.default.fromMessage(message);
130
- throw exception;
131
- }
132
- var nodes = value.getNodes();
133
- nodes.forEach(function(node) {
134
- var Value = _dom.default.Value, Values = _dom.default.Values, value = Value.fromNode(node, context), values = Values.fromValue(value, context);
135
- _this.anonymousProcedure.call(values, context);
136
- });
137
- context.trace("...evaluated the '".concat(forEachLoopString, "' for-each loop."));
138
- }
139
- }
140
- ], [
141
- {
142
- key: "fromStepNode",
143
- value: function fromStepNode(stepNode, context) {
144
- var forEachLoop = null;
145
- var forEachLoopNode = forEachLoopNodeQuery(stepNode);
146
- if (forEachLoopNode !== null) {
147
- var Variable = _dom.default.Variable, AnonymousProcedure = _dom.default.AnonymousProcedure, string = stringFromForEachLoopNode(forEachLoopNode, context), variable = Variable.fromForEachLoopNode(forEachLoopNode, context), anonymousProcedure = AnonymousProcedure.fromForEachLoopNode(forEachLoopNode, context);
148
- forEachLoop = new ForEachLoop(string, variable, anonymousProcedure);
149
- }
150
- return forEachLoop;
151
- }
152
- }
153
- ]);
154
- return ForEachLoop;
155
- }(), _define_property(_ForEachLoop, "name", "ForEachLoop"), _ForEachLoop));
156
- function stringFromForEachLoopNode(forEachLoopNode, context) {
157
- var variableNode = variableNodeQuery(forEachLoopNode), parametersNode = parametersNodeQuery(forEachLoopNode), variableString = context.nodeAsString(variableNode), parametersString = context.nodeAsString(parametersNode), string = "ForEach(".concat(variableString, ", (").concat(parametersString, ") { ... })");
158
- return string;
159
- }
160
-
161
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kb20vZm9yRWFjaExvb3AuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmltcG9ydCBkb20gZnJvbSBcIi4uL2Rvb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