terser 5.11.0 → 5.13.0
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/CHANGELOG.md +16 -0
- package/README.md +24 -8
- package/dist/bundle.min.js +2360 -731
- package/lib/ast.js +1662 -350
- package/lib/cli.js +13 -9
- package/lib/compress/evaluate.js +4 -3
- package/lib/equivalent-to.js +81 -107
- package/lib/minify.js +49 -1
- package/lib/mozilla-ast.js +474 -81
- package/lib/output.js +3 -2
- package/lib/propmangle.js +1 -1
- package/lib/scope.js +22 -0
- package/package.json +4 -2
- package/tools/domprops.js +11 -0
package/lib/ast.js
CHANGED
@@ -48,23 +48,13 @@ import {
|
|
48
48
|
} from "./utils/index.js";
|
49
49
|
import { parse } from "./parse.js";
|
50
50
|
|
51
|
-
function DEFNODE(type, props, methods, base = AST_Node) {
|
51
|
+
function DEFNODE(type, props, ctor, methods, base = AST_Node) {
|
52
52
|
if (!props) props = [];
|
53
53
|
else props = props.split(/\s+/);
|
54
54
|
var self_props = props;
|
55
55
|
if (base && base.PROPS)
|
56
56
|
props = props.concat(base.PROPS);
|
57
|
-
var code = "return function AST_" + type + "(props){ if (props) { ";
|
58
|
-
for (var i = props.length; --i >= 0;) {
|
59
|
-
code += "this." + props[i] + " = props." + props[i] + ";";
|
60
|
-
}
|
61
57
|
const proto = base && Object.create(base.prototype);
|
62
|
-
if (proto && proto.initialize || (methods && methods.initialize))
|
63
|
-
code += "this.initialize();";
|
64
|
-
code += "}";
|
65
|
-
code += "this.flags = 0;";
|
66
|
-
code += "}";
|
67
|
-
var ctor = new Function(code)();
|
68
58
|
if (proto) {
|
69
59
|
ctor.prototype = proto;
|
70
60
|
ctor.BASE = base;
|
@@ -78,7 +68,7 @@ function DEFNODE(type, props, methods, base = AST_Node) {
|
|
78
68
|
if (type) {
|
79
69
|
ctor.prototype.TYPE = ctor.TYPE = type;
|
80
70
|
}
|
81
|
-
if (methods) for (i in methods) if (HOP(methods, i)) {
|
71
|
+
if (methods) for (let i in methods) if (HOP(methods, i)) {
|
82
72
|
if (i[0] === "$") {
|
83
73
|
ctor[i.substr(1)] = methods[i];
|
84
74
|
} else {
|
@@ -140,7 +130,14 @@ class AST_Token {
|
|
140
130
|
}
|
141
131
|
}
|
142
132
|
|
143
|
-
var AST_Node = DEFNODE("Node", "start end", {
|
133
|
+
var AST_Node = DEFNODE("Node", "start end", function AST_Node(props) {
|
134
|
+
if (props) {
|
135
|
+
this.start = props.start;
|
136
|
+
this.end = props.end;
|
137
|
+
}
|
138
|
+
|
139
|
+
this.flags = 0;
|
140
|
+
}, {
|
144
141
|
_clone: function(deep) {
|
145
142
|
if (deep) {
|
146
143
|
var self = this.clone();
|
@@ -171,15 +168,38 @@ var AST_Node = DEFNODE("Node", "start end", {
|
|
171
168
|
|
172
169
|
/* -----[ statements ]----- */
|
173
170
|
|
174
|
-
var AST_Statement = DEFNODE("Statement", null, {
|
171
|
+
var AST_Statement = DEFNODE("Statement", null, function AST_Statement(props) {
|
172
|
+
if (props) {
|
173
|
+
this.start = props.start;
|
174
|
+
this.end = props.end;
|
175
|
+
}
|
176
|
+
|
177
|
+
this.flags = 0;
|
178
|
+
}, {
|
175
179
|
$documentation: "Base class of all statements",
|
176
180
|
});
|
177
181
|
|
178
|
-
var AST_Debugger = DEFNODE("Debugger", null, {
|
182
|
+
var AST_Debugger = DEFNODE("Debugger", null, function AST_Debugger(props) {
|
183
|
+
if (props) {
|
184
|
+
this.start = props.start;
|
185
|
+
this.end = props.end;
|
186
|
+
}
|
187
|
+
|
188
|
+
this.flags = 0;
|
189
|
+
}, {
|
179
190
|
$documentation: "Represents a debugger statement",
|
180
191
|
}, AST_Statement);
|
181
192
|
|
182
|
-
var AST_Directive = DEFNODE("Directive", "value quote", {
|
193
|
+
var AST_Directive = DEFNODE("Directive", "value quote", function AST_Directive(props) {
|
194
|
+
if (props) {
|
195
|
+
this.value = props.value;
|
196
|
+
this.quote = props.quote;
|
197
|
+
this.start = props.start;
|
198
|
+
this.end = props.end;
|
199
|
+
}
|
200
|
+
|
201
|
+
this.flags = 0;
|
202
|
+
}, {
|
183
203
|
$documentation: "Represents a directive, like \"use strict\";",
|
184
204
|
$propdoc: {
|
185
205
|
value: "[string] The value of this directive as a plain string (it's not an AST_String!)",
|
@@ -187,7 +207,15 @@ var AST_Directive = DEFNODE("Directive", "value quote", {
|
|
187
207
|
},
|
188
208
|
}, AST_Statement);
|
189
209
|
|
190
|
-
var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", {
|
210
|
+
var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", function AST_SimpleStatement(props) {
|
211
|
+
if (props) {
|
212
|
+
this.body = props.body;
|
213
|
+
this.start = props.start;
|
214
|
+
this.end = props.end;
|
215
|
+
}
|
216
|
+
|
217
|
+
this.flags = 0;
|
218
|
+
}, {
|
191
219
|
$documentation: "A statement consisting of an expression, i.e. a = 1 + 2",
|
192
220
|
$propdoc: {
|
193
221
|
body: "[AST_Node] an expression node (should not be instanceof AST_Statement)"
|
@@ -217,7 +245,16 @@ function clone_block_scope(deep) {
|
|
217
245
|
return clone;
|
218
246
|
}
|
219
247
|
|
220
|
-
var AST_Block = DEFNODE("Block", "body block_scope", {
|
248
|
+
var AST_Block = DEFNODE("Block", "body block_scope", function AST_Block(props) {
|
249
|
+
if (props) {
|
250
|
+
this.body = props.body;
|
251
|
+
this.block_scope = props.block_scope;
|
252
|
+
this.start = props.start;
|
253
|
+
this.end = props.end;
|
254
|
+
}
|
255
|
+
|
256
|
+
this.flags = 0;
|
257
|
+
}, {
|
221
258
|
$documentation: "A body of statements (usually braced)",
|
222
259
|
$propdoc: {
|
223
260
|
body: "[AST_Statement*] an array of statements",
|
@@ -235,22 +272,55 @@ var AST_Block = DEFNODE("Block", "body block_scope", {
|
|
235
272
|
clone: clone_block_scope
|
236
273
|
}, AST_Statement);
|
237
274
|
|
238
|
-
var AST_BlockStatement = DEFNODE("BlockStatement", null, {
|
275
|
+
var AST_BlockStatement = DEFNODE("BlockStatement", null, function AST_BlockStatement(props) {
|
276
|
+
if (props) {
|
277
|
+
this.body = props.body;
|
278
|
+
this.block_scope = props.block_scope;
|
279
|
+
this.start = props.start;
|
280
|
+
this.end = props.end;
|
281
|
+
}
|
282
|
+
|
283
|
+
this.flags = 0;
|
284
|
+
}, {
|
239
285
|
$documentation: "A block statement",
|
240
286
|
}, AST_Block);
|
241
287
|
|
242
|
-
var AST_EmptyStatement = DEFNODE("EmptyStatement", null, {
|
288
|
+
var AST_EmptyStatement = DEFNODE("EmptyStatement", null, function AST_EmptyStatement(props) {
|
289
|
+
if (props) {
|
290
|
+
this.start = props.start;
|
291
|
+
this.end = props.end;
|
292
|
+
}
|
293
|
+
|
294
|
+
this.flags = 0;
|
295
|
+
}, {
|
243
296
|
$documentation: "The empty statement (empty block or simply a semicolon)"
|
244
297
|
}, AST_Statement);
|
245
298
|
|
246
|
-
var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", {
|
299
|
+
var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", function AST_StatementWithBody(props) {
|
300
|
+
if (props) {
|
301
|
+
this.body = props.body;
|
302
|
+
this.start = props.start;
|
303
|
+
this.end = props.end;
|
304
|
+
}
|
305
|
+
|
306
|
+
this.flags = 0;
|
307
|
+
}, {
|
247
308
|
$documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`",
|
248
309
|
$propdoc: {
|
249
310
|
body: "[AST_Statement] the body; this should always be present, even if it's an AST_EmptyStatement"
|
250
311
|
}
|
251
312
|
}, AST_Statement);
|
252
313
|
|
253
|
-
var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", {
|
314
|
+
var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", function AST_LabeledStatement(props) {
|
315
|
+
if (props) {
|
316
|
+
this.label = props.label;
|
317
|
+
this.body = props.body;
|
318
|
+
this.start = props.start;
|
319
|
+
this.end = props.end;
|
320
|
+
}
|
321
|
+
|
322
|
+
this.flags = 0;
|
323
|
+
}, {
|
254
324
|
$documentation: "Statement with a label",
|
255
325
|
$propdoc: {
|
256
326
|
label: "[AST_Label] a label definition"
|
@@ -282,22 +352,57 @@ var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", {
|
|
282
352
|
}
|
283
353
|
}, AST_StatementWithBody);
|
284
354
|
|
285
|
-
var AST_IterationStatement = DEFNODE(
|
286
|
-
|
287
|
-
|
288
|
-
|
355
|
+
var AST_IterationStatement = DEFNODE(
|
356
|
+
"IterationStatement",
|
357
|
+
"block_scope",
|
358
|
+
function AST_IterationStatement(props) {
|
359
|
+
if (props) {
|
360
|
+
this.block_scope = props.block_scope;
|
361
|
+
this.body = props.body;
|
362
|
+
this.start = props.start;
|
363
|
+
this.end = props.end;
|
364
|
+
}
|
365
|
+
|
366
|
+
this.flags = 0;
|
289
367
|
},
|
290
|
-
|
291
|
-
|
368
|
+
{
|
369
|
+
$documentation: "Internal class. All loops inherit from it.",
|
370
|
+
$propdoc: {
|
371
|
+
block_scope: "[AST_Scope] the block scope for this iteration statement."
|
372
|
+
},
|
373
|
+
clone: clone_block_scope
|
374
|
+
},
|
375
|
+
AST_StatementWithBody
|
376
|
+
);
|
377
|
+
|
378
|
+
var AST_DWLoop = DEFNODE("DWLoop", "condition", function AST_DWLoop(props) {
|
379
|
+
if (props) {
|
380
|
+
this.condition = props.condition;
|
381
|
+
this.block_scope = props.block_scope;
|
382
|
+
this.body = props.body;
|
383
|
+
this.start = props.start;
|
384
|
+
this.end = props.end;
|
385
|
+
}
|
292
386
|
|
293
|
-
|
387
|
+
this.flags = 0;
|
388
|
+
}, {
|
294
389
|
$documentation: "Base class for do/while statements",
|
295
390
|
$propdoc: {
|
296
391
|
condition: "[AST_Node] the loop condition. Should not be instanceof AST_Statement"
|
297
392
|
}
|
298
393
|
}, AST_IterationStatement);
|
299
394
|
|
300
|
-
var AST_Do = DEFNODE("Do", null, {
|
395
|
+
var AST_Do = DEFNODE("Do", null, function AST_Do(props) {
|
396
|
+
if (props) {
|
397
|
+
this.condition = props.condition;
|
398
|
+
this.block_scope = props.block_scope;
|
399
|
+
this.body = props.body;
|
400
|
+
this.start = props.start;
|
401
|
+
this.end = props.end;
|
402
|
+
}
|
403
|
+
|
404
|
+
this.flags = 0;
|
405
|
+
}, {
|
301
406
|
$documentation: "A `do` statement",
|
302
407
|
_walk: function(visitor) {
|
303
408
|
return visitor._visit(this, function() {
|
@@ -311,7 +416,17 @@ var AST_Do = DEFNODE("Do", null, {
|
|
311
416
|
}
|
312
417
|
}, AST_DWLoop);
|
313
418
|
|
314
|
-
var AST_While = DEFNODE("While", null, {
|
419
|
+
var AST_While = DEFNODE("While", null, function AST_While(props) {
|
420
|
+
if (props) {
|
421
|
+
this.condition = props.condition;
|
422
|
+
this.block_scope = props.block_scope;
|
423
|
+
this.body = props.body;
|
424
|
+
this.start = props.start;
|
425
|
+
this.end = props.end;
|
426
|
+
}
|
427
|
+
|
428
|
+
this.flags = 0;
|
429
|
+
}, {
|
315
430
|
$documentation: "A `while` statement",
|
316
431
|
_walk: function(visitor) {
|
317
432
|
return visitor._visit(this, function() {
|
@@ -325,7 +440,19 @@ var AST_While = DEFNODE("While", null, {
|
|
325
440
|
},
|
326
441
|
}, AST_DWLoop);
|
327
442
|
|
328
|
-
var AST_For = DEFNODE("For", "init condition step", {
|
443
|
+
var AST_For = DEFNODE("For", "init condition step", function AST_For(props) {
|
444
|
+
if (props) {
|
445
|
+
this.init = props.init;
|
446
|
+
this.condition = props.condition;
|
447
|
+
this.step = props.step;
|
448
|
+
this.block_scope = props.block_scope;
|
449
|
+
this.body = props.body;
|
450
|
+
this.start = props.start;
|
451
|
+
this.end = props.end;
|
452
|
+
}
|
453
|
+
|
454
|
+
this.flags = 0;
|
455
|
+
}, {
|
329
456
|
$documentation: "A `for` statement",
|
330
457
|
$propdoc: {
|
331
458
|
init: "[AST_Node?] the `for` initialization code, or null if empty",
|
@@ -348,7 +475,18 @@ var AST_For = DEFNODE("For", "init condition step", {
|
|
348
475
|
},
|
349
476
|
}, AST_IterationStatement);
|
350
477
|
|
351
|
-
var AST_ForIn = DEFNODE("ForIn", "init object", {
|
478
|
+
var AST_ForIn = DEFNODE("ForIn", "init object", function AST_ForIn(props) {
|
479
|
+
if (props) {
|
480
|
+
this.init = props.init;
|
481
|
+
this.object = props.object;
|
482
|
+
this.block_scope = props.block_scope;
|
483
|
+
this.body = props.body;
|
484
|
+
this.start = props.start;
|
485
|
+
this.end = props.end;
|
486
|
+
}
|
487
|
+
|
488
|
+
this.flags = 0;
|
489
|
+
}, {
|
352
490
|
$documentation: "A `for ... in` statement",
|
353
491
|
$propdoc: {
|
354
492
|
init: "[AST_Node] the `for/in` initialization code",
|
@@ -368,11 +506,32 @@ var AST_ForIn = DEFNODE("ForIn", "init object", {
|
|
368
506
|
},
|
369
507
|
}, AST_IterationStatement);
|
370
508
|
|
371
|
-
var AST_ForOf = DEFNODE("ForOf", "await", {
|
509
|
+
var AST_ForOf = DEFNODE("ForOf", "await", function AST_ForOf(props) {
|
510
|
+
if (props) {
|
511
|
+
this.await = props.await;
|
512
|
+
this.init = props.init;
|
513
|
+
this.object = props.object;
|
514
|
+
this.block_scope = props.block_scope;
|
515
|
+
this.body = props.body;
|
516
|
+
this.start = props.start;
|
517
|
+
this.end = props.end;
|
518
|
+
}
|
519
|
+
|
520
|
+
this.flags = 0;
|
521
|
+
}, {
|
372
522
|
$documentation: "A `for ... of` statement",
|
373
523
|
}, AST_ForIn);
|
374
524
|
|
375
|
-
var AST_With = DEFNODE("With", "expression", {
|
525
|
+
var AST_With = DEFNODE("With", "expression", function AST_With(props) {
|
526
|
+
if (props) {
|
527
|
+
this.expression = props.expression;
|
528
|
+
this.body = props.body;
|
529
|
+
this.start = props.start;
|
530
|
+
this.end = props.end;
|
531
|
+
}
|
532
|
+
|
533
|
+
this.flags = 0;
|
534
|
+
}, {
|
376
535
|
$documentation: "A `with` statement",
|
377
536
|
$propdoc: {
|
378
537
|
expression: "[AST_Node] the `with` expression"
|
@@ -391,43 +550,82 @@ var AST_With = DEFNODE("With", "expression", {
|
|
391
550
|
|
392
551
|
/* -----[ scope and functions ]----- */
|
393
552
|
|
394
|
-
var AST_Scope = DEFNODE(
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
553
|
+
var AST_Scope = DEFNODE(
|
554
|
+
"Scope",
|
555
|
+
"variables functions uses_with uses_eval parent_scope enclosed cname",
|
556
|
+
function AST_Scope(props) {
|
557
|
+
if (props) {
|
558
|
+
this.variables = props.variables;
|
559
|
+
this.functions = props.functions;
|
560
|
+
this.uses_with = props.uses_with;
|
561
|
+
this.uses_eval = props.uses_eval;
|
562
|
+
this.parent_scope = props.parent_scope;
|
563
|
+
this.enclosed = props.enclosed;
|
564
|
+
this.cname = props.cname;
|
565
|
+
this.body = props.body;
|
566
|
+
this.block_scope = props.block_scope;
|
567
|
+
this.start = props.start;
|
568
|
+
this.end = props.end;
|
408
569
|
}
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
570
|
+
|
571
|
+
this.flags = 0;
|
572
|
+
},
|
573
|
+
{
|
574
|
+
$documentation: "Base class for all statements introducing a lexical scope",
|
575
|
+
$propdoc: {
|
576
|
+
variables: "[Map/S] a map of name -> SymbolDef for all variables/functions defined in this scope",
|
577
|
+
uses_with: "[boolean/S] tells whether this scope uses the `with` statement",
|
578
|
+
uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`",
|
579
|
+
parent_scope: "[AST_Scope?/S] link to the parent scope",
|
580
|
+
enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
|
581
|
+
cname: "[integer/S] current index for mangling variables (used internally by the mangler)",
|
582
|
+
},
|
583
|
+
get_defun_scope: function() {
|
584
|
+
var self = this;
|
585
|
+
while (self.is_block_scope()) {
|
586
|
+
self = self.parent_scope;
|
587
|
+
}
|
588
|
+
return self;
|
589
|
+
},
|
590
|
+
clone: function(deep, toplevel) {
|
591
|
+
var node = this._clone(deep);
|
592
|
+
if (deep && this.variables && toplevel && !this._block_scope) {
|
593
|
+
node.figure_out_scope({}, {
|
594
|
+
toplevel: toplevel,
|
595
|
+
parent_scope: this.parent_scope
|
596
|
+
});
|
597
|
+
} else {
|
598
|
+
if (this.variables) node.variables = new Map(this.variables);
|
599
|
+
if (this.enclosed) node.enclosed = this.enclosed.slice();
|
600
|
+
if (this._block_scope) node._block_scope = this._block_scope;
|
601
|
+
}
|
602
|
+
return node;
|
603
|
+
},
|
604
|
+
pinned: function() {
|
605
|
+
return this.uses_eval || this.uses_with;
|
422
606
|
}
|
423
|
-
return node;
|
424
607
|
},
|
425
|
-
|
426
|
-
|
608
|
+
AST_Block
|
609
|
+
);
|
610
|
+
|
611
|
+
var AST_Toplevel = DEFNODE("Toplevel", "globals", function AST_Toplevel(props) {
|
612
|
+
if (props) {
|
613
|
+
this.globals = props.globals;
|
614
|
+
this.variables = props.variables;
|
615
|
+
this.functions = props.functions;
|
616
|
+
this.uses_with = props.uses_with;
|
617
|
+
this.uses_eval = props.uses_eval;
|
618
|
+
this.parent_scope = props.parent_scope;
|
619
|
+
this.enclosed = props.enclosed;
|
620
|
+
this.cname = props.cname;
|
621
|
+
this.body = props.body;
|
622
|
+
this.block_scope = props.block_scope;
|
623
|
+
this.start = props.start;
|
624
|
+
this.end = props.end;
|
427
625
|
}
|
428
|
-
}, AST_Block);
|
429
626
|
|
430
|
-
|
627
|
+
this.flags = 0;
|
628
|
+
}, {
|
431
629
|
$documentation: "The toplevel scope",
|
432
630
|
$propdoc: {
|
433
631
|
globals: "[Map/S] a map of name -> SymbolDef for all undeclared names",
|
@@ -462,7 +660,15 @@ var AST_Toplevel = DEFNODE("Toplevel", "globals", {
|
|
462
660
|
}
|
463
661
|
}, AST_Scope);
|
464
662
|
|
465
|
-
var AST_Expansion = DEFNODE("Expansion", "expression", {
|
663
|
+
var AST_Expansion = DEFNODE("Expansion", "expression", function AST_Expansion(props) {
|
664
|
+
if (props) {
|
665
|
+
this.expression = props.expression;
|
666
|
+
this.start = props.start;
|
667
|
+
this.end = props.end;
|
668
|
+
}
|
669
|
+
|
670
|
+
this.flags = 0;
|
671
|
+
}, {
|
466
672
|
$documentation: "An expandible argument, such as ...rest, a splat, such as [1,2,...all], or an expansion in a variable declaration, such as var [first, ...rest] = list",
|
467
673
|
$propdoc: {
|
468
674
|
expression: "[AST_Node] the thing to be expanded"
|
@@ -477,80 +683,200 @@ var AST_Expansion = DEFNODE("Expansion", "expression", {
|
|
477
683
|
},
|
478
684
|
});
|
479
685
|
|
480
|
-
var AST_Lambda = DEFNODE(
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
686
|
+
var AST_Lambda = DEFNODE(
|
687
|
+
"Lambda",
|
688
|
+
"name argnames uses_arguments is_generator async",
|
689
|
+
function AST_Lambda(props) {
|
690
|
+
if (props) {
|
691
|
+
this.name = props.name;
|
692
|
+
this.argnames = props.argnames;
|
693
|
+
this.uses_arguments = props.uses_arguments;
|
694
|
+
this.is_generator = props.is_generator;
|
695
|
+
this.async = props.async;
|
696
|
+
this.variables = props.variables;
|
697
|
+
this.functions = props.functions;
|
698
|
+
this.uses_with = props.uses_with;
|
699
|
+
this.uses_eval = props.uses_eval;
|
700
|
+
this.parent_scope = props.parent_scope;
|
701
|
+
this.enclosed = props.enclosed;
|
702
|
+
this.cname = props.cname;
|
703
|
+
this.body = props.body;
|
704
|
+
this.block_scope = props.block_scope;
|
705
|
+
this.start = props.start;
|
706
|
+
this.end = props.end;
|
497
707
|
}
|
498
|
-
|
708
|
+
|
709
|
+
this.flags = 0;
|
499
710
|
},
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
711
|
+
{
|
712
|
+
$documentation: "Base class for functions",
|
713
|
+
$propdoc: {
|
714
|
+
name: "[AST_SymbolDeclaration?] the name of this function",
|
715
|
+
argnames: "[AST_SymbolFunarg|AST_Destructuring|AST_Expansion|AST_DefaultAssign*] array of function arguments, destructurings, or expanding arguments",
|
716
|
+
uses_arguments: "[boolean/S] tells whether this function accesses the arguments array",
|
717
|
+
is_generator: "[boolean] is this a generator method",
|
718
|
+
async: "[boolean] is this method async",
|
719
|
+
},
|
720
|
+
args_as_names: function () {
|
721
|
+
var out = [];
|
722
|
+
for (var i = 0; i < this.argnames.length; i++) {
|
723
|
+
if (this.argnames[i] instanceof AST_Destructuring) {
|
724
|
+
out.push(...this.argnames[i].all_symbols());
|
725
|
+
} else {
|
726
|
+
out.push(this.argnames[i]);
|
727
|
+
}
|
506
728
|
}
|
507
|
-
|
508
|
-
}
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
729
|
+
return out;
|
730
|
+
},
|
731
|
+
_walk: function(visitor) {
|
732
|
+
return visitor._visit(this, function() {
|
733
|
+
if (this.name) this.name._walk(visitor);
|
734
|
+
var argnames = this.argnames;
|
735
|
+
for (var i = 0, len = argnames.length; i < len; i++) {
|
736
|
+
argnames[i]._walk(visitor);
|
737
|
+
}
|
738
|
+
walk_body(this, visitor);
|
739
|
+
});
|
740
|
+
},
|
741
|
+
_children_backwards(push) {
|
742
|
+
let i = this.body.length;
|
743
|
+
while (i--) push(this.body[i]);
|
513
744
|
|
514
|
-
|
515
|
-
|
745
|
+
i = this.argnames.length;
|
746
|
+
while (i--) push(this.argnames[i]);
|
516
747
|
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
748
|
+
if (this.name) push(this.name);
|
749
|
+
},
|
750
|
+
is_braceless() {
|
751
|
+
return this.body[0] instanceof AST_Return && this.body[0].value;
|
752
|
+
},
|
753
|
+
// Default args and expansion don't count, so .argnames.length doesn't cut it
|
754
|
+
length_property() {
|
755
|
+
let length = 0;
|
525
756
|
|
526
|
-
|
527
|
-
|
528
|
-
|
757
|
+
for (const arg of this.argnames) {
|
758
|
+
if (arg instanceof AST_SymbolFunarg || arg instanceof AST_Destructuring) {
|
759
|
+
length++;
|
760
|
+
}
|
529
761
|
}
|
530
|
-
}
|
531
762
|
|
532
|
-
|
763
|
+
return length;
|
764
|
+
}
|
765
|
+
},
|
766
|
+
AST_Scope
|
767
|
+
);
|
768
|
+
|
769
|
+
var AST_Accessor = DEFNODE("Accessor", null, function AST_Accessor(props) {
|
770
|
+
if (props) {
|
771
|
+
this.name = props.name;
|
772
|
+
this.argnames = props.argnames;
|
773
|
+
this.uses_arguments = props.uses_arguments;
|
774
|
+
this.is_generator = props.is_generator;
|
775
|
+
this.async = props.async;
|
776
|
+
this.variables = props.variables;
|
777
|
+
this.functions = props.functions;
|
778
|
+
this.uses_with = props.uses_with;
|
779
|
+
this.uses_eval = props.uses_eval;
|
780
|
+
this.parent_scope = props.parent_scope;
|
781
|
+
this.enclosed = props.enclosed;
|
782
|
+
this.cname = props.cname;
|
783
|
+
this.body = props.body;
|
784
|
+
this.block_scope = props.block_scope;
|
785
|
+
this.start = props.start;
|
786
|
+
this.end = props.end;
|
533
787
|
}
|
534
|
-
}, AST_Scope);
|
535
788
|
|
536
|
-
|
789
|
+
this.flags = 0;
|
790
|
+
}, {
|
537
791
|
$documentation: "A setter/getter function. The `name` property is always null."
|
538
792
|
}, AST_Lambda);
|
539
793
|
|
540
|
-
var AST_Function = DEFNODE("Function", null, {
|
794
|
+
var AST_Function = DEFNODE("Function", null, function AST_Function(props) {
|
795
|
+
if (props) {
|
796
|
+
this.name = props.name;
|
797
|
+
this.argnames = props.argnames;
|
798
|
+
this.uses_arguments = props.uses_arguments;
|
799
|
+
this.is_generator = props.is_generator;
|
800
|
+
this.async = props.async;
|
801
|
+
this.variables = props.variables;
|
802
|
+
this.functions = props.functions;
|
803
|
+
this.uses_with = props.uses_with;
|
804
|
+
this.uses_eval = props.uses_eval;
|
805
|
+
this.parent_scope = props.parent_scope;
|
806
|
+
this.enclosed = props.enclosed;
|
807
|
+
this.cname = props.cname;
|
808
|
+
this.body = props.body;
|
809
|
+
this.block_scope = props.block_scope;
|
810
|
+
this.start = props.start;
|
811
|
+
this.end = props.end;
|
812
|
+
}
|
813
|
+
|
814
|
+
this.flags = 0;
|
815
|
+
}, {
|
541
816
|
$documentation: "A function expression"
|
542
817
|
}, AST_Lambda);
|
543
818
|
|
544
|
-
var AST_Arrow = DEFNODE("Arrow", null, {
|
819
|
+
var AST_Arrow = DEFNODE("Arrow", null, function AST_Arrow(props) {
|
820
|
+
if (props) {
|
821
|
+
this.name = props.name;
|
822
|
+
this.argnames = props.argnames;
|
823
|
+
this.uses_arguments = props.uses_arguments;
|
824
|
+
this.is_generator = props.is_generator;
|
825
|
+
this.async = props.async;
|
826
|
+
this.variables = props.variables;
|
827
|
+
this.functions = props.functions;
|
828
|
+
this.uses_with = props.uses_with;
|
829
|
+
this.uses_eval = props.uses_eval;
|
830
|
+
this.parent_scope = props.parent_scope;
|
831
|
+
this.enclosed = props.enclosed;
|
832
|
+
this.cname = props.cname;
|
833
|
+
this.body = props.body;
|
834
|
+
this.block_scope = props.block_scope;
|
835
|
+
this.start = props.start;
|
836
|
+
this.end = props.end;
|
837
|
+
}
|
838
|
+
|
839
|
+
this.flags = 0;
|
840
|
+
}, {
|
545
841
|
$documentation: "An ES6 Arrow function ((a) => b)"
|
546
842
|
}, AST_Lambda);
|
547
843
|
|
548
|
-
var AST_Defun = DEFNODE("Defun", null, {
|
844
|
+
var AST_Defun = DEFNODE("Defun", null, function AST_Defun(props) {
|
845
|
+
if (props) {
|
846
|
+
this.name = props.name;
|
847
|
+
this.argnames = props.argnames;
|
848
|
+
this.uses_arguments = props.uses_arguments;
|
849
|
+
this.is_generator = props.is_generator;
|
850
|
+
this.async = props.async;
|
851
|
+
this.variables = props.variables;
|
852
|
+
this.functions = props.functions;
|
853
|
+
this.uses_with = props.uses_with;
|
854
|
+
this.uses_eval = props.uses_eval;
|
855
|
+
this.parent_scope = props.parent_scope;
|
856
|
+
this.enclosed = props.enclosed;
|
857
|
+
this.cname = props.cname;
|
858
|
+
this.body = props.body;
|
859
|
+
this.block_scope = props.block_scope;
|
860
|
+
this.start = props.start;
|
861
|
+
this.end = props.end;
|
862
|
+
}
|
863
|
+
|
864
|
+
this.flags = 0;
|
865
|
+
}, {
|
549
866
|
$documentation: "A function definition"
|
550
867
|
}, AST_Lambda);
|
551
868
|
|
552
869
|
/* -----[ DESTRUCTURING ]----- */
|
553
|
-
var AST_Destructuring = DEFNODE("Destructuring", "names is_array", {
|
870
|
+
var AST_Destructuring = DEFNODE("Destructuring", "names is_array", function AST_Destructuring(props) {
|
871
|
+
if (props) {
|
872
|
+
this.names = props.names;
|
873
|
+
this.is_array = props.is_array;
|
874
|
+
this.start = props.start;
|
875
|
+
this.end = props.end;
|
876
|
+
}
|
877
|
+
|
878
|
+
this.flags = 0;
|
879
|
+
}, {
|
554
880
|
$documentation: "A destructuring of several names. Used in destructuring assignment and with destructuring function argument names",
|
555
881
|
$propdoc: {
|
556
882
|
"names": "[AST_Node*] Array of properties or elements",
|
@@ -578,25 +904,47 @@ var AST_Destructuring = DEFNODE("Destructuring", "names is_array", {
|
|
578
904
|
}
|
579
905
|
});
|
580
906
|
|
581
|
-
var AST_PrefixedTemplateString = DEFNODE(
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
this.
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
_children_backwards(push) {
|
594
|
-
push(this.template_string);
|
595
|
-
push(this.prefix);
|
907
|
+
var AST_PrefixedTemplateString = DEFNODE(
|
908
|
+
"PrefixedTemplateString",
|
909
|
+
"template_string prefix",
|
910
|
+
function AST_PrefixedTemplateString(props) {
|
911
|
+
if (props) {
|
912
|
+
this.template_string = props.template_string;
|
913
|
+
this.prefix = props.prefix;
|
914
|
+
this.start = props.start;
|
915
|
+
this.end = props.end;
|
916
|
+
}
|
917
|
+
|
918
|
+
this.flags = 0;
|
596
919
|
},
|
597
|
-
|
920
|
+
{
|
921
|
+
$documentation: "A templatestring with a prefix, such as String.raw`foobarbaz`",
|
922
|
+
$propdoc: {
|
923
|
+
template_string: "[AST_TemplateString] The template string",
|
924
|
+
prefix: "[AST_Node] The prefix, which will get called."
|
925
|
+
},
|
926
|
+
_walk: function(visitor) {
|
927
|
+
return visitor._visit(this, function () {
|
928
|
+
this.prefix._walk(visitor);
|
929
|
+
this.template_string._walk(visitor);
|
930
|
+
});
|
931
|
+
},
|
932
|
+
_children_backwards(push) {
|
933
|
+
push(this.template_string);
|
934
|
+
push(this.prefix);
|
935
|
+
},
|
936
|
+
}
|
937
|
+
);
|
938
|
+
|
939
|
+
var AST_TemplateString = DEFNODE("TemplateString", "segments", function AST_TemplateString(props) {
|
940
|
+
if (props) {
|
941
|
+
this.segments = props.segments;
|
942
|
+
this.start = props.start;
|
943
|
+
this.end = props.end;
|
944
|
+
}
|
598
945
|
|
599
|
-
|
946
|
+
this.flags = 0;
|
947
|
+
}, {
|
600
948
|
$documentation: "A template string literal",
|
601
949
|
$propdoc: {
|
602
950
|
segments: "[AST_Node*] One or more segments, starting with AST_TemplateSegment. AST_Node may follow AST_TemplateSegment, but each AST_Node must be followed by AST_TemplateSegment."
|
@@ -614,7 +962,16 @@ var AST_TemplateString = DEFNODE("TemplateString", "segments", {
|
|
614
962
|
}
|
615
963
|
});
|
616
964
|
|
617
|
-
var AST_TemplateSegment = DEFNODE("TemplateSegment", "value raw", {
|
965
|
+
var AST_TemplateSegment = DEFNODE("TemplateSegment", "value raw", function AST_TemplateSegment(props) {
|
966
|
+
if (props) {
|
967
|
+
this.value = props.value;
|
968
|
+
this.raw = props.raw;
|
969
|
+
this.start = props.start;
|
970
|
+
this.end = props.end;
|
971
|
+
}
|
972
|
+
|
973
|
+
this.flags = 0;
|
974
|
+
}, {
|
618
975
|
$documentation: "A segment of a template string literal",
|
619
976
|
$propdoc: {
|
620
977
|
value: "Content of the segment",
|
@@ -624,11 +981,26 @@ var AST_TemplateSegment = DEFNODE("TemplateSegment", "value raw", {
|
|
624
981
|
|
625
982
|
/* -----[ JUMPS ]----- */
|
626
983
|
|
627
|
-
var AST_Jump = DEFNODE("Jump", null, {
|
984
|
+
var AST_Jump = DEFNODE("Jump", null, function AST_Jump(props) {
|
985
|
+
if (props) {
|
986
|
+
this.start = props.start;
|
987
|
+
this.end = props.end;
|
988
|
+
}
|
989
|
+
|
990
|
+
this.flags = 0;
|
991
|
+
}, {
|
628
992
|
$documentation: "Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"
|
629
993
|
}, AST_Statement);
|
630
994
|
|
631
|
-
var AST_Exit = DEFNODE("Exit", "value", {
|
995
|
+
var AST_Exit = DEFNODE("Exit", "value", function AST_Exit(props) {
|
996
|
+
if (props) {
|
997
|
+
this.value = props.value;
|
998
|
+
this.start = props.start;
|
999
|
+
this.end = props.end;
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
this.flags = 0;
|
1003
|
+
}, {
|
632
1004
|
$documentation: "Base class for “exits” (`return` and `throw`)",
|
633
1005
|
$propdoc: {
|
634
1006
|
value: "[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"
|
@@ -643,15 +1015,39 @@ var AST_Exit = DEFNODE("Exit", "value", {
|
|
643
1015
|
},
|
644
1016
|
}, AST_Jump);
|
645
1017
|
|
646
|
-
var AST_Return = DEFNODE("Return", null, {
|
1018
|
+
var AST_Return = DEFNODE("Return", null, function AST_Return(props) {
|
1019
|
+
if (props) {
|
1020
|
+
this.value = props.value;
|
1021
|
+
this.start = props.start;
|
1022
|
+
this.end = props.end;
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
this.flags = 0;
|
1026
|
+
}, {
|
647
1027
|
$documentation: "A `return` statement"
|
648
1028
|
}, AST_Exit);
|
649
1029
|
|
650
|
-
var AST_Throw = DEFNODE("Throw", null, {
|
1030
|
+
var AST_Throw = DEFNODE("Throw", null, function AST_Throw(props) {
|
1031
|
+
if (props) {
|
1032
|
+
this.value = props.value;
|
1033
|
+
this.start = props.start;
|
1034
|
+
this.end = props.end;
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
this.flags = 0;
|
1038
|
+
}, {
|
651
1039
|
$documentation: "A `throw` statement"
|
652
1040
|
}, AST_Exit);
|
653
1041
|
|
654
|
-
var AST_LoopControl = DEFNODE("LoopControl", "label", {
|
1042
|
+
var AST_LoopControl = DEFNODE("LoopControl", "label", function AST_LoopControl(props) {
|
1043
|
+
if (props) {
|
1044
|
+
this.label = props.label;
|
1045
|
+
this.start = props.start;
|
1046
|
+
this.end = props.end;
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
this.flags = 0;
|
1050
|
+
}, {
|
655
1051
|
$documentation: "Base class for loop control statements (`break` and `continue`)",
|
656
1052
|
$propdoc: {
|
657
1053
|
label: "[AST_LabelRef?] the label, or null if none",
|
@@ -666,15 +1062,39 @@ var AST_LoopControl = DEFNODE("LoopControl", "label", {
|
|
666
1062
|
},
|
667
1063
|
}, AST_Jump);
|
668
1064
|
|
669
|
-
var AST_Break = DEFNODE("Break", null, {
|
1065
|
+
var AST_Break = DEFNODE("Break", null, function AST_Break(props) {
|
1066
|
+
if (props) {
|
1067
|
+
this.label = props.label;
|
1068
|
+
this.start = props.start;
|
1069
|
+
this.end = props.end;
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
this.flags = 0;
|
1073
|
+
}, {
|
670
1074
|
$documentation: "A `break` statement"
|
671
1075
|
}, AST_LoopControl);
|
672
1076
|
|
673
|
-
var AST_Continue = DEFNODE("Continue", null, {
|
1077
|
+
var AST_Continue = DEFNODE("Continue", null, function AST_Continue(props) {
|
1078
|
+
if (props) {
|
1079
|
+
this.label = props.label;
|
1080
|
+
this.start = props.start;
|
1081
|
+
this.end = props.end;
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
this.flags = 0;
|
1085
|
+
}, {
|
674
1086
|
$documentation: "A `continue` statement"
|
675
1087
|
}, AST_LoopControl);
|
676
1088
|
|
677
|
-
var AST_Await = DEFNODE("Await", "expression", {
|
1089
|
+
var AST_Await = DEFNODE("Await", "expression", function AST_Await(props) {
|
1090
|
+
if (props) {
|
1091
|
+
this.expression = props.expression;
|
1092
|
+
this.start = props.start;
|
1093
|
+
this.end = props.end;
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
this.flags = 0;
|
1097
|
+
}, {
|
678
1098
|
$documentation: "An `await` statement",
|
679
1099
|
$propdoc: {
|
680
1100
|
expression: "[AST_Node] the mandatory expression being awaited",
|
@@ -689,7 +1109,16 @@ var AST_Await = DEFNODE("Await", "expression", {
|
|
689
1109
|
},
|
690
1110
|
});
|
691
1111
|
|
692
|
-
var AST_Yield = DEFNODE("Yield", "expression is_star", {
|
1112
|
+
var AST_Yield = DEFNODE("Yield", "expression is_star", function AST_Yield(props) {
|
1113
|
+
if (props) {
|
1114
|
+
this.expression = props.expression;
|
1115
|
+
this.is_star = props.is_star;
|
1116
|
+
this.start = props.start;
|
1117
|
+
this.end = props.end;
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
this.flags = 0;
|
1121
|
+
}, {
|
693
1122
|
$documentation: "A `yield` statement",
|
694
1123
|
$propdoc: {
|
695
1124
|
expression: "[AST_Node?] the value returned or thrown by this statement; could be null (representing undefined) but only when is_star is set to false",
|
@@ -707,7 +1136,17 @@ var AST_Yield = DEFNODE("Yield", "expression is_star", {
|
|
707
1136
|
|
708
1137
|
/* -----[ IF ]----- */
|
709
1138
|
|
710
|
-
var AST_If = DEFNODE("If", "condition alternative", {
|
1139
|
+
var AST_If = DEFNODE("If", "condition alternative", function AST_If(props) {
|
1140
|
+
if (props) {
|
1141
|
+
this.condition = props.condition;
|
1142
|
+
this.alternative = props.alternative;
|
1143
|
+
this.body = props.body;
|
1144
|
+
this.start = props.start;
|
1145
|
+
this.end = props.end;
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
this.flags = 0;
|
1149
|
+
}, {
|
711
1150
|
$documentation: "A `if` statement",
|
712
1151
|
$propdoc: {
|
713
1152
|
condition: "[AST_Node] the `if` condition",
|
@@ -731,7 +1170,17 @@ var AST_If = DEFNODE("If", "condition alternative", {
|
|
731
1170
|
|
732
1171
|
/* -----[ SWITCH ]----- */
|
733
1172
|
|
734
|
-
var AST_Switch = DEFNODE("Switch", "expression", {
|
1173
|
+
var AST_Switch = DEFNODE("Switch", "expression", function AST_Switch(props) {
|
1174
|
+
if (props) {
|
1175
|
+
this.expression = props.expression;
|
1176
|
+
this.body = props.body;
|
1177
|
+
this.block_scope = props.block_scope;
|
1178
|
+
this.start = props.start;
|
1179
|
+
this.end = props.end;
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
this.flags = 0;
|
1183
|
+
}, {
|
735
1184
|
$documentation: "A `switch` statement",
|
736
1185
|
$propdoc: {
|
737
1186
|
expression: "[AST_Node] the `switch` “discriminant”"
|
@@ -749,15 +1198,43 @@ var AST_Switch = DEFNODE("Switch", "expression", {
|
|
749
1198
|
}
|
750
1199
|
}, AST_Block);
|
751
1200
|
|
752
|
-
var AST_SwitchBranch = DEFNODE("SwitchBranch", null, {
|
1201
|
+
var AST_SwitchBranch = DEFNODE("SwitchBranch", null, function AST_SwitchBranch(props) {
|
1202
|
+
if (props) {
|
1203
|
+
this.body = props.body;
|
1204
|
+
this.block_scope = props.block_scope;
|
1205
|
+
this.start = props.start;
|
1206
|
+
this.end = props.end;
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
this.flags = 0;
|
1210
|
+
}, {
|
753
1211
|
$documentation: "Base class for `switch` branches",
|
754
1212
|
}, AST_Block);
|
755
1213
|
|
756
|
-
var AST_Default = DEFNODE("Default", null, {
|
1214
|
+
var AST_Default = DEFNODE("Default", null, function AST_Default(props) {
|
1215
|
+
if (props) {
|
1216
|
+
this.body = props.body;
|
1217
|
+
this.block_scope = props.block_scope;
|
1218
|
+
this.start = props.start;
|
1219
|
+
this.end = props.end;
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
this.flags = 0;
|
1223
|
+
}, {
|
757
1224
|
$documentation: "A `default` switch branch",
|
758
1225
|
}, AST_SwitchBranch);
|
759
1226
|
|
760
|
-
var AST_Case = DEFNODE("Case", "expression", {
|
1227
|
+
var AST_Case = DEFNODE("Case", "expression", function AST_Case(props) {
|
1228
|
+
if (props) {
|
1229
|
+
this.expression = props.expression;
|
1230
|
+
this.body = props.body;
|
1231
|
+
this.block_scope = props.block_scope;
|
1232
|
+
this.start = props.start;
|
1233
|
+
this.end = props.end;
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
this.flags = 0;
|
1237
|
+
}, {
|
761
1238
|
$documentation: "A `case` switch branch",
|
762
1239
|
$propdoc: {
|
763
1240
|
expression: "[AST_Node] the `case` expression"
|
@@ -777,7 +1254,18 @@ var AST_Case = DEFNODE("Case", "expression", {
|
|
777
1254
|
|
778
1255
|
/* -----[ EXCEPTIONS ]----- */
|
779
1256
|
|
780
|
-
var AST_Try = DEFNODE("Try", "bcatch bfinally", {
|
1257
|
+
var AST_Try = DEFNODE("Try", "bcatch bfinally", function AST_Try(props) {
|
1258
|
+
if (props) {
|
1259
|
+
this.bcatch = props.bcatch;
|
1260
|
+
this.bfinally = props.bfinally;
|
1261
|
+
this.body = props.body;
|
1262
|
+
this.block_scope = props.block_scope;
|
1263
|
+
this.start = props.start;
|
1264
|
+
this.end = props.end;
|
1265
|
+
}
|
1266
|
+
|
1267
|
+
this.flags = 0;
|
1268
|
+
}, {
|
781
1269
|
$documentation: "A `try` statement",
|
782
1270
|
$propdoc: {
|
783
1271
|
bcatch: "[AST_Catch?] the catch block, or null if not present",
|
@@ -798,7 +1286,17 @@ var AST_Try = DEFNODE("Try", "bcatch bfinally", {
|
|
798
1286
|
},
|
799
1287
|
}, AST_Block);
|
800
1288
|
|
801
|
-
var AST_Catch = DEFNODE("Catch", "argname", {
|
1289
|
+
var AST_Catch = DEFNODE("Catch", "argname", function AST_Catch(props) {
|
1290
|
+
if (props) {
|
1291
|
+
this.argname = props.argname;
|
1292
|
+
this.body = props.body;
|
1293
|
+
this.block_scope = props.block_scope;
|
1294
|
+
this.start = props.start;
|
1295
|
+
this.end = props.end;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
this.flags = 0;
|
1299
|
+
}, {
|
802
1300
|
$documentation: "A `catch` node; only makes sense as part of a `try` statement",
|
803
1301
|
$propdoc: {
|
804
1302
|
argname: "[AST_SymbolCatch|AST_Destructuring|AST_Expansion|AST_DefaultAssign] symbol for the exception"
|
@@ -816,13 +1314,30 @@ var AST_Catch = DEFNODE("Catch", "argname", {
|
|
816
1314
|
},
|
817
1315
|
}, AST_Block);
|
818
1316
|
|
819
|
-
var AST_Finally = DEFNODE("Finally", null, {
|
1317
|
+
var AST_Finally = DEFNODE("Finally", null, function AST_Finally(props) {
|
1318
|
+
if (props) {
|
1319
|
+
this.body = props.body;
|
1320
|
+
this.block_scope = props.block_scope;
|
1321
|
+
this.start = props.start;
|
1322
|
+
this.end = props.end;
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
this.flags = 0;
|
1326
|
+
}, {
|
820
1327
|
$documentation: "A `finally` node; only makes sense as part of a `try` statement"
|
821
1328
|
}, AST_Block);
|
822
1329
|
|
823
1330
|
/* -----[ VAR/CONST ]----- */
|
824
1331
|
|
825
|
-
var AST_Definitions = DEFNODE("Definitions", "definitions", {
|
1332
|
+
var AST_Definitions = DEFNODE("Definitions", "definitions", function AST_Definitions(props) {
|
1333
|
+
if (props) {
|
1334
|
+
this.definitions = props.definitions;
|
1335
|
+
this.start = props.start;
|
1336
|
+
this.end = props.end;
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
this.flags = 0;
|
1340
|
+
}, {
|
826
1341
|
$documentation: "Base class for `var` or `const` nodes (variable declarations/initializations)",
|
827
1342
|
$propdoc: {
|
828
1343
|
definitions: "[AST_VarDef*] array of variable definitions"
|
@@ -841,19 +1356,52 @@ var AST_Definitions = DEFNODE("Definitions", "definitions", {
|
|
841
1356
|
},
|
842
1357
|
}, AST_Statement);
|
843
1358
|
|
844
|
-
var AST_Var = DEFNODE("Var", null, {
|
1359
|
+
var AST_Var = DEFNODE("Var", null, function AST_Var(props) {
|
1360
|
+
if (props) {
|
1361
|
+
this.definitions = props.definitions;
|
1362
|
+
this.start = props.start;
|
1363
|
+
this.end = props.end;
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
this.flags = 0;
|
1367
|
+
}, {
|
845
1368
|
$documentation: "A `var` statement"
|
846
1369
|
}, AST_Definitions);
|
847
1370
|
|
848
|
-
var AST_Let = DEFNODE("Let", null, {
|
1371
|
+
var AST_Let = DEFNODE("Let", null, function AST_Let(props) {
|
1372
|
+
if (props) {
|
1373
|
+
this.definitions = props.definitions;
|
1374
|
+
this.start = props.start;
|
1375
|
+
this.end = props.end;
|
1376
|
+
}
|
1377
|
+
|
1378
|
+
this.flags = 0;
|
1379
|
+
}, {
|
849
1380
|
$documentation: "A `let` statement"
|
850
1381
|
}, AST_Definitions);
|
851
1382
|
|
852
|
-
var AST_Const = DEFNODE("Const", null, {
|
1383
|
+
var AST_Const = DEFNODE("Const", null, function AST_Const(props) {
|
1384
|
+
if (props) {
|
1385
|
+
this.definitions = props.definitions;
|
1386
|
+
this.start = props.start;
|
1387
|
+
this.end = props.end;
|
1388
|
+
}
|
1389
|
+
|
1390
|
+
this.flags = 0;
|
1391
|
+
}, {
|
853
1392
|
$documentation: "A `const` statement"
|
854
1393
|
}, AST_Definitions);
|
855
1394
|
|
856
|
-
var AST_VarDef = DEFNODE("VarDef", "name value", {
|
1395
|
+
var AST_VarDef = DEFNODE("VarDef", "name value", function AST_VarDef(props) {
|
1396
|
+
if (props) {
|
1397
|
+
this.name = props.name;
|
1398
|
+
this.value = props.value;
|
1399
|
+
this.start = props.start;
|
1400
|
+
this.end = props.end;
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
this.flags = 0;
|
1404
|
+
}, {
|
857
1405
|
$documentation: "A variable declaration; only appears in a AST_Definitions node",
|
858
1406
|
$propdoc: {
|
859
1407
|
name: "[AST_Destructuring|AST_SymbolConst|AST_SymbolLet|AST_SymbolVar] name of the variable",
|
@@ -871,7 +1419,16 @@ var AST_VarDef = DEFNODE("VarDef", "name value", {
|
|
871
1419
|
},
|
872
1420
|
});
|
873
1421
|
|
874
|
-
var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", {
|
1422
|
+
var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", function AST_NameMapping(props) {
|
1423
|
+
if (props) {
|
1424
|
+
this.foreign_name = props.foreign_name;
|
1425
|
+
this.name = props.name;
|
1426
|
+
this.start = props.start;
|
1427
|
+
this.end = props.end;
|
1428
|
+
}
|
1429
|
+
|
1430
|
+
this.flags = 0;
|
1431
|
+
}, {
|
875
1432
|
$documentation: "The part of the export/import statement that declare names from a module.",
|
876
1433
|
$propdoc: {
|
877
1434
|
foreign_name: "[AST_SymbolExportForeign|AST_SymbolImportForeign] The name being exported/imported (as specified in the module)",
|
@@ -889,114 +1446,193 @@ var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", {
|
|
889
1446
|
},
|
890
1447
|
});
|
891
1448
|
|
892
|
-
var AST_Import = DEFNODE(
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
1449
|
+
var AST_Import = DEFNODE(
|
1450
|
+
"Import",
|
1451
|
+
"imported_name imported_names module_name assert_clause",
|
1452
|
+
function AST_Import(props) {
|
1453
|
+
if (props) {
|
1454
|
+
this.imported_name = props.imported_name;
|
1455
|
+
this.imported_names = props.imported_names;
|
1456
|
+
this.module_name = props.module_name;
|
1457
|
+
this.assert_clause = props.assert_clause;
|
1458
|
+
this.start = props.start;
|
1459
|
+
this.end = props.end;
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
this.flags = 0;
|
899
1463
|
},
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
1464
|
+
{
|
1465
|
+
$documentation: "An `import` statement",
|
1466
|
+
$propdoc: {
|
1467
|
+
imported_name: "[AST_SymbolImport] The name of the variable holding the module's default export.",
|
1468
|
+
imported_names: "[AST_NameMapping*] The names of non-default imported variables",
|
1469
|
+
module_name: "[AST_String] String literal describing where this module came from",
|
1470
|
+
assert_clause: "[AST_Object?] The import assertion"
|
1471
|
+
},
|
1472
|
+
_walk: function(visitor) {
|
1473
|
+
return visitor._visit(this, function() {
|
1474
|
+
if (this.imported_name) {
|
1475
|
+
this.imported_name._walk(visitor);
|
1476
|
+
}
|
1477
|
+
if (this.imported_names) {
|
1478
|
+
this.imported_names.forEach(function(name_import) {
|
1479
|
+
name_import._walk(visitor);
|
1480
|
+
});
|
1481
|
+
}
|
1482
|
+
this.module_name._walk(visitor);
|
1483
|
+
});
|
1484
|
+
},
|
1485
|
+
_children_backwards(push) {
|
1486
|
+
push(this.module_name);
|
905
1487
|
if (this.imported_names) {
|
906
|
-
this.imported_names.
|
907
|
-
|
908
|
-
});
|
1488
|
+
let i = this.imported_names.length;
|
1489
|
+
while (i--) push(this.imported_names[i]);
|
909
1490
|
}
|
910
|
-
this.
|
911
|
-
}
|
912
|
-
}
|
913
|
-
|
914
|
-
push(this.module_name);
|
915
|
-
if (this.imported_names) {
|
916
|
-
let i = this.imported_names.length;
|
917
|
-
while (i--) push(this.imported_names[i]);
|
918
|
-
}
|
919
|
-
if (this.imported_name) push(this.imported_name);
|
920
|
-
},
|
921
|
-
});
|
1491
|
+
if (this.imported_name) push(this.imported_name);
|
1492
|
+
},
|
1493
|
+
}
|
1494
|
+
);
|
922
1495
|
|
923
|
-
var AST_ImportMeta = DEFNODE("ImportMeta", null, {
|
1496
|
+
var AST_ImportMeta = DEFNODE("ImportMeta", null, function AST_ImportMeta(props) {
|
1497
|
+
if (props) {
|
1498
|
+
this.start = props.start;
|
1499
|
+
this.end = props.end;
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
this.flags = 0;
|
1503
|
+
}, {
|
924
1504
|
$documentation: "A reference to import.meta",
|
925
1505
|
});
|
926
1506
|
|
927
|
-
var AST_Export = DEFNODE(
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
1507
|
+
var AST_Export = DEFNODE(
|
1508
|
+
"Export",
|
1509
|
+
"exported_definition exported_value is_default exported_names module_name assert_clause",
|
1510
|
+
function AST_Export(props) {
|
1511
|
+
if (props) {
|
1512
|
+
this.exported_definition = props.exported_definition;
|
1513
|
+
this.exported_value = props.exported_value;
|
1514
|
+
this.is_default = props.is_default;
|
1515
|
+
this.exported_names = props.exported_names;
|
1516
|
+
this.module_name = props.module_name;
|
1517
|
+
this.assert_clause = props.assert_clause;
|
1518
|
+
this.start = props.start;
|
1519
|
+
this.end = props.end;
|
1520
|
+
}
|
1521
|
+
|
1522
|
+
this.flags = 0;
|
1523
|
+
},
|
1524
|
+
{
|
1525
|
+
$documentation: "An `export` statement",
|
1526
|
+
$propdoc: {
|
1527
|
+
exported_definition: "[AST_Defun|AST_Definitions|AST_DefClass?] An exported definition",
|
1528
|
+
exported_value: "[AST_Node?] An exported value",
|
1529
|
+
exported_names: "[AST_NameMapping*?] List of exported names",
|
1530
|
+
module_name: "[AST_String?] Name of the file to load exports from",
|
1531
|
+
is_default: "[Boolean] Whether this is the default exported value of this module",
|
1532
|
+
assert_clause: "[AST_Object?] The import assertion"
|
1533
|
+
},
|
1534
|
+
_walk: function (visitor) {
|
1535
|
+
return visitor._visit(this, function () {
|
1536
|
+
if (this.exported_definition) {
|
1537
|
+
this.exported_definition._walk(visitor);
|
1538
|
+
}
|
1539
|
+
if (this.exported_value) {
|
1540
|
+
this.exported_value._walk(visitor);
|
1541
|
+
}
|
1542
|
+
if (this.exported_names) {
|
1543
|
+
this.exported_names.forEach(function(name_export) {
|
1544
|
+
name_export._walk(visitor);
|
1545
|
+
});
|
1546
|
+
}
|
1547
|
+
if (this.module_name) {
|
1548
|
+
this.module_name._walk(visitor);
|
1549
|
+
}
|
1550
|
+
});
|
1551
|
+
},
|
1552
|
+
_children_backwards(push) {
|
1553
|
+
if (this.module_name) push(this.module_name);
|
945
1554
|
if (this.exported_names) {
|
946
|
-
this.exported_names.
|
947
|
-
|
948
|
-
});
|
949
|
-
}
|
950
|
-
if (this.module_name) {
|
951
|
-
this.module_name._walk(visitor);
|
1555
|
+
let i = this.exported_names.length;
|
1556
|
+
while (i--) push(this.exported_names[i]);
|
952
1557
|
}
|
953
|
-
|
954
|
-
|
955
|
-
_children_backwards(push) {
|
956
|
-
if (this.module_name) push(this.module_name);
|
957
|
-
if (this.exported_names) {
|
958
|
-
let i = this.exported_names.length;
|
959
|
-
while (i--) push(this.exported_names[i]);
|
1558
|
+
if (this.exported_value) push(this.exported_value);
|
1559
|
+
if (this.exported_definition) push(this.exported_definition);
|
960
1560
|
}
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
}, AST_Statement);
|
1561
|
+
},
|
1562
|
+
AST_Statement
|
1563
|
+
);
|
965
1564
|
|
966
1565
|
/* -----[ OTHER ]----- */
|
967
1566
|
|
968
|
-
var AST_Call = DEFNODE(
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
args[i]._walk(visitor);
|
984
|
-
}
|
985
|
-
this.expression._walk(visitor); // TODO why do we need to crawl this last?
|
986
|
-
});
|
987
|
-
},
|
988
|
-
_children_backwards(push) {
|
989
|
-
let i = this.args.length;
|
990
|
-
while (i--) push(this.args[i]);
|
991
|
-
push(this.expression);
|
1567
|
+
var AST_Call = DEFNODE(
|
1568
|
+
"Call",
|
1569
|
+
"expression args optional _annotations",
|
1570
|
+
function AST_Call(props) {
|
1571
|
+
if (props) {
|
1572
|
+
this.expression = props.expression;
|
1573
|
+
this.args = props.args;
|
1574
|
+
this.optional = props.optional;
|
1575
|
+
this._annotations = props._annotations;
|
1576
|
+
this.start = props.start;
|
1577
|
+
this.end = props.end;
|
1578
|
+
this.initialize();
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
this.flags = 0;
|
992
1582
|
},
|
993
|
-
|
1583
|
+
{
|
1584
|
+
$documentation: "A function call expression",
|
1585
|
+
$propdoc: {
|
1586
|
+
expression: "[AST_Node] expression to invoke as function",
|
1587
|
+
args: "[AST_Node*] array of arguments",
|
1588
|
+
optional: "[boolean] whether this is an optional call (IE ?.() )",
|
1589
|
+
_annotations: "[number] bitfield containing information about the call"
|
1590
|
+
},
|
1591
|
+
initialize() {
|
1592
|
+
if (this._annotations == null) this._annotations = 0;
|
1593
|
+
},
|
1594
|
+
_walk(visitor) {
|
1595
|
+
return visitor._visit(this, function() {
|
1596
|
+
var args = this.args;
|
1597
|
+
for (var i = 0, len = args.length; i < len; i++) {
|
1598
|
+
args[i]._walk(visitor);
|
1599
|
+
}
|
1600
|
+
this.expression._walk(visitor); // TODO why do we need to crawl this last?
|
1601
|
+
});
|
1602
|
+
},
|
1603
|
+
_children_backwards(push) {
|
1604
|
+
let i = this.args.length;
|
1605
|
+
while (i--) push(this.args[i]);
|
1606
|
+
push(this.expression);
|
1607
|
+
},
|
1608
|
+
}
|
1609
|
+
);
|
1610
|
+
|
1611
|
+
var AST_New = DEFNODE("New", null, function AST_New(props) {
|
1612
|
+
if (props) {
|
1613
|
+
this.expression = props.expression;
|
1614
|
+
this.args = props.args;
|
1615
|
+
this.optional = props.optional;
|
1616
|
+
this._annotations = props._annotations;
|
1617
|
+
this.start = props.start;
|
1618
|
+
this.end = props.end;
|
1619
|
+
this.initialize();
|
1620
|
+
}
|
994
1621
|
|
995
|
-
|
1622
|
+
this.flags = 0;
|
1623
|
+
}, {
|
996
1624
|
$documentation: "An object instantiation. Derives from a function call since it has exactly the same properties"
|
997
1625
|
}, AST_Call);
|
998
1626
|
|
999
|
-
var AST_Sequence = DEFNODE("Sequence", "expressions", {
|
1627
|
+
var AST_Sequence = DEFNODE("Sequence", "expressions", function AST_Sequence(props) {
|
1628
|
+
if (props) {
|
1629
|
+
this.expressions = props.expressions;
|
1630
|
+
this.start = props.start;
|
1631
|
+
this.end = props.end;
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
this.flags = 0;
|
1635
|
+
}, {
|
1000
1636
|
$documentation: "A sequence expression (comma-separated expressions)",
|
1001
1637
|
$propdoc: {
|
1002
1638
|
expressions: "[AST_Node*] array of expressions (at least two)"
|
@@ -1014,17 +1650,43 @@ var AST_Sequence = DEFNODE("Sequence", "expressions", {
|
|
1014
1650
|
},
|
1015
1651
|
});
|
1016
1652
|
|
1017
|
-
var AST_PropAccess = DEFNODE(
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1653
|
+
var AST_PropAccess = DEFNODE(
|
1654
|
+
"PropAccess",
|
1655
|
+
"expression property optional",
|
1656
|
+
function AST_PropAccess(props) {
|
1657
|
+
if (props) {
|
1658
|
+
this.expression = props.expression;
|
1659
|
+
this.property = props.property;
|
1660
|
+
this.optional = props.optional;
|
1661
|
+
this.start = props.start;
|
1662
|
+
this.end = props.end;
|
1663
|
+
}
|
1664
|
+
|
1665
|
+
this.flags = 0;
|
1666
|
+
},
|
1667
|
+
{
|
1668
|
+
$documentation: "Base class for property access expressions, i.e. `a.foo` or `a[\"foo\"]`",
|
1669
|
+
$propdoc: {
|
1670
|
+
expression: "[AST_Node] the “container” expression",
|
1671
|
+
property: "[AST_Node|string] the property to access. For AST_Dot & AST_DotHash this is always a plain string, while for AST_Sub it's an arbitrary AST_Node",
|
1022
1672
|
|
1023
|
-
|
1673
|
+
optional: "[boolean] whether this is an optional property access (IE ?.)"
|
1674
|
+
}
|
1675
|
+
}
|
1676
|
+
);
|
1677
|
+
|
1678
|
+
var AST_Dot = DEFNODE("Dot", "quote", function AST_Dot(props) {
|
1679
|
+
if (props) {
|
1680
|
+
this.quote = props.quote;
|
1681
|
+
this.expression = props.expression;
|
1682
|
+
this.property = props.property;
|
1683
|
+
this.optional = props.optional;
|
1684
|
+
this.start = props.start;
|
1685
|
+
this.end = props.end;
|
1024
1686
|
}
|
1025
|
-
});
|
1026
1687
|
|
1027
|
-
|
1688
|
+
this.flags = 0;
|
1689
|
+
}, {
|
1028
1690
|
$documentation: "A dotted property access expression",
|
1029
1691
|
$propdoc: {
|
1030
1692
|
quote: "[string] the original quote character when transformed from AST_Sub",
|
@@ -1039,7 +1701,17 @@ var AST_Dot = DEFNODE("Dot", "quote", {
|
|
1039
1701
|
},
|
1040
1702
|
}, AST_PropAccess);
|
1041
1703
|
|
1042
|
-
var AST_DotHash = DEFNODE("DotHash", "", {
|
1704
|
+
var AST_DotHash = DEFNODE("DotHash", "", function AST_DotHash(props) {
|
1705
|
+
if (props) {
|
1706
|
+
this.expression = props.expression;
|
1707
|
+
this.property = props.property;
|
1708
|
+
this.optional = props.optional;
|
1709
|
+
this.start = props.start;
|
1710
|
+
this.end = props.end;
|
1711
|
+
}
|
1712
|
+
|
1713
|
+
this.flags = 0;
|
1714
|
+
}, {
|
1043
1715
|
$documentation: "A dotted property access to a private property",
|
1044
1716
|
_walk: function(visitor) {
|
1045
1717
|
return visitor._visit(this, function() {
|
@@ -1051,7 +1723,17 @@ var AST_DotHash = DEFNODE("DotHash", "", {
|
|
1051
1723
|
},
|
1052
1724
|
}, AST_PropAccess);
|
1053
1725
|
|
1054
|
-
var AST_Sub = DEFNODE("Sub", null, {
|
1726
|
+
var AST_Sub = DEFNODE("Sub", null, function AST_Sub(props) {
|
1727
|
+
if (props) {
|
1728
|
+
this.expression = props.expression;
|
1729
|
+
this.property = props.property;
|
1730
|
+
this.optional = props.optional;
|
1731
|
+
this.start = props.start;
|
1732
|
+
this.end = props.end;
|
1733
|
+
}
|
1734
|
+
|
1735
|
+
this.flags = 0;
|
1736
|
+
}, {
|
1055
1737
|
$documentation: "Index-style property access, i.e. `a[\"foo\"]`",
|
1056
1738
|
_walk: function(visitor) {
|
1057
1739
|
return visitor._visit(this, function() {
|
@@ -1065,7 +1747,15 @@ var AST_Sub = DEFNODE("Sub", null, {
|
|
1065
1747
|
},
|
1066
1748
|
}, AST_PropAccess);
|
1067
1749
|
|
1068
|
-
var AST_Chain = DEFNODE("Chain", "expression", {
|
1750
|
+
var AST_Chain = DEFNODE("Chain", "expression", function AST_Chain(props) {
|
1751
|
+
if (props) {
|
1752
|
+
this.expression = props.expression;
|
1753
|
+
this.start = props.start;
|
1754
|
+
this.end = props.end;
|
1755
|
+
}
|
1756
|
+
|
1757
|
+
this.flags = 0;
|
1758
|
+
}, {
|
1069
1759
|
$documentation: "A chain expression like a?.b?.(c)?.[d]",
|
1070
1760
|
$propdoc: {
|
1071
1761
|
expression: "[AST_Call|AST_Dot|AST_DotHash|AST_Sub] chain element."
|
@@ -1080,7 +1770,16 @@ var AST_Chain = DEFNODE("Chain", "expression", {
|
|
1080
1770
|
},
|
1081
1771
|
});
|
1082
1772
|
|
1083
|
-
var AST_Unary = DEFNODE("Unary", "operator expression", {
|
1773
|
+
var AST_Unary = DEFNODE("Unary", "operator expression", function AST_Unary(props) {
|
1774
|
+
if (props) {
|
1775
|
+
this.operator = props.operator;
|
1776
|
+
this.expression = props.expression;
|
1777
|
+
this.start = props.start;
|
1778
|
+
this.end = props.end;
|
1779
|
+
}
|
1780
|
+
|
1781
|
+
this.flags = 0;
|
1782
|
+
}, {
|
1084
1783
|
$documentation: "Base class for unary expressions",
|
1085
1784
|
$propdoc: {
|
1086
1785
|
operator: "[string] the operator",
|
@@ -1096,15 +1795,43 @@ var AST_Unary = DEFNODE("Unary", "operator expression", {
|
|
1096
1795
|
},
|
1097
1796
|
});
|
1098
1797
|
|
1099
|
-
var AST_UnaryPrefix = DEFNODE("UnaryPrefix", null, {
|
1798
|
+
var AST_UnaryPrefix = DEFNODE("UnaryPrefix", null, function AST_UnaryPrefix(props) {
|
1799
|
+
if (props) {
|
1800
|
+
this.operator = props.operator;
|
1801
|
+
this.expression = props.expression;
|
1802
|
+
this.start = props.start;
|
1803
|
+
this.end = props.end;
|
1804
|
+
}
|
1805
|
+
|
1806
|
+
this.flags = 0;
|
1807
|
+
}, {
|
1100
1808
|
$documentation: "Unary prefix expression, i.e. `typeof i` or `++i`"
|
1101
1809
|
}, AST_Unary);
|
1102
1810
|
|
1103
|
-
var AST_UnaryPostfix = DEFNODE("UnaryPostfix", null, {
|
1811
|
+
var AST_UnaryPostfix = DEFNODE("UnaryPostfix", null, function AST_UnaryPostfix(props) {
|
1812
|
+
if (props) {
|
1813
|
+
this.operator = props.operator;
|
1814
|
+
this.expression = props.expression;
|
1815
|
+
this.start = props.start;
|
1816
|
+
this.end = props.end;
|
1817
|
+
}
|
1818
|
+
|
1819
|
+
this.flags = 0;
|
1820
|
+
}, {
|
1104
1821
|
$documentation: "Unary postfix expression, i.e. `i++`"
|
1105
1822
|
}, AST_Unary);
|
1106
1823
|
|
1107
|
-
var AST_Binary = DEFNODE("Binary", "operator left right", {
|
1824
|
+
var AST_Binary = DEFNODE("Binary", "operator left right", function AST_Binary(props) {
|
1825
|
+
if (props) {
|
1826
|
+
this.operator = props.operator;
|
1827
|
+
this.left = props.left;
|
1828
|
+
this.right = props.right;
|
1829
|
+
this.start = props.start;
|
1830
|
+
this.end = props.end;
|
1831
|
+
}
|
1832
|
+
|
1833
|
+
this.flags = 0;
|
1834
|
+
}, {
|
1108
1835
|
$documentation: "Binary expression, i.e. `a + b`",
|
1109
1836
|
$propdoc: {
|
1110
1837
|
left: "[AST_Node] left-hand side expression",
|
@@ -1123,41 +1850,85 @@ var AST_Binary = DEFNODE("Binary", "operator left right", {
|
|
1123
1850
|
},
|
1124
1851
|
});
|
1125
1852
|
|
1126
|
-
var AST_Conditional = DEFNODE(
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
this.
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
},
|
1140
|
-
_children_backwards(push) {
|
1141
|
-
push(this.alternative);
|
1142
|
-
push(this.consequent);
|
1143
|
-
push(this.condition);
|
1853
|
+
var AST_Conditional = DEFNODE(
|
1854
|
+
"Conditional",
|
1855
|
+
"condition consequent alternative",
|
1856
|
+
function AST_Conditional(props) {
|
1857
|
+
if (props) {
|
1858
|
+
this.condition = props.condition;
|
1859
|
+
this.consequent = props.consequent;
|
1860
|
+
this.alternative = props.alternative;
|
1861
|
+
this.start = props.start;
|
1862
|
+
this.end = props.end;
|
1863
|
+
}
|
1864
|
+
|
1865
|
+
this.flags = 0;
|
1144
1866
|
},
|
1145
|
-
|
1867
|
+
{
|
1868
|
+
$documentation: "Conditional expression using the ternary operator, i.e. `a ? b : c`",
|
1869
|
+
$propdoc: {
|
1870
|
+
condition: "[AST_Node]",
|
1871
|
+
consequent: "[AST_Node]",
|
1872
|
+
alternative: "[AST_Node]"
|
1873
|
+
},
|
1874
|
+
_walk: function(visitor) {
|
1875
|
+
return visitor._visit(this, function() {
|
1876
|
+
this.condition._walk(visitor);
|
1877
|
+
this.consequent._walk(visitor);
|
1878
|
+
this.alternative._walk(visitor);
|
1879
|
+
});
|
1880
|
+
},
|
1881
|
+
_children_backwards(push) {
|
1882
|
+
push(this.alternative);
|
1883
|
+
push(this.consequent);
|
1884
|
+
push(this.condition);
|
1885
|
+
},
|
1886
|
+
}
|
1887
|
+
);
|
1888
|
+
|
1889
|
+
var AST_Assign = DEFNODE("Assign", "logical", function AST_Assign(props) {
|
1890
|
+
if (props) {
|
1891
|
+
this.logical = props.logical;
|
1892
|
+
this.operator = props.operator;
|
1893
|
+
this.left = props.left;
|
1894
|
+
this.right = props.right;
|
1895
|
+
this.start = props.start;
|
1896
|
+
this.end = props.end;
|
1897
|
+
}
|
1146
1898
|
|
1147
|
-
|
1899
|
+
this.flags = 0;
|
1900
|
+
}, {
|
1148
1901
|
$documentation: "An assignment expression — `a = b + 5`",
|
1149
1902
|
$propdoc: {
|
1150
1903
|
logical: "Whether it's a logical assignment"
|
1151
1904
|
}
|
1152
1905
|
}, AST_Binary);
|
1153
1906
|
|
1154
|
-
var AST_DefaultAssign = DEFNODE("DefaultAssign", null, {
|
1907
|
+
var AST_DefaultAssign = DEFNODE("DefaultAssign", null, function AST_DefaultAssign(props) {
|
1908
|
+
if (props) {
|
1909
|
+
this.operator = props.operator;
|
1910
|
+
this.left = props.left;
|
1911
|
+
this.right = props.right;
|
1912
|
+
this.start = props.start;
|
1913
|
+
this.end = props.end;
|
1914
|
+
}
|
1915
|
+
|
1916
|
+
this.flags = 0;
|
1917
|
+
}, {
|
1155
1918
|
$documentation: "A default assignment expression like in `(a = 3) => a`"
|
1156
1919
|
}, AST_Binary);
|
1157
1920
|
|
1158
1921
|
/* -----[ LITERALS ]----- */
|
1159
1922
|
|
1160
|
-
var AST_Array = DEFNODE("Array", "elements", {
|
1923
|
+
var AST_Array = DEFNODE("Array", "elements", function AST_Array(props) {
|
1924
|
+
if (props) {
|
1925
|
+
this.elements = props.elements;
|
1926
|
+
this.start = props.start;
|
1927
|
+
this.end = props.end;
|
1928
|
+
}
|
1929
|
+
|
1930
|
+
this.flags = 0;
|
1931
|
+
}, {
|
1161
1932
|
$documentation: "An array literal",
|
1162
1933
|
$propdoc: {
|
1163
1934
|
elements: "[AST_Node*] array of elements"
|
@@ -1176,7 +1947,15 @@ var AST_Array = DEFNODE("Array", "elements", {
|
|
1176
1947
|
},
|
1177
1948
|
});
|
1178
1949
|
|
1179
|
-
var AST_Object = DEFNODE("Object", "properties", {
|
1950
|
+
var AST_Object = DEFNODE("Object", "properties", function AST_Object(props) {
|
1951
|
+
if (props) {
|
1952
|
+
this.properties = props.properties;
|
1953
|
+
this.start = props.start;
|
1954
|
+
this.end = props.end;
|
1955
|
+
}
|
1956
|
+
|
1957
|
+
this.flags = 0;
|
1958
|
+
}, {
|
1180
1959
|
$documentation: "An object literal",
|
1181
1960
|
$propdoc: {
|
1182
1961
|
properties: "[AST_ObjectProperty*] array of properties"
|
@@ -1195,7 +1974,16 @@ var AST_Object = DEFNODE("Object", "properties", {
|
|
1195
1974
|
},
|
1196
1975
|
});
|
1197
1976
|
|
1198
|
-
var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", {
|
1977
|
+
var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", function AST_ObjectProperty(props) {
|
1978
|
+
if (props) {
|
1979
|
+
this.key = props.key;
|
1980
|
+
this.value = props.value;
|
1981
|
+
this.start = props.start;
|
1982
|
+
this.end = props.end;
|
1983
|
+
}
|
1984
|
+
|
1985
|
+
this.flags = 0;
|
1986
|
+
}, {
|
1199
1987
|
$documentation: "Base class for literal object properties",
|
1200
1988
|
$propdoc: {
|
1201
1989
|
key: "[string|AST_Node] property name. For ObjectKeyVal this is a string. For getters, setters and computed property this is an AST_Node.",
|
@@ -1214,7 +2002,17 @@ var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", {
|
|
1214
2002
|
}
|
1215
2003
|
});
|
1216
2004
|
|
1217
|
-
var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", {
|
2005
|
+
var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", function AST_ObjectKeyVal(props) {
|
2006
|
+
if (props) {
|
2007
|
+
this.quote = props.quote;
|
2008
|
+
this.key = props.key;
|
2009
|
+
this.value = props.value;
|
2010
|
+
this.start = props.start;
|
2011
|
+
this.end = props.end;
|
2012
|
+
}
|
2013
|
+
|
2014
|
+
this.flags = 0;
|
2015
|
+
}, {
|
1218
2016
|
$documentation: "A key: value object property",
|
1219
2017
|
$propdoc: {
|
1220
2018
|
quote: "[string] the original quote character"
|
@@ -1224,7 +2022,17 @@ var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", {
|
|
1224
2022
|
}
|
1225
2023
|
}, AST_ObjectProperty);
|
1226
2024
|
|
1227
|
-
var AST_PrivateSetter = DEFNODE("PrivateSetter", "static", {
|
2025
|
+
var AST_PrivateSetter = DEFNODE("PrivateSetter", "static", function AST_PrivateSetter(props) {
|
2026
|
+
if (props) {
|
2027
|
+
this.static = props.static;
|
2028
|
+
this.key = props.key;
|
2029
|
+
this.value = props.value;
|
2030
|
+
this.start = props.start;
|
2031
|
+
this.end = props.end;
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
this.flags = 0;
|
2035
|
+
}, {
|
1228
2036
|
$propdoc: {
|
1229
2037
|
static: "[boolean] whether this is a static private setter"
|
1230
2038
|
},
|
@@ -1234,7 +2042,17 @@ var AST_PrivateSetter = DEFNODE("PrivateSetter", "static", {
|
|
1234
2042
|
}
|
1235
2043
|
}, AST_ObjectProperty);
|
1236
2044
|
|
1237
|
-
var AST_PrivateGetter = DEFNODE("PrivateGetter", "static", {
|
2045
|
+
var AST_PrivateGetter = DEFNODE("PrivateGetter", "static", function AST_PrivateGetter(props) {
|
2046
|
+
if (props) {
|
2047
|
+
this.static = props.static;
|
2048
|
+
this.key = props.key;
|
2049
|
+
this.value = props.value;
|
2050
|
+
this.start = props.start;
|
2051
|
+
this.end = props.end;
|
2052
|
+
}
|
2053
|
+
|
2054
|
+
this.flags = 0;
|
2055
|
+
}, {
|
1238
2056
|
$propdoc: {
|
1239
2057
|
static: "[boolean] whether this is a static private getter"
|
1240
2058
|
},
|
@@ -1244,7 +2062,18 @@ var AST_PrivateGetter = DEFNODE("PrivateGetter", "static", {
|
|
1244
2062
|
}
|
1245
2063
|
}, AST_ObjectProperty);
|
1246
2064
|
|
1247
|
-
var AST_ObjectSetter = DEFNODE("ObjectSetter", "quote static", {
|
2065
|
+
var AST_ObjectSetter = DEFNODE("ObjectSetter", "quote static", function AST_ObjectSetter(props) {
|
2066
|
+
if (props) {
|
2067
|
+
this.quote = props.quote;
|
2068
|
+
this.static = props.static;
|
2069
|
+
this.key = props.key;
|
2070
|
+
this.value = props.value;
|
2071
|
+
this.start = props.start;
|
2072
|
+
this.end = props.end;
|
2073
|
+
}
|
2074
|
+
|
2075
|
+
this.flags = 0;
|
2076
|
+
}, {
|
1248
2077
|
$propdoc: {
|
1249
2078
|
quote: "[string|undefined] the original quote character, if any",
|
1250
2079
|
static: "[boolean] whether this is a static setter (classes only)"
|
@@ -1255,7 +2084,18 @@ var AST_ObjectSetter = DEFNODE("ObjectSetter", "quote static", {
|
|
1255
2084
|
}
|
1256
2085
|
}, AST_ObjectProperty);
|
1257
2086
|
|
1258
|
-
var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", {
|
2087
|
+
var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", function AST_ObjectGetter(props) {
|
2088
|
+
if (props) {
|
2089
|
+
this.quote = props.quote;
|
2090
|
+
this.static = props.static;
|
2091
|
+
this.key = props.key;
|
2092
|
+
this.value = props.value;
|
2093
|
+
this.start = props.start;
|
2094
|
+
this.end = props.end;
|
2095
|
+
}
|
2096
|
+
|
2097
|
+
this.flags = 0;
|
2098
|
+
}, {
|
1259
2099
|
$propdoc: {
|
1260
2100
|
quote: "[string|undefined] the original quote character, if any",
|
1261
2101
|
static: "[boolean] whether this is a static getter (classes only)"
|
@@ -1266,24 +2106,75 @@ var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", {
|
|
1266
2106
|
}
|
1267
2107
|
}, AST_ObjectProperty);
|
1268
2108
|
|
1269
|
-
var AST_ConciseMethod = DEFNODE(
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
2109
|
+
var AST_ConciseMethod = DEFNODE(
|
2110
|
+
"ConciseMethod",
|
2111
|
+
"quote static is_generator async",
|
2112
|
+
function AST_ConciseMethod(props) {
|
2113
|
+
if (props) {
|
2114
|
+
this.quote = props.quote;
|
2115
|
+
this.static = props.static;
|
2116
|
+
this.is_generator = props.is_generator;
|
2117
|
+
this.async = props.async;
|
2118
|
+
this.key = props.key;
|
2119
|
+
this.value = props.value;
|
2120
|
+
this.start = props.start;
|
2121
|
+
this.end = props.end;
|
2122
|
+
}
|
2123
|
+
|
2124
|
+
this.flags = 0;
|
1275
2125
|
},
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
2126
|
+
{
|
2127
|
+
$propdoc: {
|
2128
|
+
quote: "[string|undefined] the original quote character, if any",
|
2129
|
+
static: "[boolean] is this method static (classes only)",
|
2130
|
+
is_generator: "[boolean] is this a generator method",
|
2131
|
+
async: "[boolean] is this method async",
|
2132
|
+
},
|
2133
|
+
$documentation: "An ES6 concise method inside an object or class",
|
2134
|
+
computed_key() {
|
2135
|
+
return !(this.key instanceof AST_SymbolMethod);
|
2136
|
+
}
|
2137
|
+
},
|
2138
|
+
AST_ObjectProperty
|
2139
|
+
);
|
2140
|
+
|
2141
|
+
var AST_PrivateMethod = DEFNODE("PrivateMethod", "", function AST_PrivateMethod(props) {
|
2142
|
+
if (props) {
|
2143
|
+
this.quote = props.quote;
|
2144
|
+
this.static = props.static;
|
2145
|
+
this.is_generator = props.is_generator;
|
2146
|
+
this.async = props.async;
|
2147
|
+
this.key = props.key;
|
2148
|
+
this.value = props.value;
|
2149
|
+
this.start = props.start;
|
2150
|
+
this.end = props.end;
|
1279
2151
|
}
|
1280
|
-
}, AST_ObjectProperty);
|
1281
2152
|
|
1282
|
-
|
2153
|
+
this.flags = 0;
|
2154
|
+
}, {
|
1283
2155
|
$documentation: "A private class method inside a class",
|
1284
2156
|
}, AST_ConciseMethod);
|
1285
2157
|
|
1286
|
-
var AST_Class = DEFNODE("Class", "name extends properties", {
|
2158
|
+
var AST_Class = DEFNODE("Class", "name extends properties", function AST_Class(props) {
|
2159
|
+
if (props) {
|
2160
|
+
this.name = props.name;
|
2161
|
+
this.extends = props.extends;
|
2162
|
+
this.properties = props.properties;
|
2163
|
+
this.variables = props.variables;
|
2164
|
+
this.functions = props.functions;
|
2165
|
+
this.uses_with = props.uses_with;
|
2166
|
+
this.uses_eval = props.uses_eval;
|
2167
|
+
this.parent_scope = props.parent_scope;
|
2168
|
+
this.enclosed = props.enclosed;
|
2169
|
+
this.cname = props.cname;
|
2170
|
+
this.body = props.body;
|
2171
|
+
this.block_scope = props.block_scope;
|
2172
|
+
this.start = props.start;
|
2173
|
+
this.end = props.end;
|
2174
|
+
}
|
2175
|
+
|
2176
|
+
this.flags = 0;
|
2177
|
+
}, {
|
1287
2178
|
$propdoc: {
|
1288
2179
|
name: "[AST_SymbolClass|AST_SymbolDefClass?] optional class name.",
|
1289
2180
|
extends: "[AST_Node]? optional parent class",
|
@@ -1309,7 +2200,18 @@ var AST_Class = DEFNODE("Class", "name extends properties", {
|
|
1309
2200
|
},
|
1310
2201
|
}, AST_Scope /* TODO a class might have a scope but it's not a scope */);
|
1311
2202
|
|
1312
|
-
var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", {
|
2203
|
+
var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", function AST_ClassProperty(props) {
|
2204
|
+
if (props) {
|
2205
|
+
this.static = props.static;
|
2206
|
+
this.quote = props.quote;
|
2207
|
+
this.key = props.key;
|
2208
|
+
this.value = props.value;
|
2209
|
+
this.start = props.start;
|
2210
|
+
this.end = props.end;
|
2211
|
+
}
|
2212
|
+
|
2213
|
+
this.flags = 0;
|
2214
|
+
}, {
|
1313
2215
|
$documentation: "A class property",
|
1314
2216
|
$propdoc: {
|
1315
2217
|
static: "[boolean] whether this is a static key",
|
@@ -1332,19 +2234,78 @@ var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", {
|
|
1332
2234
|
}
|
1333
2235
|
}, AST_ObjectProperty);
|
1334
2236
|
|
1335
|
-
var AST_ClassPrivateProperty = DEFNODE("ClassPrivateProperty", "", {
|
2237
|
+
var AST_ClassPrivateProperty = DEFNODE("ClassPrivateProperty", "", function AST_ClassPrivateProperty(props) {
|
2238
|
+
if (props) {
|
2239
|
+
this.static = props.static;
|
2240
|
+
this.quote = props.quote;
|
2241
|
+
this.key = props.key;
|
2242
|
+
this.value = props.value;
|
2243
|
+
this.start = props.start;
|
2244
|
+
this.end = props.end;
|
2245
|
+
}
|
2246
|
+
|
2247
|
+
this.flags = 0;
|
2248
|
+
}, {
|
1336
2249
|
$documentation: "A class property for a private property",
|
1337
2250
|
}, AST_ClassProperty);
|
1338
2251
|
|
1339
|
-
var AST_DefClass = DEFNODE("DefClass", null, {
|
2252
|
+
var AST_DefClass = DEFNODE("DefClass", null, function AST_DefClass(props) {
|
2253
|
+
if (props) {
|
2254
|
+
this.name = props.name;
|
2255
|
+
this.extends = props.extends;
|
2256
|
+
this.properties = props.properties;
|
2257
|
+
this.variables = props.variables;
|
2258
|
+
this.functions = props.functions;
|
2259
|
+
this.uses_with = props.uses_with;
|
2260
|
+
this.uses_eval = props.uses_eval;
|
2261
|
+
this.parent_scope = props.parent_scope;
|
2262
|
+
this.enclosed = props.enclosed;
|
2263
|
+
this.cname = props.cname;
|
2264
|
+
this.body = props.body;
|
2265
|
+
this.block_scope = props.block_scope;
|
2266
|
+
this.start = props.start;
|
2267
|
+
this.end = props.end;
|
2268
|
+
}
|
2269
|
+
|
2270
|
+
this.flags = 0;
|
2271
|
+
}, {
|
1340
2272
|
$documentation: "A class definition",
|
1341
2273
|
}, AST_Class);
|
1342
2274
|
|
1343
|
-
var AST_ClassExpression = DEFNODE("ClassExpression", null, {
|
2275
|
+
var AST_ClassExpression = DEFNODE("ClassExpression", null, function AST_ClassExpression(props) {
|
2276
|
+
if (props) {
|
2277
|
+
this.name = props.name;
|
2278
|
+
this.extends = props.extends;
|
2279
|
+
this.properties = props.properties;
|
2280
|
+
this.variables = props.variables;
|
2281
|
+
this.functions = props.functions;
|
2282
|
+
this.uses_with = props.uses_with;
|
2283
|
+
this.uses_eval = props.uses_eval;
|
2284
|
+
this.parent_scope = props.parent_scope;
|
2285
|
+
this.enclosed = props.enclosed;
|
2286
|
+
this.cname = props.cname;
|
2287
|
+
this.body = props.body;
|
2288
|
+
this.block_scope = props.block_scope;
|
2289
|
+
this.start = props.start;
|
2290
|
+
this.end = props.end;
|
2291
|
+
}
|
2292
|
+
|
2293
|
+
this.flags = 0;
|
2294
|
+
}, {
|
1344
2295
|
$documentation: "A class expression."
|
1345
2296
|
}, AST_Class);
|
1346
2297
|
|
1347
|
-
var AST_Symbol = DEFNODE("Symbol", "scope name thedef", {
|
2298
|
+
var AST_Symbol = DEFNODE("Symbol", "scope name thedef", function AST_Symbol(props) {
|
2299
|
+
if (props) {
|
2300
|
+
this.scope = props.scope;
|
2301
|
+
this.name = props.name;
|
2302
|
+
this.thedef = props.thedef;
|
2303
|
+
this.start = props.start;
|
2304
|
+
this.end = props.end;
|
2305
|
+
}
|
2306
|
+
|
2307
|
+
this.flags = 0;
|
2308
|
+
}, {
|
1348
2309
|
$propdoc: {
|
1349
2310
|
name: "[string] name of this symbol",
|
1350
2311
|
scope: "[AST_Scope/S] the current scope (not necessarily the definition scope)",
|
@@ -1353,71 +2314,258 @@ var AST_Symbol = DEFNODE("Symbol", "scope name thedef", {
|
|
1353
2314
|
$documentation: "Base class for all symbols"
|
1354
2315
|
});
|
1355
2316
|
|
1356
|
-
var AST_NewTarget = DEFNODE("NewTarget", null, {
|
2317
|
+
var AST_NewTarget = DEFNODE("NewTarget", null, function AST_NewTarget(props) {
|
2318
|
+
if (props) {
|
2319
|
+
this.start = props.start;
|
2320
|
+
this.end = props.end;
|
2321
|
+
}
|
2322
|
+
|
2323
|
+
this.flags = 0;
|
2324
|
+
}, {
|
1357
2325
|
$documentation: "A reference to new.target"
|
1358
2326
|
});
|
1359
2327
|
|
1360
|
-
var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", {
|
2328
|
+
var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", function AST_SymbolDeclaration(props) {
|
2329
|
+
if (props) {
|
2330
|
+
this.init = props.init;
|
2331
|
+
this.scope = props.scope;
|
2332
|
+
this.name = props.name;
|
2333
|
+
this.thedef = props.thedef;
|
2334
|
+
this.start = props.start;
|
2335
|
+
this.end = props.end;
|
2336
|
+
}
|
2337
|
+
|
2338
|
+
this.flags = 0;
|
2339
|
+
}, {
|
1361
2340
|
$documentation: "A declaration symbol (symbol in var/const, function name or argument, symbol in catch)",
|
1362
2341
|
}, AST_Symbol);
|
1363
2342
|
|
1364
|
-
var AST_SymbolVar = DEFNODE("SymbolVar", null, {
|
2343
|
+
var AST_SymbolVar = DEFNODE("SymbolVar", null, function AST_SymbolVar(props) {
|
2344
|
+
if (props) {
|
2345
|
+
this.init = props.init;
|
2346
|
+
this.scope = props.scope;
|
2347
|
+
this.name = props.name;
|
2348
|
+
this.thedef = props.thedef;
|
2349
|
+
this.start = props.start;
|
2350
|
+
this.end = props.end;
|
2351
|
+
}
|
2352
|
+
|
2353
|
+
this.flags = 0;
|
2354
|
+
}, {
|
1365
2355
|
$documentation: "Symbol defining a variable",
|
1366
2356
|
}, AST_SymbolDeclaration);
|
1367
2357
|
|
1368
|
-
var AST_SymbolBlockDeclaration = DEFNODE(
|
1369
|
-
|
1370
|
-
|
2358
|
+
var AST_SymbolBlockDeclaration = DEFNODE(
|
2359
|
+
"SymbolBlockDeclaration",
|
2360
|
+
null,
|
2361
|
+
function AST_SymbolBlockDeclaration(props) {
|
2362
|
+
if (props) {
|
2363
|
+
this.init = props.init;
|
2364
|
+
this.scope = props.scope;
|
2365
|
+
this.name = props.name;
|
2366
|
+
this.thedef = props.thedef;
|
2367
|
+
this.start = props.start;
|
2368
|
+
this.end = props.end;
|
2369
|
+
}
|
2370
|
+
|
2371
|
+
this.flags = 0;
|
2372
|
+
},
|
2373
|
+
{
|
2374
|
+
$documentation: "Base class for block-scoped declaration symbols"
|
2375
|
+
},
|
2376
|
+
AST_SymbolDeclaration
|
2377
|
+
);
|
1371
2378
|
|
1372
|
-
var AST_SymbolConst = DEFNODE("SymbolConst", null, {
|
2379
|
+
var AST_SymbolConst = DEFNODE("SymbolConst", null, function AST_SymbolConst(props) {
|
2380
|
+
if (props) {
|
2381
|
+
this.init = props.init;
|
2382
|
+
this.scope = props.scope;
|
2383
|
+
this.name = props.name;
|
2384
|
+
this.thedef = props.thedef;
|
2385
|
+
this.start = props.start;
|
2386
|
+
this.end = props.end;
|
2387
|
+
}
|
2388
|
+
|
2389
|
+
this.flags = 0;
|
2390
|
+
}, {
|
1373
2391
|
$documentation: "A constant declaration"
|
1374
2392
|
}, AST_SymbolBlockDeclaration);
|
1375
2393
|
|
1376
|
-
var AST_SymbolLet = DEFNODE("SymbolLet", null, {
|
2394
|
+
var AST_SymbolLet = DEFNODE("SymbolLet", null, function AST_SymbolLet(props) {
|
2395
|
+
if (props) {
|
2396
|
+
this.init = props.init;
|
2397
|
+
this.scope = props.scope;
|
2398
|
+
this.name = props.name;
|
2399
|
+
this.thedef = props.thedef;
|
2400
|
+
this.start = props.start;
|
2401
|
+
this.end = props.end;
|
2402
|
+
}
|
2403
|
+
|
2404
|
+
this.flags = 0;
|
2405
|
+
}, {
|
1377
2406
|
$documentation: "A block-scoped `let` declaration"
|
1378
2407
|
}, AST_SymbolBlockDeclaration);
|
1379
2408
|
|
1380
|
-
var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, {
|
2409
|
+
var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, function AST_SymbolFunarg(props) {
|
2410
|
+
if (props) {
|
2411
|
+
this.init = props.init;
|
2412
|
+
this.scope = props.scope;
|
2413
|
+
this.name = props.name;
|
2414
|
+
this.thedef = props.thedef;
|
2415
|
+
this.start = props.start;
|
2416
|
+
this.end = props.end;
|
2417
|
+
}
|
2418
|
+
|
2419
|
+
this.flags = 0;
|
2420
|
+
}, {
|
1381
2421
|
$documentation: "Symbol naming a function argument",
|
1382
2422
|
}, AST_SymbolVar);
|
1383
2423
|
|
1384
|
-
var AST_SymbolDefun = DEFNODE("SymbolDefun", null, {
|
2424
|
+
var AST_SymbolDefun = DEFNODE("SymbolDefun", null, function AST_SymbolDefun(props) {
|
2425
|
+
if (props) {
|
2426
|
+
this.init = props.init;
|
2427
|
+
this.scope = props.scope;
|
2428
|
+
this.name = props.name;
|
2429
|
+
this.thedef = props.thedef;
|
2430
|
+
this.start = props.start;
|
2431
|
+
this.end = props.end;
|
2432
|
+
}
|
2433
|
+
|
2434
|
+
this.flags = 0;
|
2435
|
+
}, {
|
1385
2436
|
$documentation: "Symbol defining a function",
|
1386
2437
|
}, AST_SymbolDeclaration);
|
1387
2438
|
|
1388
|
-
var AST_SymbolMethod = DEFNODE("SymbolMethod", null, {
|
2439
|
+
var AST_SymbolMethod = DEFNODE("SymbolMethod", null, function AST_SymbolMethod(props) {
|
2440
|
+
if (props) {
|
2441
|
+
this.scope = props.scope;
|
2442
|
+
this.name = props.name;
|
2443
|
+
this.thedef = props.thedef;
|
2444
|
+
this.start = props.start;
|
2445
|
+
this.end = props.end;
|
2446
|
+
}
|
2447
|
+
|
2448
|
+
this.flags = 0;
|
2449
|
+
}, {
|
1389
2450
|
$documentation: "Symbol in an object defining a method",
|
1390
2451
|
}, AST_Symbol);
|
1391
2452
|
|
1392
|
-
var AST_SymbolClassProperty = DEFNODE("SymbolClassProperty", null, {
|
2453
|
+
var AST_SymbolClassProperty = DEFNODE("SymbolClassProperty", null, function AST_SymbolClassProperty(props) {
|
2454
|
+
if (props) {
|
2455
|
+
this.scope = props.scope;
|
2456
|
+
this.name = props.name;
|
2457
|
+
this.thedef = props.thedef;
|
2458
|
+
this.start = props.start;
|
2459
|
+
this.end = props.end;
|
2460
|
+
}
|
2461
|
+
|
2462
|
+
this.flags = 0;
|
2463
|
+
}, {
|
1393
2464
|
$documentation: "Symbol for a class property",
|
1394
2465
|
}, AST_Symbol);
|
1395
2466
|
|
1396
|
-
var AST_SymbolLambda = DEFNODE("SymbolLambda", null, {
|
2467
|
+
var AST_SymbolLambda = DEFNODE("SymbolLambda", null, function AST_SymbolLambda(props) {
|
2468
|
+
if (props) {
|
2469
|
+
this.init = props.init;
|
2470
|
+
this.scope = props.scope;
|
2471
|
+
this.name = props.name;
|
2472
|
+
this.thedef = props.thedef;
|
2473
|
+
this.start = props.start;
|
2474
|
+
this.end = props.end;
|
2475
|
+
}
|
2476
|
+
|
2477
|
+
this.flags = 0;
|
2478
|
+
}, {
|
1397
2479
|
$documentation: "Symbol naming a function expression",
|
1398
2480
|
}, AST_SymbolDeclaration);
|
1399
2481
|
|
1400
|
-
var AST_SymbolDefClass = DEFNODE("SymbolDefClass", null, {
|
2482
|
+
var AST_SymbolDefClass = DEFNODE("SymbolDefClass", null, function AST_SymbolDefClass(props) {
|
2483
|
+
if (props) {
|
2484
|
+
this.init = props.init;
|
2485
|
+
this.scope = props.scope;
|
2486
|
+
this.name = props.name;
|
2487
|
+
this.thedef = props.thedef;
|
2488
|
+
this.start = props.start;
|
2489
|
+
this.end = props.end;
|
2490
|
+
}
|
2491
|
+
|
2492
|
+
this.flags = 0;
|
2493
|
+
}, {
|
1401
2494
|
$documentation: "Symbol naming a class's name in a class declaration. Lexically scoped to its containing scope, and accessible within the class."
|
1402
2495
|
}, AST_SymbolBlockDeclaration);
|
1403
2496
|
|
1404
|
-
var AST_SymbolClass = DEFNODE("SymbolClass", null, {
|
2497
|
+
var AST_SymbolClass = DEFNODE("SymbolClass", null, function AST_SymbolClass(props) {
|
2498
|
+
if (props) {
|
2499
|
+
this.init = props.init;
|
2500
|
+
this.scope = props.scope;
|
2501
|
+
this.name = props.name;
|
2502
|
+
this.thedef = props.thedef;
|
2503
|
+
this.start = props.start;
|
2504
|
+
this.end = props.end;
|
2505
|
+
}
|
2506
|
+
|
2507
|
+
this.flags = 0;
|
2508
|
+
}, {
|
1405
2509
|
$documentation: "Symbol naming a class's name. Lexically scoped to the class."
|
1406
2510
|
}, AST_SymbolDeclaration);
|
1407
2511
|
|
1408
|
-
var AST_SymbolCatch = DEFNODE("SymbolCatch", null, {
|
2512
|
+
var AST_SymbolCatch = DEFNODE("SymbolCatch", null, function AST_SymbolCatch(props) {
|
2513
|
+
if (props) {
|
2514
|
+
this.init = props.init;
|
2515
|
+
this.scope = props.scope;
|
2516
|
+
this.name = props.name;
|
2517
|
+
this.thedef = props.thedef;
|
2518
|
+
this.start = props.start;
|
2519
|
+
this.end = props.end;
|
2520
|
+
}
|
2521
|
+
|
2522
|
+
this.flags = 0;
|
2523
|
+
}, {
|
1409
2524
|
$documentation: "Symbol naming the exception in catch",
|
1410
2525
|
}, AST_SymbolBlockDeclaration);
|
1411
2526
|
|
1412
|
-
var AST_SymbolImport = DEFNODE("SymbolImport", null, {
|
2527
|
+
var AST_SymbolImport = DEFNODE("SymbolImport", null, function AST_SymbolImport(props) {
|
2528
|
+
if (props) {
|
2529
|
+
this.init = props.init;
|
2530
|
+
this.scope = props.scope;
|
2531
|
+
this.name = props.name;
|
2532
|
+
this.thedef = props.thedef;
|
2533
|
+
this.start = props.start;
|
2534
|
+
this.end = props.end;
|
2535
|
+
}
|
2536
|
+
|
2537
|
+
this.flags = 0;
|
2538
|
+
}, {
|
1413
2539
|
$documentation: "Symbol referring to an imported name",
|
1414
2540
|
}, AST_SymbolBlockDeclaration);
|
1415
2541
|
|
1416
|
-
var AST_SymbolImportForeign = DEFNODE("SymbolImportForeign", null, {
|
2542
|
+
var AST_SymbolImportForeign = DEFNODE("SymbolImportForeign", null, function AST_SymbolImportForeign(props) {
|
2543
|
+
if (props) {
|
2544
|
+
this.scope = props.scope;
|
2545
|
+
this.name = props.name;
|
2546
|
+
this.thedef = props.thedef;
|
2547
|
+
this.start = props.start;
|
2548
|
+
this.end = props.end;
|
2549
|
+
}
|
2550
|
+
|
2551
|
+
this.flags = 0;
|
2552
|
+
}, {
|
1417
2553
|
$documentation: "A symbol imported from a module, but it is defined in the other module, and its real name is irrelevant for this module's purposes",
|
1418
2554
|
}, AST_Symbol);
|
1419
2555
|
|
1420
|
-
var AST_Label = DEFNODE("Label", "references", {
|
2556
|
+
var AST_Label = DEFNODE("Label", "references", function AST_Label(props) {
|
2557
|
+
if (props) {
|
2558
|
+
this.references = props.references;
|
2559
|
+
this.scope = props.scope;
|
2560
|
+
this.name = props.name;
|
2561
|
+
this.thedef = props.thedef;
|
2562
|
+
this.start = props.start;
|
2563
|
+
this.end = props.end;
|
2564
|
+
this.initialize();
|
2565
|
+
}
|
2566
|
+
|
2567
|
+
this.flags = 0;
|
2568
|
+
}, {
|
1421
2569
|
$documentation: "Symbol naming a label (declaration)",
|
1422
2570
|
$propdoc: {
|
1423
2571
|
references: "[AST_LoopControl*] a list of nodes referring to this label"
|
@@ -1428,38 +2576,114 @@ var AST_Label = DEFNODE("Label", "references", {
|
|
1428
2576
|
}
|
1429
2577
|
}, AST_Symbol);
|
1430
2578
|
|
1431
|
-
var AST_SymbolRef = DEFNODE("SymbolRef", null, {
|
2579
|
+
var AST_SymbolRef = DEFNODE("SymbolRef", null, function AST_SymbolRef(props) {
|
2580
|
+
if (props) {
|
2581
|
+
this.scope = props.scope;
|
2582
|
+
this.name = props.name;
|
2583
|
+
this.thedef = props.thedef;
|
2584
|
+
this.start = props.start;
|
2585
|
+
this.end = props.end;
|
2586
|
+
}
|
2587
|
+
|
2588
|
+
this.flags = 0;
|
2589
|
+
}, {
|
1432
2590
|
$documentation: "Reference to some symbol (not definition/declaration)",
|
1433
2591
|
}, AST_Symbol);
|
1434
2592
|
|
1435
|
-
var AST_SymbolExport = DEFNODE("SymbolExport", null, {
|
2593
|
+
var AST_SymbolExport = DEFNODE("SymbolExport", null, function AST_SymbolExport(props) {
|
2594
|
+
if (props) {
|
2595
|
+
this.scope = props.scope;
|
2596
|
+
this.name = props.name;
|
2597
|
+
this.thedef = props.thedef;
|
2598
|
+
this.start = props.start;
|
2599
|
+
this.end = props.end;
|
2600
|
+
}
|
2601
|
+
|
2602
|
+
this.flags = 0;
|
2603
|
+
}, {
|
1436
2604
|
$documentation: "Symbol referring to a name to export",
|
1437
2605
|
}, AST_SymbolRef);
|
1438
2606
|
|
1439
|
-
var AST_SymbolExportForeign = DEFNODE("SymbolExportForeign", null, {
|
2607
|
+
var AST_SymbolExportForeign = DEFNODE("SymbolExportForeign", null, function AST_SymbolExportForeign(props) {
|
2608
|
+
if (props) {
|
2609
|
+
this.scope = props.scope;
|
2610
|
+
this.name = props.name;
|
2611
|
+
this.thedef = props.thedef;
|
2612
|
+
this.start = props.start;
|
2613
|
+
this.end = props.end;
|
2614
|
+
}
|
2615
|
+
|
2616
|
+
this.flags = 0;
|
2617
|
+
}, {
|
1440
2618
|
$documentation: "A symbol exported from this module, but it is used in the other module, and its real name is irrelevant for this module's purposes",
|
1441
2619
|
}, AST_Symbol);
|
1442
2620
|
|
1443
|
-
var AST_LabelRef = DEFNODE("LabelRef", null, {
|
2621
|
+
var AST_LabelRef = DEFNODE("LabelRef", null, function AST_LabelRef(props) {
|
2622
|
+
if (props) {
|
2623
|
+
this.scope = props.scope;
|
2624
|
+
this.name = props.name;
|
2625
|
+
this.thedef = props.thedef;
|
2626
|
+
this.start = props.start;
|
2627
|
+
this.end = props.end;
|
2628
|
+
}
|
2629
|
+
|
2630
|
+
this.flags = 0;
|
2631
|
+
}, {
|
1444
2632
|
$documentation: "Reference to a label symbol",
|
1445
2633
|
}, AST_Symbol);
|
1446
2634
|
|
1447
|
-
var AST_This = DEFNODE("This", null, {
|
2635
|
+
var AST_This = DEFNODE("This", null, function AST_This(props) {
|
2636
|
+
if (props) {
|
2637
|
+
this.scope = props.scope;
|
2638
|
+
this.name = props.name;
|
2639
|
+
this.thedef = props.thedef;
|
2640
|
+
this.start = props.start;
|
2641
|
+
this.end = props.end;
|
2642
|
+
}
|
2643
|
+
|
2644
|
+
this.flags = 0;
|
2645
|
+
}, {
|
1448
2646
|
$documentation: "The `this` symbol",
|
1449
2647
|
}, AST_Symbol);
|
1450
2648
|
|
1451
|
-
var AST_Super = DEFNODE("Super", null, {
|
2649
|
+
var AST_Super = DEFNODE("Super", null, function AST_Super(props) {
|
2650
|
+
if (props) {
|
2651
|
+
this.scope = props.scope;
|
2652
|
+
this.name = props.name;
|
2653
|
+
this.thedef = props.thedef;
|
2654
|
+
this.start = props.start;
|
2655
|
+
this.end = props.end;
|
2656
|
+
}
|
2657
|
+
|
2658
|
+
this.flags = 0;
|
2659
|
+
}, {
|
1452
2660
|
$documentation: "The `super` symbol",
|
1453
2661
|
}, AST_This);
|
1454
2662
|
|
1455
|
-
var AST_Constant = DEFNODE("Constant", null, {
|
2663
|
+
var AST_Constant = DEFNODE("Constant", null, function AST_Constant(props) {
|
2664
|
+
if (props) {
|
2665
|
+
this.start = props.start;
|
2666
|
+
this.end = props.end;
|
2667
|
+
}
|
2668
|
+
|
2669
|
+
this.flags = 0;
|
2670
|
+
}, {
|
1456
2671
|
$documentation: "Base class for all constants",
|
1457
2672
|
getValue: function() {
|
1458
2673
|
return this.value;
|
1459
2674
|
}
|
1460
2675
|
});
|
1461
2676
|
|
1462
|
-
var AST_String = DEFNODE("String", "value quote", {
|
2677
|
+
var AST_String = DEFNODE("String", "value quote", function AST_String(props) {
|
2678
|
+
if (props) {
|
2679
|
+
this.value = props.value;
|
2680
|
+
this.quote = props.quote;
|
2681
|
+
this.start = props.start;
|
2682
|
+
this.end = props.end;
|
2683
|
+
}
|
2684
|
+
|
2685
|
+
this.flags = 0;
|
2686
|
+
}, {
|
1463
2687
|
$documentation: "A string literal",
|
1464
2688
|
$propdoc: {
|
1465
2689
|
value: "[string] the contents of this string",
|
@@ -1467,7 +2691,16 @@ var AST_String = DEFNODE("String", "value quote", {
|
|
1467
2691
|
}
|
1468
2692
|
}, AST_Constant);
|
1469
2693
|
|
1470
|
-
var AST_Number = DEFNODE("Number", "value raw", {
|
2694
|
+
var AST_Number = DEFNODE("Number", "value raw", function AST_Number(props) {
|
2695
|
+
if (props) {
|
2696
|
+
this.value = props.value;
|
2697
|
+
this.raw = props.raw;
|
2698
|
+
this.start = props.start;
|
2699
|
+
this.end = props.end;
|
2700
|
+
}
|
2701
|
+
|
2702
|
+
this.flags = 0;
|
2703
|
+
}, {
|
1471
2704
|
$documentation: "A number literal",
|
1472
2705
|
$propdoc: {
|
1473
2706
|
value: "[number] the numeric value",
|
@@ -1475,59 +2708,138 @@ var AST_Number = DEFNODE("Number", "value raw", {
|
|
1475
2708
|
}
|
1476
2709
|
}, AST_Constant);
|
1477
2710
|
|
1478
|
-
var AST_BigInt = DEFNODE("BigInt", "value", {
|
2711
|
+
var AST_BigInt = DEFNODE("BigInt", "value", function AST_BigInt(props) {
|
2712
|
+
if (props) {
|
2713
|
+
this.value = props.value;
|
2714
|
+
this.start = props.start;
|
2715
|
+
this.end = props.end;
|
2716
|
+
}
|
2717
|
+
|
2718
|
+
this.flags = 0;
|
2719
|
+
}, {
|
1479
2720
|
$documentation: "A big int literal",
|
1480
2721
|
$propdoc: {
|
1481
2722
|
value: "[string] big int value"
|
1482
2723
|
}
|
1483
2724
|
}, AST_Constant);
|
1484
2725
|
|
1485
|
-
var AST_RegExp = DEFNODE("RegExp", "value", {
|
2726
|
+
var AST_RegExp = DEFNODE("RegExp", "value", function AST_RegExp(props) {
|
2727
|
+
if (props) {
|
2728
|
+
this.value = props.value;
|
2729
|
+
this.start = props.start;
|
2730
|
+
this.end = props.end;
|
2731
|
+
}
|
2732
|
+
|
2733
|
+
this.flags = 0;
|
2734
|
+
}, {
|
1486
2735
|
$documentation: "A regexp literal",
|
1487
2736
|
$propdoc: {
|
1488
2737
|
value: "[RegExp] the actual regexp",
|
1489
2738
|
}
|
1490
2739
|
}, AST_Constant);
|
1491
2740
|
|
1492
|
-
var AST_Atom = DEFNODE("Atom", null, {
|
2741
|
+
var AST_Atom = DEFNODE("Atom", null, function AST_Atom(props) {
|
2742
|
+
if (props) {
|
2743
|
+
this.start = props.start;
|
2744
|
+
this.end = props.end;
|
2745
|
+
}
|
2746
|
+
|
2747
|
+
this.flags = 0;
|
2748
|
+
}, {
|
1493
2749
|
$documentation: "Base class for atoms",
|
1494
2750
|
}, AST_Constant);
|
1495
2751
|
|
1496
|
-
var AST_Null = DEFNODE("Null", null, {
|
2752
|
+
var AST_Null = DEFNODE("Null", null, function AST_Null(props) {
|
2753
|
+
if (props) {
|
2754
|
+
this.start = props.start;
|
2755
|
+
this.end = props.end;
|
2756
|
+
}
|
2757
|
+
|
2758
|
+
this.flags = 0;
|
2759
|
+
}, {
|
1497
2760
|
$documentation: "The `null` atom",
|
1498
2761
|
value: null
|
1499
2762
|
}, AST_Atom);
|
1500
2763
|
|
1501
|
-
var AST_NaN = DEFNODE("NaN", null, {
|
2764
|
+
var AST_NaN = DEFNODE("NaN", null, function AST_NaN(props) {
|
2765
|
+
if (props) {
|
2766
|
+
this.start = props.start;
|
2767
|
+
this.end = props.end;
|
2768
|
+
}
|
2769
|
+
|
2770
|
+
this.flags = 0;
|
2771
|
+
}, {
|
1502
2772
|
$documentation: "The impossible value",
|
1503
2773
|
value: 0/0
|
1504
2774
|
}, AST_Atom);
|
1505
2775
|
|
1506
|
-
var AST_Undefined = DEFNODE("Undefined", null, {
|
2776
|
+
var AST_Undefined = DEFNODE("Undefined", null, function AST_Undefined(props) {
|
2777
|
+
if (props) {
|
2778
|
+
this.start = props.start;
|
2779
|
+
this.end = props.end;
|
2780
|
+
}
|
2781
|
+
|
2782
|
+
this.flags = 0;
|
2783
|
+
}, {
|
1507
2784
|
$documentation: "The `undefined` value",
|
1508
2785
|
value: (function() {}())
|
1509
2786
|
}, AST_Atom);
|
1510
2787
|
|
1511
|
-
var AST_Hole = DEFNODE("Hole", null, {
|
2788
|
+
var AST_Hole = DEFNODE("Hole", null, function AST_Hole(props) {
|
2789
|
+
if (props) {
|
2790
|
+
this.start = props.start;
|
2791
|
+
this.end = props.end;
|
2792
|
+
}
|
2793
|
+
|
2794
|
+
this.flags = 0;
|
2795
|
+
}, {
|
1512
2796
|
$documentation: "A hole in an array",
|
1513
2797
|
value: (function() {}())
|
1514
2798
|
}, AST_Atom);
|
1515
2799
|
|
1516
|
-
var AST_Infinity = DEFNODE("Infinity", null, {
|
2800
|
+
var AST_Infinity = DEFNODE("Infinity", null, function AST_Infinity(props) {
|
2801
|
+
if (props) {
|
2802
|
+
this.start = props.start;
|
2803
|
+
this.end = props.end;
|
2804
|
+
}
|
2805
|
+
|
2806
|
+
this.flags = 0;
|
2807
|
+
}, {
|
1517
2808
|
$documentation: "The `Infinity` value",
|
1518
2809
|
value: 1/0
|
1519
2810
|
}, AST_Atom);
|
1520
2811
|
|
1521
|
-
var AST_Boolean = DEFNODE("Boolean", null, {
|
2812
|
+
var AST_Boolean = DEFNODE("Boolean", null, function AST_Boolean(props) {
|
2813
|
+
if (props) {
|
2814
|
+
this.start = props.start;
|
2815
|
+
this.end = props.end;
|
2816
|
+
}
|
2817
|
+
|
2818
|
+
this.flags = 0;
|
2819
|
+
}, {
|
1522
2820
|
$documentation: "Base class for booleans",
|
1523
2821
|
}, AST_Atom);
|
1524
2822
|
|
1525
|
-
var AST_False = DEFNODE("False", null, {
|
2823
|
+
var AST_False = DEFNODE("False", null, function AST_False(props) {
|
2824
|
+
if (props) {
|
2825
|
+
this.start = props.start;
|
2826
|
+
this.end = props.end;
|
2827
|
+
}
|
2828
|
+
|
2829
|
+
this.flags = 0;
|
2830
|
+
}, {
|
1526
2831
|
$documentation: "The `false` atom",
|
1527
2832
|
value: false
|
1528
2833
|
}, AST_Boolean);
|
1529
2834
|
|
1530
|
-
var AST_True = DEFNODE("True", null, {
|
2835
|
+
var AST_True = DEFNODE("True", null, function AST_True(props) {
|
2836
|
+
if (props) {
|
2837
|
+
this.start = props.start;
|
2838
|
+
this.end = props.end;
|
2839
|
+
}
|
2840
|
+
|
2841
|
+
this.flags = 0;
|
2842
|
+
}, {
|
1531
2843
|
$documentation: "The `true` atom",
|
1532
2844
|
value: true
|
1533
2845
|
}, AST_Boolean);
|