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.
@@ -3553,23 +3553,13 @@ function parse($TEXT, options) {
3553
3553
 
3554
3554
  ***********************************************************************/
3555
3555
 
3556
- function DEFNODE(type, props, methods, base = AST_Node) {
3556
+ function DEFNODE(type, props, ctor, methods, base = AST_Node) {
3557
3557
  if (!props) props = [];
3558
3558
  else props = props.split(/\s+/);
3559
3559
  var self_props = props;
3560
3560
  if (base && base.PROPS)
3561
3561
  props = props.concat(base.PROPS);
3562
- var code = "return function AST_" + type + "(props){ if (props) { ";
3563
- for (var i = props.length; --i >= 0;) {
3564
- code += "this." + props[i] + " = props." + props[i] + ";";
3565
- }
3566
3562
  const proto = base && Object.create(base.prototype);
3567
- if (proto && proto.initialize || (methods && methods.initialize))
3568
- code += "this.initialize();";
3569
- code += "}";
3570
- code += "this.flags = 0;";
3571
- code += "}";
3572
- var ctor = new Function(code)();
3573
3563
  if (proto) {
3574
3564
  ctor.prototype = proto;
3575
3565
  ctor.BASE = base;
@@ -3583,7 +3573,7 @@ function DEFNODE(type, props, methods, base = AST_Node) {
3583
3573
  if (type) {
3584
3574
  ctor.prototype.TYPE = ctor.TYPE = type;
3585
3575
  }
3586
- if (methods) for (i in methods) if (HOP(methods, i)) {
3576
+ if (methods) for (let i in methods) if (HOP(methods, i)) {
3587
3577
  if (i[0] === "$") {
3588
3578
  ctor[i.substr(1)] = methods[i];
3589
3579
  } else {
@@ -3645,7 +3635,14 @@ class AST_Token {
3645
3635
  }
3646
3636
  }
3647
3637
 
3648
- var AST_Node = DEFNODE("Node", "start end", {
3638
+ var AST_Node = DEFNODE("Node", "start end", function AST_Node(props) {
3639
+ if (props) {
3640
+ this.start = props.start;
3641
+ this.end = props.end;
3642
+ }
3643
+
3644
+ this.flags = 0;
3645
+ }, {
3649
3646
  _clone: function(deep) {
3650
3647
  if (deep) {
3651
3648
  var self = this.clone();
@@ -3676,15 +3673,38 @@ var AST_Node = DEFNODE("Node", "start end", {
3676
3673
 
3677
3674
  /* -----[ statements ]----- */
3678
3675
 
3679
- var AST_Statement = DEFNODE("Statement", null, {
3676
+ var AST_Statement = DEFNODE("Statement", null, function AST_Statement(props) {
3677
+ if (props) {
3678
+ this.start = props.start;
3679
+ this.end = props.end;
3680
+ }
3681
+
3682
+ this.flags = 0;
3683
+ }, {
3680
3684
  $documentation: "Base class of all statements",
3681
3685
  });
3682
3686
 
3683
- var AST_Debugger = DEFNODE("Debugger", null, {
3687
+ var AST_Debugger = DEFNODE("Debugger", null, function AST_Debugger(props) {
3688
+ if (props) {
3689
+ this.start = props.start;
3690
+ this.end = props.end;
3691
+ }
3692
+
3693
+ this.flags = 0;
3694
+ }, {
3684
3695
  $documentation: "Represents a debugger statement",
3685
3696
  }, AST_Statement);
3686
3697
 
3687
- var AST_Directive = DEFNODE("Directive", "value quote", {
3698
+ var AST_Directive = DEFNODE("Directive", "value quote", function AST_Directive(props) {
3699
+ if (props) {
3700
+ this.value = props.value;
3701
+ this.quote = props.quote;
3702
+ this.start = props.start;
3703
+ this.end = props.end;
3704
+ }
3705
+
3706
+ this.flags = 0;
3707
+ }, {
3688
3708
  $documentation: "Represents a directive, like \"use strict\";",
3689
3709
  $propdoc: {
3690
3710
  value: "[string] The value of this directive as a plain string (it's not an AST_String!)",
@@ -3692,7 +3712,15 @@ var AST_Directive = DEFNODE("Directive", "value quote", {
3692
3712
  },
3693
3713
  }, AST_Statement);
3694
3714
 
3695
- var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", {
3715
+ var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", function AST_SimpleStatement(props) {
3716
+ if (props) {
3717
+ this.body = props.body;
3718
+ this.start = props.start;
3719
+ this.end = props.end;
3720
+ }
3721
+
3722
+ this.flags = 0;
3723
+ }, {
3696
3724
  $documentation: "A statement consisting of an expression, i.e. a = 1 + 2",
3697
3725
  $propdoc: {
3698
3726
  body: "[AST_Node] an expression node (should not be instanceof AST_Statement)"
@@ -3722,7 +3750,16 @@ function clone_block_scope(deep) {
3722
3750
  return clone;
3723
3751
  }
3724
3752
 
3725
- var AST_Block = DEFNODE("Block", "body block_scope", {
3753
+ var AST_Block = DEFNODE("Block", "body block_scope", function AST_Block(props) {
3754
+ if (props) {
3755
+ this.body = props.body;
3756
+ this.block_scope = props.block_scope;
3757
+ this.start = props.start;
3758
+ this.end = props.end;
3759
+ }
3760
+
3761
+ this.flags = 0;
3762
+ }, {
3726
3763
  $documentation: "A body of statements (usually braced)",
3727
3764
  $propdoc: {
3728
3765
  body: "[AST_Statement*] an array of statements",
@@ -3740,22 +3777,55 @@ var AST_Block = DEFNODE("Block", "body block_scope", {
3740
3777
  clone: clone_block_scope
3741
3778
  }, AST_Statement);
3742
3779
 
3743
- var AST_BlockStatement = DEFNODE("BlockStatement", null, {
3780
+ var AST_BlockStatement = DEFNODE("BlockStatement", null, function AST_BlockStatement(props) {
3781
+ if (props) {
3782
+ this.body = props.body;
3783
+ this.block_scope = props.block_scope;
3784
+ this.start = props.start;
3785
+ this.end = props.end;
3786
+ }
3787
+
3788
+ this.flags = 0;
3789
+ }, {
3744
3790
  $documentation: "A block statement",
3745
3791
  }, AST_Block);
3746
3792
 
3747
- var AST_EmptyStatement = DEFNODE("EmptyStatement", null, {
3793
+ var AST_EmptyStatement = DEFNODE("EmptyStatement", null, function AST_EmptyStatement(props) {
3794
+ if (props) {
3795
+ this.start = props.start;
3796
+ this.end = props.end;
3797
+ }
3798
+
3799
+ this.flags = 0;
3800
+ }, {
3748
3801
  $documentation: "The empty statement (empty block or simply a semicolon)"
3749
3802
  }, AST_Statement);
3750
3803
 
3751
- var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", {
3804
+ var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", function AST_StatementWithBody(props) {
3805
+ if (props) {
3806
+ this.body = props.body;
3807
+ this.start = props.start;
3808
+ this.end = props.end;
3809
+ }
3810
+
3811
+ this.flags = 0;
3812
+ }, {
3752
3813
  $documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`",
3753
3814
  $propdoc: {
3754
3815
  body: "[AST_Statement] the body; this should always be present, even if it's an AST_EmptyStatement"
3755
3816
  }
3756
3817
  }, AST_Statement);
3757
3818
 
3758
- var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", {
3819
+ var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", function AST_LabeledStatement(props) {
3820
+ if (props) {
3821
+ this.label = props.label;
3822
+ this.body = props.body;
3823
+ this.start = props.start;
3824
+ this.end = props.end;
3825
+ }
3826
+
3827
+ this.flags = 0;
3828
+ }, {
3759
3829
  $documentation: "Statement with a label",
3760
3830
  $propdoc: {
3761
3831
  label: "[AST_Label] a label definition"
@@ -3787,22 +3857,57 @@ var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", {
3787
3857
  }
3788
3858
  }, AST_StatementWithBody);
3789
3859
 
3790
- var AST_IterationStatement = DEFNODE("IterationStatement", "block_scope", {
3791
- $documentation: "Internal class. All loops inherit from it.",
3792
- $propdoc: {
3793
- block_scope: "[AST_Scope] the block scope for this iteration statement."
3860
+ var AST_IterationStatement = DEFNODE(
3861
+ "IterationStatement",
3862
+ "block_scope",
3863
+ function AST_IterationStatement(props) {
3864
+ if (props) {
3865
+ this.block_scope = props.block_scope;
3866
+ this.body = props.body;
3867
+ this.start = props.start;
3868
+ this.end = props.end;
3869
+ }
3870
+
3871
+ this.flags = 0;
3794
3872
  },
3795
- clone: clone_block_scope
3796
- }, AST_StatementWithBody);
3873
+ {
3874
+ $documentation: "Internal class. All loops inherit from it.",
3875
+ $propdoc: {
3876
+ block_scope: "[AST_Scope] the block scope for this iteration statement."
3877
+ },
3878
+ clone: clone_block_scope
3879
+ },
3880
+ AST_StatementWithBody
3881
+ );
3797
3882
 
3798
- var AST_DWLoop = DEFNODE("DWLoop", "condition", {
3883
+ var AST_DWLoop = DEFNODE("DWLoop", "condition", function AST_DWLoop(props) {
3884
+ if (props) {
3885
+ this.condition = props.condition;
3886
+ this.block_scope = props.block_scope;
3887
+ this.body = props.body;
3888
+ this.start = props.start;
3889
+ this.end = props.end;
3890
+ }
3891
+
3892
+ this.flags = 0;
3893
+ }, {
3799
3894
  $documentation: "Base class for do/while statements",
3800
3895
  $propdoc: {
3801
3896
  condition: "[AST_Node] the loop condition. Should not be instanceof AST_Statement"
3802
3897
  }
3803
3898
  }, AST_IterationStatement);
3804
3899
 
3805
- var AST_Do = DEFNODE("Do", null, {
3900
+ var AST_Do = DEFNODE("Do", null, function AST_Do(props) {
3901
+ if (props) {
3902
+ this.condition = props.condition;
3903
+ this.block_scope = props.block_scope;
3904
+ this.body = props.body;
3905
+ this.start = props.start;
3906
+ this.end = props.end;
3907
+ }
3908
+
3909
+ this.flags = 0;
3910
+ }, {
3806
3911
  $documentation: "A `do` statement",
3807
3912
  _walk: function(visitor) {
3808
3913
  return visitor._visit(this, function() {
@@ -3816,7 +3921,17 @@ var AST_Do = DEFNODE("Do", null, {
3816
3921
  }
3817
3922
  }, AST_DWLoop);
3818
3923
 
3819
- var AST_While = DEFNODE("While", null, {
3924
+ var AST_While = DEFNODE("While", null, function AST_While(props) {
3925
+ if (props) {
3926
+ this.condition = props.condition;
3927
+ this.block_scope = props.block_scope;
3928
+ this.body = props.body;
3929
+ this.start = props.start;
3930
+ this.end = props.end;
3931
+ }
3932
+
3933
+ this.flags = 0;
3934
+ }, {
3820
3935
  $documentation: "A `while` statement",
3821
3936
  _walk: function(visitor) {
3822
3937
  return visitor._visit(this, function() {
@@ -3830,7 +3945,19 @@ var AST_While = DEFNODE("While", null, {
3830
3945
  },
3831
3946
  }, AST_DWLoop);
3832
3947
 
3833
- var AST_For = DEFNODE("For", "init condition step", {
3948
+ var AST_For = DEFNODE("For", "init condition step", function AST_For(props) {
3949
+ if (props) {
3950
+ this.init = props.init;
3951
+ this.condition = props.condition;
3952
+ this.step = props.step;
3953
+ this.block_scope = props.block_scope;
3954
+ this.body = props.body;
3955
+ this.start = props.start;
3956
+ this.end = props.end;
3957
+ }
3958
+
3959
+ this.flags = 0;
3960
+ }, {
3834
3961
  $documentation: "A `for` statement",
3835
3962
  $propdoc: {
3836
3963
  init: "[AST_Node?] the `for` initialization code, or null if empty",
@@ -3853,7 +3980,18 @@ var AST_For = DEFNODE("For", "init condition step", {
3853
3980
  },
3854
3981
  }, AST_IterationStatement);
3855
3982
 
3856
- var AST_ForIn = DEFNODE("ForIn", "init object", {
3983
+ var AST_ForIn = DEFNODE("ForIn", "init object", function AST_ForIn(props) {
3984
+ if (props) {
3985
+ this.init = props.init;
3986
+ this.object = props.object;
3987
+ this.block_scope = props.block_scope;
3988
+ this.body = props.body;
3989
+ this.start = props.start;
3990
+ this.end = props.end;
3991
+ }
3992
+
3993
+ this.flags = 0;
3994
+ }, {
3857
3995
  $documentation: "A `for ... in` statement",
3858
3996
  $propdoc: {
3859
3997
  init: "[AST_Node] the `for/in` initialization code",
@@ -3873,11 +4011,32 @@ var AST_ForIn = DEFNODE("ForIn", "init object", {
3873
4011
  },
3874
4012
  }, AST_IterationStatement);
3875
4013
 
3876
- var AST_ForOf = DEFNODE("ForOf", "await", {
4014
+ var AST_ForOf = DEFNODE("ForOf", "await", function AST_ForOf(props) {
4015
+ if (props) {
4016
+ this.await = props.await;
4017
+ this.init = props.init;
4018
+ this.object = props.object;
4019
+ this.block_scope = props.block_scope;
4020
+ this.body = props.body;
4021
+ this.start = props.start;
4022
+ this.end = props.end;
4023
+ }
4024
+
4025
+ this.flags = 0;
4026
+ }, {
3877
4027
  $documentation: "A `for ... of` statement",
3878
4028
  }, AST_ForIn);
3879
4029
 
3880
- var AST_With = DEFNODE("With", "expression", {
4030
+ var AST_With = DEFNODE("With", "expression", function AST_With(props) {
4031
+ if (props) {
4032
+ this.expression = props.expression;
4033
+ this.body = props.body;
4034
+ this.start = props.start;
4035
+ this.end = props.end;
4036
+ }
4037
+
4038
+ this.flags = 0;
4039
+ }, {
3881
4040
  $documentation: "A `with` statement",
3882
4041
  $propdoc: {
3883
4042
  expression: "[AST_Node] the `with` expression"
@@ -3896,43 +4055,82 @@ var AST_With = DEFNODE("With", "expression", {
3896
4055
 
3897
4056
  /* -----[ scope and functions ]----- */
3898
4057
 
3899
- var AST_Scope = DEFNODE("Scope", "variables functions uses_with uses_eval parent_scope enclosed cname", {
3900
- $documentation: "Base class for all statements introducing a lexical scope",
3901
- $propdoc: {
3902
- variables: "[Map/S] a map of name -> SymbolDef for all variables/functions defined in this scope",
3903
- uses_with: "[boolean/S] tells whether this scope uses the `with` statement",
3904
- uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`",
3905
- parent_scope: "[AST_Scope?/S] link to the parent scope",
3906
- enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
3907
- cname: "[integer/S] current index for mangling variables (used internally by the mangler)",
3908
- },
3909
- get_defun_scope: function() {
3910
- var self = this;
3911
- while (self.is_block_scope()) {
3912
- self = self.parent_scope;
3913
- }
3914
- return self;
4058
+ var AST_Scope = DEFNODE(
4059
+ "Scope",
4060
+ "variables functions uses_with uses_eval parent_scope enclosed cname",
4061
+ function AST_Scope(props) {
4062
+ if (props) {
4063
+ this.variables = props.variables;
4064
+ this.functions = props.functions;
4065
+ this.uses_with = props.uses_with;
4066
+ this.uses_eval = props.uses_eval;
4067
+ this.parent_scope = props.parent_scope;
4068
+ this.enclosed = props.enclosed;
4069
+ this.cname = props.cname;
4070
+ this.body = props.body;
4071
+ this.block_scope = props.block_scope;
4072
+ this.start = props.start;
4073
+ this.end = props.end;
4074
+ }
4075
+
4076
+ this.flags = 0;
3915
4077
  },
3916
- clone: function(deep, toplevel) {
3917
- var node = this._clone(deep);
3918
- if (deep && this.variables && toplevel && !this._block_scope) {
3919
- node.figure_out_scope({}, {
3920
- toplevel: toplevel,
3921
- parent_scope: this.parent_scope
3922
- });
3923
- } else {
3924
- if (this.variables) node.variables = new Map(this.variables);
3925
- if (this.enclosed) node.enclosed = this.enclosed.slice();
3926
- if (this._block_scope) node._block_scope = this._block_scope;
4078
+ {
4079
+ $documentation: "Base class for all statements introducing a lexical scope",
4080
+ $propdoc: {
4081
+ variables: "[Map/S] a map of name -> SymbolDef for all variables/functions defined in this scope",
4082
+ uses_with: "[boolean/S] tells whether this scope uses the `with` statement",
4083
+ uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`",
4084
+ parent_scope: "[AST_Scope?/S] link to the parent scope",
4085
+ enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
4086
+ cname: "[integer/S] current index for mangling variables (used internally by the mangler)",
4087
+ },
4088
+ get_defun_scope: function() {
4089
+ var self = this;
4090
+ while (self.is_block_scope()) {
4091
+ self = self.parent_scope;
4092
+ }
4093
+ return self;
4094
+ },
4095
+ clone: function(deep, toplevel) {
4096
+ var node = this._clone(deep);
4097
+ if (deep && this.variables && toplevel && !this._block_scope) {
4098
+ node.figure_out_scope({}, {
4099
+ toplevel: toplevel,
4100
+ parent_scope: this.parent_scope
4101
+ });
4102
+ } else {
4103
+ if (this.variables) node.variables = new Map(this.variables);
4104
+ if (this.enclosed) node.enclosed = this.enclosed.slice();
4105
+ if (this._block_scope) node._block_scope = this._block_scope;
4106
+ }
4107
+ return node;
4108
+ },
4109
+ pinned: function() {
4110
+ return this.uses_eval || this.uses_with;
3927
4111
  }
3928
- return node;
3929
4112
  },
3930
- pinned: function() {
3931
- return this.uses_eval || this.uses_with;
3932
- }
3933
- }, AST_Block);
4113
+ AST_Block
4114
+ );
3934
4115
 
3935
- var AST_Toplevel = DEFNODE("Toplevel", "globals", {
4116
+ var AST_Toplevel = DEFNODE("Toplevel", "globals", function AST_Toplevel(props) {
4117
+ if (props) {
4118
+ this.globals = props.globals;
4119
+ this.variables = props.variables;
4120
+ this.functions = props.functions;
4121
+ this.uses_with = props.uses_with;
4122
+ this.uses_eval = props.uses_eval;
4123
+ this.parent_scope = props.parent_scope;
4124
+ this.enclosed = props.enclosed;
4125
+ this.cname = props.cname;
4126
+ this.body = props.body;
4127
+ this.block_scope = props.block_scope;
4128
+ this.start = props.start;
4129
+ this.end = props.end;
4130
+ }
4131
+
4132
+ this.flags = 0;
4133
+ }, {
3936
4134
  $documentation: "The toplevel scope",
3937
4135
  $propdoc: {
3938
4136
  globals: "[Map/S] a map of name -> SymbolDef for all undeclared names",
@@ -3967,7 +4165,15 @@ var AST_Toplevel = DEFNODE("Toplevel", "globals", {
3967
4165
  }
3968
4166
  }, AST_Scope);
3969
4167
 
3970
- var AST_Expansion = DEFNODE("Expansion", "expression", {
4168
+ var AST_Expansion = DEFNODE("Expansion", "expression", function AST_Expansion(props) {
4169
+ if (props) {
4170
+ this.expression = props.expression;
4171
+ this.start = props.start;
4172
+ this.end = props.end;
4173
+ }
4174
+
4175
+ this.flags = 0;
4176
+ }, {
3971
4177
  $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",
3972
4178
  $propdoc: {
3973
4179
  expression: "[AST_Node] the thing to be expanded"
@@ -3982,80 +4188,200 @@ var AST_Expansion = DEFNODE("Expansion", "expression", {
3982
4188
  },
3983
4189
  });
3984
4190
 
3985
- var AST_Lambda = DEFNODE("Lambda", "name argnames uses_arguments is_generator async", {
3986
- $documentation: "Base class for functions",
3987
- $propdoc: {
3988
- name: "[AST_SymbolDeclaration?] the name of this function",
3989
- argnames: "[AST_SymbolFunarg|AST_Destructuring|AST_Expansion|AST_DefaultAssign*] array of function arguments, destructurings, or expanding arguments",
3990
- uses_arguments: "[boolean/S] tells whether this function accesses the arguments array",
3991
- is_generator: "[boolean] is this a generator method",
3992
- async: "[boolean] is this method async",
4191
+ var AST_Lambda = DEFNODE(
4192
+ "Lambda",
4193
+ "name argnames uses_arguments is_generator async",
4194
+ function AST_Lambda(props) {
4195
+ if (props) {
4196
+ this.name = props.name;
4197
+ this.argnames = props.argnames;
4198
+ this.uses_arguments = props.uses_arguments;
4199
+ this.is_generator = props.is_generator;
4200
+ this.async = props.async;
4201
+ this.variables = props.variables;
4202
+ this.functions = props.functions;
4203
+ this.uses_with = props.uses_with;
4204
+ this.uses_eval = props.uses_eval;
4205
+ this.parent_scope = props.parent_scope;
4206
+ this.enclosed = props.enclosed;
4207
+ this.cname = props.cname;
4208
+ this.body = props.body;
4209
+ this.block_scope = props.block_scope;
4210
+ this.start = props.start;
4211
+ this.end = props.end;
4212
+ }
4213
+
4214
+ this.flags = 0;
3993
4215
  },
3994
- args_as_names: function () {
3995
- var out = [];
3996
- for (var i = 0; i < this.argnames.length; i++) {
3997
- if (this.argnames[i] instanceof AST_Destructuring) {
3998
- out.push(...this.argnames[i].all_symbols());
3999
- } else {
4000
- out.push(this.argnames[i]);
4001
- }
4002
- }
4003
- return out;
4004
- },
4005
- _walk: function(visitor) {
4006
- return visitor._visit(this, function() {
4007
- if (this.name) this.name._walk(visitor);
4008
- var argnames = this.argnames;
4009
- for (var i = 0, len = argnames.length; i < len; i++) {
4010
- argnames[i]._walk(visitor);
4216
+ {
4217
+ $documentation: "Base class for functions",
4218
+ $propdoc: {
4219
+ name: "[AST_SymbolDeclaration?] the name of this function",
4220
+ argnames: "[AST_SymbolFunarg|AST_Destructuring|AST_Expansion|AST_DefaultAssign*] array of function arguments, destructurings, or expanding arguments",
4221
+ uses_arguments: "[boolean/S] tells whether this function accesses the arguments array",
4222
+ is_generator: "[boolean] is this a generator method",
4223
+ async: "[boolean] is this method async",
4224
+ },
4225
+ args_as_names: function () {
4226
+ var out = [];
4227
+ for (var i = 0; i < this.argnames.length; i++) {
4228
+ if (this.argnames[i] instanceof AST_Destructuring) {
4229
+ out.push(...this.argnames[i].all_symbols());
4230
+ } else {
4231
+ out.push(this.argnames[i]);
4232
+ }
4011
4233
  }
4012
- walk_body(this, visitor);
4013
- });
4014
- },
4015
- _children_backwards(push) {
4016
- let i = this.body.length;
4017
- while (i--) push(this.body[i]);
4234
+ return out;
4235
+ },
4236
+ _walk: function(visitor) {
4237
+ return visitor._visit(this, function() {
4238
+ if (this.name) this.name._walk(visitor);
4239
+ var argnames = this.argnames;
4240
+ for (var i = 0, len = argnames.length; i < len; i++) {
4241
+ argnames[i]._walk(visitor);
4242
+ }
4243
+ walk_body(this, visitor);
4244
+ });
4245
+ },
4246
+ _children_backwards(push) {
4247
+ let i = this.body.length;
4248
+ while (i--) push(this.body[i]);
4018
4249
 
4019
- i = this.argnames.length;
4020
- while (i--) push(this.argnames[i]);
4250
+ i = this.argnames.length;
4251
+ while (i--) push(this.argnames[i]);
4021
4252
 
4022
- if (this.name) push(this.name);
4023
- },
4024
- is_braceless() {
4025
- return this.body[0] instanceof AST_Return && this.body[0].value;
4026
- },
4027
- // Default args and expansion don't count, so .argnames.length doesn't cut it
4028
- length_property() {
4029
- let length = 0;
4253
+ if (this.name) push(this.name);
4254
+ },
4255
+ is_braceless() {
4256
+ return this.body[0] instanceof AST_Return && this.body[0].value;
4257
+ },
4258
+ // Default args and expansion don't count, so .argnames.length doesn't cut it
4259
+ length_property() {
4260
+ let length = 0;
4030
4261
 
4031
- for (const arg of this.argnames) {
4032
- if (arg instanceof AST_SymbolFunarg || arg instanceof AST_Destructuring) {
4033
- length++;
4262
+ for (const arg of this.argnames) {
4263
+ if (arg instanceof AST_SymbolFunarg || arg instanceof AST_Destructuring) {
4264
+ length++;
4265
+ }
4034
4266
  }
4035
- }
4036
4267
 
4037
- return length;
4038
- }
4039
- }, AST_Scope);
4268
+ return length;
4269
+ }
4270
+ },
4271
+ AST_Scope
4272
+ );
4040
4273
 
4041
- var AST_Accessor = DEFNODE("Accessor", null, {
4274
+ var AST_Accessor = DEFNODE("Accessor", null, function AST_Accessor(props) {
4275
+ if (props) {
4276
+ this.name = props.name;
4277
+ this.argnames = props.argnames;
4278
+ this.uses_arguments = props.uses_arguments;
4279
+ this.is_generator = props.is_generator;
4280
+ this.async = props.async;
4281
+ this.variables = props.variables;
4282
+ this.functions = props.functions;
4283
+ this.uses_with = props.uses_with;
4284
+ this.uses_eval = props.uses_eval;
4285
+ this.parent_scope = props.parent_scope;
4286
+ this.enclosed = props.enclosed;
4287
+ this.cname = props.cname;
4288
+ this.body = props.body;
4289
+ this.block_scope = props.block_scope;
4290
+ this.start = props.start;
4291
+ this.end = props.end;
4292
+ }
4293
+
4294
+ this.flags = 0;
4295
+ }, {
4042
4296
  $documentation: "A setter/getter function. The `name` property is always null."
4043
4297
  }, AST_Lambda);
4044
4298
 
4045
- var AST_Function = DEFNODE("Function", null, {
4299
+ var AST_Function = DEFNODE("Function", null, function AST_Function(props) {
4300
+ if (props) {
4301
+ this.name = props.name;
4302
+ this.argnames = props.argnames;
4303
+ this.uses_arguments = props.uses_arguments;
4304
+ this.is_generator = props.is_generator;
4305
+ this.async = props.async;
4306
+ this.variables = props.variables;
4307
+ this.functions = props.functions;
4308
+ this.uses_with = props.uses_with;
4309
+ this.uses_eval = props.uses_eval;
4310
+ this.parent_scope = props.parent_scope;
4311
+ this.enclosed = props.enclosed;
4312
+ this.cname = props.cname;
4313
+ this.body = props.body;
4314
+ this.block_scope = props.block_scope;
4315
+ this.start = props.start;
4316
+ this.end = props.end;
4317
+ }
4318
+
4319
+ this.flags = 0;
4320
+ }, {
4046
4321
  $documentation: "A function expression"
4047
4322
  }, AST_Lambda);
4048
4323
 
4049
- var AST_Arrow = DEFNODE("Arrow", null, {
4324
+ var AST_Arrow = DEFNODE("Arrow", null, function AST_Arrow(props) {
4325
+ if (props) {
4326
+ this.name = props.name;
4327
+ this.argnames = props.argnames;
4328
+ this.uses_arguments = props.uses_arguments;
4329
+ this.is_generator = props.is_generator;
4330
+ this.async = props.async;
4331
+ this.variables = props.variables;
4332
+ this.functions = props.functions;
4333
+ this.uses_with = props.uses_with;
4334
+ this.uses_eval = props.uses_eval;
4335
+ this.parent_scope = props.parent_scope;
4336
+ this.enclosed = props.enclosed;
4337
+ this.cname = props.cname;
4338
+ this.body = props.body;
4339
+ this.block_scope = props.block_scope;
4340
+ this.start = props.start;
4341
+ this.end = props.end;
4342
+ }
4343
+
4344
+ this.flags = 0;
4345
+ }, {
4050
4346
  $documentation: "An ES6 Arrow function ((a) => b)"
4051
4347
  }, AST_Lambda);
4052
4348
 
4053
- var AST_Defun = DEFNODE("Defun", null, {
4349
+ var AST_Defun = DEFNODE("Defun", null, function AST_Defun(props) {
4350
+ if (props) {
4351
+ this.name = props.name;
4352
+ this.argnames = props.argnames;
4353
+ this.uses_arguments = props.uses_arguments;
4354
+ this.is_generator = props.is_generator;
4355
+ this.async = props.async;
4356
+ this.variables = props.variables;
4357
+ this.functions = props.functions;
4358
+ this.uses_with = props.uses_with;
4359
+ this.uses_eval = props.uses_eval;
4360
+ this.parent_scope = props.parent_scope;
4361
+ this.enclosed = props.enclosed;
4362
+ this.cname = props.cname;
4363
+ this.body = props.body;
4364
+ this.block_scope = props.block_scope;
4365
+ this.start = props.start;
4366
+ this.end = props.end;
4367
+ }
4368
+
4369
+ this.flags = 0;
4370
+ }, {
4054
4371
  $documentation: "A function definition"
4055
4372
  }, AST_Lambda);
4056
4373
 
4057
4374
  /* -----[ DESTRUCTURING ]----- */
4058
- var AST_Destructuring = DEFNODE("Destructuring", "names is_array", {
4375
+ var AST_Destructuring = DEFNODE("Destructuring", "names is_array", function AST_Destructuring(props) {
4376
+ if (props) {
4377
+ this.names = props.names;
4378
+ this.is_array = props.is_array;
4379
+ this.start = props.start;
4380
+ this.end = props.end;
4381
+ }
4382
+
4383
+ this.flags = 0;
4384
+ }, {
4059
4385
  $documentation: "A destructuring of several names. Used in destructuring assignment and with destructuring function argument names",
4060
4386
  $propdoc: {
4061
4387
  "names": "[AST_Node*] Array of properties or elements",
@@ -4083,25 +4409,47 @@ var AST_Destructuring = DEFNODE("Destructuring", "names is_array", {
4083
4409
  }
4084
4410
  });
4085
4411
 
4086
- var AST_PrefixedTemplateString = DEFNODE("PrefixedTemplateString", "template_string prefix", {
4087
- $documentation: "A templatestring with a prefix, such as String.raw`foobarbaz`",
4088
- $propdoc: {
4089
- template_string: "[AST_TemplateString] The template string",
4090
- prefix: "[AST_Node] The prefix, which will get called."
4091
- },
4092
- _walk: function(visitor) {
4093
- return visitor._visit(this, function () {
4094
- this.prefix._walk(visitor);
4095
- this.template_string._walk(visitor);
4096
- });
4097
- },
4098
- _children_backwards(push) {
4099
- push(this.template_string);
4100
- push(this.prefix);
4412
+ var AST_PrefixedTemplateString = DEFNODE(
4413
+ "PrefixedTemplateString",
4414
+ "template_string prefix",
4415
+ function AST_PrefixedTemplateString(props) {
4416
+ if (props) {
4417
+ this.template_string = props.template_string;
4418
+ this.prefix = props.prefix;
4419
+ this.start = props.start;
4420
+ this.end = props.end;
4421
+ }
4422
+
4423
+ this.flags = 0;
4101
4424
  },
4102
- });
4425
+ {
4426
+ $documentation: "A templatestring with a prefix, such as String.raw`foobarbaz`",
4427
+ $propdoc: {
4428
+ template_string: "[AST_TemplateString] The template string",
4429
+ prefix: "[AST_Node] The prefix, which will get called."
4430
+ },
4431
+ _walk: function(visitor) {
4432
+ return visitor._visit(this, function () {
4433
+ this.prefix._walk(visitor);
4434
+ this.template_string._walk(visitor);
4435
+ });
4436
+ },
4437
+ _children_backwards(push) {
4438
+ push(this.template_string);
4439
+ push(this.prefix);
4440
+ },
4441
+ }
4442
+ );
4443
+
4444
+ var AST_TemplateString = DEFNODE("TemplateString", "segments", function AST_TemplateString(props) {
4445
+ if (props) {
4446
+ this.segments = props.segments;
4447
+ this.start = props.start;
4448
+ this.end = props.end;
4449
+ }
4103
4450
 
4104
- var AST_TemplateString = DEFNODE("TemplateString", "segments", {
4451
+ this.flags = 0;
4452
+ }, {
4105
4453
  $documentation: "A template string literal",
4106
4454
  $propdoc: {
4107
4455
  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."
@@ -4119,7 +4467,16 @@ var AST_TemplateString = DEFNODE("TemplateString", "segments", {
4119
4467
  }
4120
4468
  });
4121
4469
 
4122
- var AST_TemplateSegment = DEFNODE("TemplateSegment", "value raw", {
4470
+ var AST_TemplateSegment = DEFNODE("TemplateSegment", "value raw", function AST_TemplateSegment(props) {
4471
+ if (props) {
4472
+ this.value = props.value;
4473
+ this.raw = props.raw;
4474
+ this.start = props.start;
4475
+ this.end = props.end;
4476
+ }
4477
+
4478
+ this.flags = 0;
4479
+ }, {
4123
4480
  $documentation: "A segment of a template string literal",
4124
4481
  $propdoc: {
4125
4482
  value: "Content of the segment",
@@ -4129,11 +4486,26 @@ var AST_TemplateSegment = DEFNODE("TemplateSegment", "value raw", {
4129
4486
 
4130
4487
  /* -----[ JUMPS ]----- */
4131
4488
 
4132
- var AST_Jump = DEFNODE("Jump", null, {
4489
+ var AST_Jump = DEFNODE("Jump", null, function AST_Jump(props) {
4490
+ if (props) {
4491
+ this.start = props.start;
4492
+ this.end = props.end;
4493
+ }
4494
+
4495
+ this.flags = 0;
4496
+ }, {
4133
4497
  $documentation: "Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"
4134
4498
  }, AST_Statement);
4135
4499
 
4136
- var AST_Exit = DEFNODE("Exit", "value", {
4500
+ var AST_Exit = DEFNODE("Exit", "value", function AST_Exit(props) {
4501
+ if (props) {
4502
+ this.value = props.value;
4503
+ this.start = props.start;
4504
+ this.end = props.end;
4505
+ }
4506
+
4507
+ this.flags = 0;
4508
+ }, {
4137
4509
  $documentation: "Base class for “exits” (`return` and `throw`)",
4138
4510
  $propdoc: {
4139
4511
  value: "[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"
@@ -4148,15 +4520,39 @@ var AST_Exit = DEFNODE("Exit", "value", {
4148
4520
  },
4149
4521
  }, AST_Jump);
4150
4522
 
4151
- var AST_Return = DEFNODE("Return", null, {
4523
+ var AST_Return = DEFNODE("Return", null, function AST_Return(props) {
4524
+ if (props) {
4525
+ this.value = props.value;
4526
+ this.start = props.start;
4527
+ this.end = props.end;
4528
+ }
4529
+
4530
+ this.flags = 0;
4531
+ }, {
4152
4532
  $documentation: "A `return` statement"
4153
4533
  }, AST_Exit);
4154
4534
 
4155
- var AST_Throw = DEFNODE("Throw", null, {
4535
+ var AST_Throw = DEFNODE("Throw", null, function AST_Throw(props) {
4536
+ if (props) {
4537
+ this.value = props.value;
4538
+ this.start = props.start;
4539
+ this.end = props.end;
4540
+ }
4541
+
4542
+ this.flags = 0;
4543
+ }, {
4156
4544
  $documentation: "A `throw` statement"
4157
4545
  }, AST_Exit);
4158
4546
 
4159
- var AST_LoopControl = DEFNODE("LoopControl", "label", {
4547
+ var AST_LoopControl = DEFNODE("LoopControl", "label", function AST_LoopControl(props) {
4548
+ if (props) {
4549
+ this.label = props.label;
4550
+ this.start = props.start;
4551
+ this.end = props.end;
4552
+ }
4553
+
4554
+ this.flags = 0;
4555
+ }, {
4160
4556
  $documentation: "Base class for loop control statements (`break` and `continue`)",
4161
4557
  $propdoc: {
4162
4558
  label: "[AST_LabelRef?] the label, or null if none",
@@ -4171,15 +4567,39 @@ var AST_LoopControl = DEFNODE("LoopControl", "label", {
4171
4567
  },
4172
4568
  }, AST_Jump);
4173
4569
 
4174
- var AST_Break = DEFNODE("Break", null, {
4570
+ var AST_Break = DEFNODE("Break", null, function AST_Break(props) {
4571
+ if (props) {
4572
+ this.label = props.label;
4573
+ this.start = props.start;
4574
+ this.end = props.end;
4575
+ }
4576
+
4577
+ this.flags = 0;
4578
+ }, {
4175
4579
  $documentation: "A `break` statement"
4176
4580
  }, AST_LoopControl);
4177
4581
 
4178
- var AST_Continue = DEFNODE("Continue", null, {
4582
+ var AST_Continue = DEFNODE("Continue", null, function AST_Continue(props) {
4583
+ if (props) {
4584
+ this.label = props.label;
4585
+ this.start = props.start;
4586
+ this.end = props.end;
4587
+ }
4588
+
4589
+ this.flags = 0;
4590
+ }, {
4179
4591
  $documentation: "A `continue` statement"
4180
4592
  }, AST_LoopControl);
4181
4593
 
4182
- var AST_Await = DEFNODE("Await", "expression", {
4594
+ var AST_Await = DEFNODE("Await", "expression", function AST_Await(props) {
4595
+ if (props) {
4596
+ this.expression = props.expression;
4597
+ this.start = props.start;
4598
+ this.end = props.end;
4599
+ }
4600
+
4601
+ this.flags = 0;
4602
+ }, {
4183
4603
  $documentation: "An `await` statement",
4184
4604
  $propdoc: {
4185
4605
  expression: "[AST_Node] the mandatory expression being awaited",
@@ -4194,7 +4614,16 @@ var AST_Await = DEFNODE("Await", "expression", {
4194
4614
  },
4195
4615
  });
4196
4616
 
4197
- var AST_Yield = DEFNODE("Yield", "expression is_star", {
4617
+ var AST_Yield = DEFNODE("Yield", "expression is_star", function AST_Yield(props) {
4618
+ if (props) {
4619
+ this.expression = props.expression;
4620
+ this.is_star = props.is_star;
4621
+ this.start = props.start;
4622
+ this.end = props.end;
4623
+ }
4624
+
4625
+ this.flags = 0;
4626
+ }, {
4198
4627
  $documentation: "A `yield` statement",
4199
4628
  $propdoc: {
4200
4629
  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",
@@ -4212,7 +4641,17 @@ var AST_Yield = DEFNODE("Yield", "expression is_star", {
4212
4641
 
4213
4642
  /* -----[ IF ]----- */
4214
4643
 
4215
- var AST_If = DEFNODE("If", "condition alternative", {
4644
+ var AST_If = DEFNODE("If", "condition alternative", function AST_If(props) {
4645
+ if (props) {
4646
+ this.condition = props.condition;
4647
+ this.alternative = props.alternative;
4648
+ this.body = props.body;
4649
+ this.start = props.start;
4650
+ this.end = props.end;
4651
+ }
4652
+
4653
+ this.flags = 0;
4654
+ }, {
4216
4655
  $documentation: "A `if` statement",
4217
4656
  $propdoc: {
4218
4657
  condition: "[AST_Node] the `if` condition",
@@ -4236,7 +4675,17 @@ var AST_If = DEFNODE("If", "condition alternative", {
4236
4675
 
4237
4676
  /* -----[ SWITCH ]----- */
4238
4677
 
4239
- var AST_Switch = DEFNODE("Switch", "expression", {
4678
+ var AST_Switch = DEFNODE("Switch", "expression", function AST_Switch(props) {
4679
+ if (props) {
4680
+ this.expression = props.expression;
4681
+ this.body = props.body;
4682
+ this.block_scope = props.block_scope;
4683
+ this.start = props.start;
4684
+ this.end = props.end;
4685
+ }
4686
+
4687
+ this.flags = 0;
4688
+ }, {
4240
4689
  $documentation: "A `switch` statement",
4241
4690
  $propdoc: {
4242
4691
  expression: "[AST_Node] the `switch` “discriminant”"
@@ -4254,15 +4703,43 @@ var AST_Switch = DEFNODE("Switch", "expression", {
4254
4703
  }
4255
4704
  }, AST_Block);
4256
4705
 
4257
- var AST_SwitchBranch = DEFNODE("SwitchBranch", null, {
4706
+ var AST_SwitchBranch = DEFNODE("SwitchBranch", null, function AST_SwitchBranch(props) {
4707
+ if (props) {
4708
+ this.body = props.body;
4709
+ this.block_scope = props.block_scope;
4710
+ this.start = props.start;
4711
+ this.end = props.end;
4712
+ }
4713
+
4714
+ this.flags = 0;
4715
+ }, {
4258
4716
  $documentation: "Base class for `switch` branches",
4259
4717
  }, AST_Block);
4260
4718
 
4261
- var AST_Default = DEFNODE("Default", null, {
4719
+ var AST_Default = DEFNODE("Default", null, function AST_Default(props) {
4720
+ if (props) {
4721
+ this.body = props.body;
4722
+ this.block_scope = props.block_scope;
4723
+ this.start = props.start;
4724
+ this.end = props.end;
4725
+ }
4726
+
4727
+ this.flags = 0;
4728
+ }, {
4262
4729
  $documentation: "A `default` switch branch",
4263
4730
  }, AST_SwitchBranch);
4264
4731
 
4265
- var AST_Case = DEFNODE("Case", "expression", {
4732
+ var AST_Case = DEFNODE("Case", "expression", function AST_Case(props) {
4733
+ if (props) {
4734
+ this.expression = props.expression;
4735
+ this.body = props.body;
4736
+ this.block_scope = props.block_scope;
4737
+ this.start = props.start;
4738
+ this.end = props.end;
4739
+ }
4740
+
4741
+ this.flags = 0;
4742
+ }, {
4266
4743
  $documentation: "A `case` switch branch",
4267
4744
  $propdoc: {
4268
4745
  expression: "[AST_Node] the `case` expression"
@@ -4282,7 +4759,18 @@ var AST_Case = DEFNODE("Case", "expression", {
4282
4759
 
4283
4760
  /* -----[ EXCEPTIONS ]----- */
4284
4761
 
4285
- var AST_Try = DEFNODE("Try", "bcatch bfinally", {
4762
+ var AST_Try = DEFNODE("Try", "bcatch bfinally", function AST_Try(props) {
4763
+ if (props) {
4764
+ this.bcatch = props.bcatch;
4765
+ this.bfinally = props.bfinally;
4766
+ this.body = props.body;
4767
+ this.block_scope = props.block_scope;
4768
+ this.start = props.start;
4769
+ this.end = props.end;
4770
+ }
4771
+
4772
+ this.flags = 0;
4773
+ }, {
4286
4774
  $documentation: "A `try` statement",
4287
4775
  $propdoc: {
4288
4776
  bcatch: "[AST_Catch?] the catch block, or null if not present",
@@ -4303,7 +4791,17 @@ var AST_Try = DEFNODE("Try", "bcatch bfinally", {
4303
4791
  },
4304
4792
  }, AST_Block);
4305
4793
 
4306
- var AST_Catch = DEFNODE("Catch", "argname", {
4794
+ var AST_Catch = DEFNODE("Catch", "argname", function AST_Catch(props) {
4795
+ if (props) {
4796
+ this.argname = props.argname;
4797
+ this.body = props.body;
4798
+ this.block_scope = props.block_scope;
4799
+ this.start = props.start;
4800
+ this.end = props.end;
4801
+ }
4802
+
4803
+ this.flags = 0;
4804
+ }, {
4307
4805
  $documentation: "A `catch` node; only makes sense as part of a `try` statement",
4308
4806
  $propdoc: {
4309
4807
  argname: "[AST_SymbolCatch|AST_Destructuring|AST_Expansion|AST_DefaultAssign] symbol for the exception"
@@ -4321,13 +4819,30 @@ var AST_Catch = DEFNODE("Catch", "argname", {
4321
4819
  },
4322
4820
  }, AST_Block);
4323
4821
 
4324
- var AST_Finally = DEFNODE("Finally", null, {
4822
+ var AST_Finally = DEFNODE("Finally", null, function AST_Finally(props) {
4823
+ if (props) {
4824
+ this.body = props.body;
4825
+ this.block_scope = props.block_scope;
4826
+ this.start = props.start;
4827
+ this.end = props.end;
4828
+ }
4829
+
4830
+ this.flags = 0;
4831
+ }, {
4325
4832
  $documentation: "A `finally` node; only makes sense as part of a `try` statement"
4326
4833
  }, AST_Block);
4327
4834
 
4328
4835
  /* -----[ VAR/CONST ]----- */
4329
4836
 
4330
- var AST_Definitions = DEFNODE("Definitions", "definitions", {
4837
+ var AST_Definitions = DEFNODE("Definitions", "definitions", function AST_Definitions(props) {
4838
+ if (props) {
4839
+ this.definitions = props.definitions;
4840
+ this.start = props.start;
4841
+ this.end = props.end;
4842
+ }
4843
+
4844
+ this.flags = 0;
4845
+ }, {
4331
4846
  $documentation: "Base class for `var` or `const` nodes (variable declarations/initializations)",
4332
4847
  $propdoc: {
4333
4848
  definitions: "[AST_VarDef*] array of variable definitions"
@@ -4346,19 +4861,52 @@ var AST_Definitions = DEFNODE("Definitions", "definitions", {
4346
4861
  },
4347
4862
  }, AST_Statement);
4348
4863
 
4349
- var AST_Var = DEFNODE("Var", null, {
4864
+ var AST_Var = DEFNODE("Var", null, function AST_Var(props) {
4865
+ if (props) {
4866
+ this.definitions = props.definitions;
4867
+ this.start = props.start;
4868
+ this.end = props.end;
4869
+ }
4870
+
4871
+ this.flags = 0;
4872
+ }, {
4350
4873
  $documentation: "A `var` statement"
4351
4874
  }, AST_Definitions);
4352
4875
 
4353
- var AST_Let = DEFNODE("Let", null, {
4876
+ var AST_Let = DEFNODE("Let", null, function AST_Let(props) {
4877
+ if (props) {
4878
+ this.definitions = props.definitions;
4879
+ this.start = props.start;
4880
+ this.end = props.end;
4881
+ }
4882
+
4883
+ this.flags = 0;
4884
+ }, {
4354
4885
  $documentation: "A `let` statement"
4355
4886
  }, AST_Definitions);
4356
4887
 
4357
- var AST_Const = DEFNODE("Const", null, {
4888
+ var AST_Const = DEFNODE("Const", null, function AST_Const(props) {
4889
+ if (props) {
4890
+ this.definitions = props.definitions;
4891
+ this.start = props.start;
4892
+ this.end = props.end;
4893
+ }
4894
+
4895
+ this.flags = 0;
4896
+ }, {
4358
4897
  $documentation: "A `const` statement"
4359
4898
  }, AST_Definitions);
4360
4899
 
4361
- var AST_VarDef = DEFNODE("VarDef", "name value", {
4900
+ var AST_VarDef = DEFNODE("VarDef", "name value", function AST_VarDef(props) {
4901
+ if (props) {
4902
+ this.name = props.name;
4903
+ this.value = props.value;
4904
+ this.start = props.start;
4905
+ this.end = props.end;
4906
+ }
4907
+
4908
+ this.flags = 0;
4909
+ }, {
4362
4910
  $documentation: "A variable declaration; only appears in a AST_Definitions node",
4363
4911
  $propdoc: {
4364
4912
  name: "[AST_Destructuring|AST_SymbolConst|AST_SymbolLet|AST_SymbolVar] name of the variable",
@@ -4376,7 +4924,16 @@ var AST_VarDef = DEFNODE("VarDef", "name value", {
4376
4924
  },
4377
4925
  });
4378
4926
 
4379
- var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", {
4927
+ var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", function AST_NameMapping(props) {
4928
+ if (props) {
4929
+ this.foreign_name = props.foreign_name;
4930
+ this.name = props.name;
4931
+ this.start = props.start;
4932
+ this.end = props.end;
4933
+ }
4934
+
4935
+ this.flags = 0;
4936
+ }, {
4380
4937
  $documentation: "The part of the export/import statement that declare names from a module.",
4381
4938
  $propdoc: {
4382
4939
  foreign_name: "[AST_SymbolExportForeign|AST_SymbolImportForeign] The name being exported/imported (as specified in the module)",
@@ -4394,114 +4951,193 @@ var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", {
4394
4951
  },
4395
4952
  });
4396
4953
 
4397
- var AST_Import = DEFNODE("Import", "imported_name imported_names module_name assert_clause", {
4398
- $documentation: "An `import` statement",
4399
- $propdoc: {
4400
- imported_name: "[AST_SymbolImport] The name of the variable holding the module's default export.",
4401
- imported_names: "[AST_NameMapping*] The names of non-default imported variables",
4402
- module_name: "[AST_String] String literal describing where this module came from",
4403
- assert_clause: "[AST_Object?] The import assertion"
4954
+ var AST_Import = DEFNODE(
4955
+ "Import",
4956
+ "imported_name imported_names module_name assert_clause",
4957
+ function AST_Import(props) {
4958
+ if (props) {
4959
+ this.imported_name = props.imported_name;
4960
+ this.imported_names = props.imported_names;
4961
+ this.module_name = props.module_name;
4962
+ this.assert_clause = props.assert_clause;
4963
+ this.start = props.start;
4964
+ this.end = props.end;
4965
+ }
4966
+
4967
+ this.flags = 0;
4404
4968
  },
4405
- _walk: function(visitor) {
4406
- return visitor._visit(this, function() {
4407
- if (this.imported_name) {
4408
- this.imported_name._walk(visitor);
4409
- }
4969
+ {
4970
+ $documentation: "An `import` statement",
4971
+ $propdoc: {
4972
+ imported_name: "[AST_SymbolImport] The name of the variable holding the module's default export.",
4973
+ imported_names: "[AST_NameMapping*] The names of non-default imported variables",
4974
+ module_name: "[AST_String] String literal describing where this module came from",
4975
+ assert_clause: "[AST_Object?] The import assertion"
4976
+ },
4977
+ _walk: function(visitor) {
4978
+ return visitor._visit(this, function() {
4979
+ if (this.imported_name) {
4980
+ this.imported_name._walk(visitor);
4981
+ }
4982
+ if (this.imported_names) {
4983
+ this.imported_names.forEach(function(name_import) {
4984
+ name_import._walk(visitor);
4985
+ });
4986
+ }
4987
+ this.module_name._walk(visitor);
4988
+ });
4989
+ },
4990
+ _children_backwards(push) {
4991
+ push(this.module_name);
4410
4992
  if (this.imported_names) {
4411
- this.imported_names.forEach(function(name_import) {
4412
- name_import._walk(visitor);
4413
- });
4993
+ let i = this.imported_names.length;
4994
+ while (i--) push(this.imported_names[i]);
4414
4995
  }
4415
- this.module_name._walk(visitor);
4416
- });
4417
- },
4418
- _children_backwards(push) {
4419
- push(this.module_name);
4420
- if (this.imported_names) {
4421
- let i = this.imported_names.length;
4422
- while (i--) push(this.imported_names[i]);
4423
- }
4424
- if (this.imported_name) push(this.imported_name);
4425
- },
4426
- });
4996
+ if (this.imported_name) push(this.imported_name);
4997
+ },
4998
+ }
4999
+ );
5000
+
5001
+ var AST_ImportMeta = DEFNODE("ImportMeta", null, function AST_ImportMeta(props) {
5002
+ if (props) {
5003
+ this.start = props.start;
5004
+ this.end = props.end;
5005
+ }
4427
5006
 
4428
- var AST_ImportMeta = DEFNODE("ImportMeta", null, {
5007
+ this.flags = 0;
5008
+ }, {
4429
5009
  $documentation: "A reference to import.meta",
4430
5010
  });
4431
5011
 
4432
- var AST_Export = DEFNODE("Export", "exported_definition exported_value is_default exported_names module_name assert_clause", {
4433
- $documentation: "An `export` statement",
4434
- $propdoc: {
4435
- exported_definition: "[AST_Defun|AST_Definitions|AST_DefClass?] An exported definition",
4436
- exported_value: "[AST_Node?] An exported value",
4437
- exported_names: "[AST_NameMapping*?] List of exported names",
4438
- module_name: "[AST_String?] Name of the file to load exports from",
4439
- is_default: "[Boolean] Whether this is the default exported value of this module",
4440
- assert_clause: "[AST_Object?] The import assertion"
5012
+ var AST_Export = DEFNODE(
5013
+ "Export",
5014
+ "exported_definition exported_value is_default exported_names module_name assert_clause",
5015
+ function AST_Export(props) {
5016
+ if (props) {
5017
+ this.exported_definition = props.exported_definition;
5018
+ this.exported_value = props.exported_value;
5019
+ this.is_default = props.is_default;
5020
+ this.exported_names = props.exported_names;
5021
+ this.module_name = props.module_name;
5022
+ this.assert_clause = props.assert_clause;
5023
+ this.start = props.start;
5024
+ this.end = props.end;
5025
+ }
5026
+
5027
+ this.flags = 0;
4441
5028
  },
4442
- _walk: function (visitor) {
4443
- return visitor._visit(this, function () {
4444
- if (this.exported_definition) {
4445
- this.exported_definition._walk(visitor);
4446
- }
4447
- if (this.exported_value) {
4448
- this.exported_value._walk(visitor);
4449
- }
5029
+ {
5030
+ $documentation: "An `export` statement",
5031
+ $propdoc: {
5032
+ exported_definition: "[AST_Defun|AST_Definitions|AST_DefClass?] An exported definition",
5033
+ exported_value: "[AST_Node?] An exported value",
5034
+ exported_names: "[AST_NameMapping*?] List of exported names",
5035
+ module_name: "[AST_String?] Name of the file to load exports from",
5036
+ is_default: "[Boolean] Whether this is the default exported value of this module",
5037
+ assert_clause: "[AST_Object?] The import assertion"
5038
+ },
5039
+ _walk: function (visitor) {
5040
+ return visitor._visit(this, function () {
5041
+ if (this.exported_definition) {
5042
+ this.exported_definition._walk(visitor);
5043
+ }
5044
+ if (this.exported_value) {
5045
+ this.exported_value._walk(visitor);
5046
+ }
5047
+ if (this.exported_names) {
5048
+ this.exported_names.forEach(function(name_export) {
5049
+ name_export._walk(visitor);
5050
+ });
5051
+ }
5052
+ if (this.module_name) {
5053
+ this.module_name._walk(visitor);
5054
+ }
5055
+ });
5056
+ },
5057
+ _children_backwards(push) {
5058
+ if (this.module_name) push(this.module_name);
4450
5059
  if (this.exported_names) {
4451
- this.exported_names.forEach(function(name_export) {
4452
- name_export._walk(visitor);
4453
- });
4454
- }
4455
- if (this.module_name) {
4456
- this.module_name._walk(visitor);
5060
+ let i = this.exported_names.length;
5061
+ while (i--) push(this.exported_names[i]);
4457
5062
  }
4458
- });
4459
- },
4460
- _children_backwards(push) {
4461
- if (this.module_name) push(this.module_name);
4462
- if (this.exported_names) {
4463
- let i = this.exported_names.length;
4464
- while (i--) push(this.exported_names[i]);
5063
+ if (this.exported_value) push(this.exported_value);
5064
+ if (this.exported_definition) push(this.exported_definition);
4465
5065
  }
4466
- if (this.exported_value) push(this.exported_value);
4467
- if (this.exported_definition) push(this.exported_definition);
4468
- }
4469
- }, AST_Statement);
5066
+ },
5067
+ AST_Statement
5068
+ );
4470
5069
 
4471
5070
  /* -----[ OTHER ]----- */
4472
5071
 
4473
- var AST_Call = DEFNODE("Call", "expression args optional _annotations", {
4474
- $documentation: "A function call expression",
4475
- $propdoc: {
4476
- expression: "[AST_Node] expression to invoke as function",
4477
- args: "[AST_Node*] array of arguments",
4478
- optional: "[boolean] whether this is an optional call (IE ?.() )",
4479
- _annotations: "[number] bitfield containing information about the call"
4480
- },
4481
- initialize() {
4482
- if (this._annotations == null) this._annotations = 0;
4483
- },
4484
- _walk(visitor) {
4485
- return visitor._visit(this, function() {
4486
- var args = this.args;
4487
- for (var i = 0, len = args.length; i < len; i++) {
4488
- args[i]._walk(visitor);
4489
- }
4490
- this.expression._walk(visitor); // TODO why do we need to crawl this last?
4491
- });
4492
- },
4493
- _children_backwards(push) {
4494
- let i = this.args.length;
4495
- while (i--) push(this.args[i]);
4496
- push(this.expression);
5072
+ var AST_Call = DEFNODE(
5073
+ "Call",
5074
+ "expression args optional _annotations",
5075
+ function AST_Call(props) {
5076
+ if (props) {
5077
+ this.expression = props.expression;
5078
+ this.args = props.args;
5079
+ this.optional = props.optional;
5080
+ this._annotations = props._annotations;
5081
+ this.start = props.start;
5082
+ this.end = props.end;
5083
+ this.initialize();
5084
+ }
5085
+
5086
+ this.flags = 0;
4497
5087
  },
4498
- });
5088
+ {
5089
+ $documentation: "A function call expression",
5090
+ $propdoc: {
5091
+ expression: "[AST_Node] expression to invoke as function",
5092
+ args: "[AST_Node*] array of arguments",
5093
+ optional: "[boolean] whether this is an optional call (IE ?.() )",
5094
+ _annotations: "[number] bitfield containing information about the call"
5095
+ },
5096
+ initialize() {
5097
+ if (this._annotations == null) this._annotations = 0;
5098
+ },
5099
+ _walk(visitor) {
5100
+ return visitor._visit(this, function() {
5101
+ var args = this.args;
5102
+ for (var i = 0, len = args.length; i < len; i++) {
5103
+ args[i]._walk(visitor);
5104
+ }
5105
+ this.expression._walk(visitor); // TODO why do we need to crawl this last?
5106
+ });
5107
+ },
5108
+ _children_backwards(push) {
5109
+ let i = this.args.length;
5110
+ while (i--) push(this.args[i]);
5111
+ push(this.expression);
5112
+ },
5113
+ }
5114
+ );
4499
5115
 
4500
- var AST_New = DEFNODE("New", null, {
5116
+ var AST_New = DEFNODE("New", null, function AST_New(props) {
5117
+ if (props) {
5118
+ this.expression = props.expression;
5119
+ this.args = props.args;
5120
+ this.optional = props.optional;
5121
+ this._annotations = props._annotations;
5122
+ this.start = props.start;
5123
+ this.end = props.end;
5124
+ this.initialize();
5125
+ }
5126
+
5127
+ this.flags = 0;
5128
+ }, {
4501
5129
  $documentation: "An object instantiation. Derives from a function call since it has exactly the same properties"
4502
5130
  }, AST_Call);
4503
5131
 
4504
- var AST_Sequence = DEFNODE("Sequence", "expressions", {
5132
+ var AST_Sequence = DEFNODE("Sequence", "expressions", function AST_Sequence(props) {
5133
+ if (props) {
5134
+ this.expressions = props.expressions;
5135
+ this.start = props.start;
5136
+ this.end = props.end;
5137
+ }
5138
+
5139
+ this.flags = 0;
5140
+ }, {
4505
5141
  $documentation: "A sequence expression (comma-separated expressions)",
4506
5142
  $propdoc: {
4507
5143
  expressions: "[AST_Node*] array of expressions (at least two)"
@@ -4519,17 +5155,43 @@ var AST_Sequence = DEFNODE("Sequence", "expressions", {
4519
5155
  },
4520
5156
  });
4521
5157
 
4522
- var AST_PropAccess = DEFNODE("PropAccess", "expression property optional", {
4523
- $documentation: "Base class for property access expressions, i.e. `a.foo` or `a[\"foo\"]`",
4524
- $propdoc: {
4525
- expression: "[AST_Node] the “container” expression",
4526
- 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",
5158
+ var AST_PropAccess = DEFNODE(
5159
+ "PropAccess",
5160
+ "expression property optional",
5161
+ function AST_PropAccess(props) {
5162
+ if (props) {
5163
+ this.expression = props.expression;
5164
+ this.property = props.property;
5165
+ this.optional = props.optional;
5166
+ this.start = props.start;
5167
+ this.end = props.end;
5168
+ }
4527
5169
 
4528
- optional: "[boolean] whether this is an optional property access (IE ?.)"
5170
+ this.flags = 0;
5171
+ },
5172
+ {
5173
+ $documentation: "Base class for property access expressions, i.e. `a.foo` or `a[\"foo\"]`",
5174
+ $propdoc: {
5175
+ expression: "[AST_Node] the “container” expression",
5176
+ 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",
5177
+
5178
+ optional: "[boolean] whether this is an optional property access (IE ?.)"
5179
+ }
4529
5180
  }
4530
- });
5181
+ );
4531
5182
 
4532
- var AST_Dot = DEFNODE("Dot", "quote", {
5183
+ var AST_Dot = DEFNODE("Dot", "quote", function AST_Dot(props) {
5184
+ if (props) {
5185
+ this.quote = props.quote;
5186
+ this.expression = props.expression;
5187
+ this.property = props.property;
5188
+ this.optional = props.optional;
5189
+ this.start = props.start;
5190
+ this.end = props.end;
5191
+ }
5192
+
5193
+ this.flags = 0;
5194
+ }, {
4533
5195
  $documentation: "A dotted property access expression",
4534
5196
  $propdoc: {
4535
5197
  quote: "[string] the original quote character when transformed from AST_Sub",
@@ -4544,7 +5206,17 @@ var AST_Dot = DEFNODE("Dot", "quote", {
4544
5206
  },
4545
5207
  }, AST_PropAccess);
4546
5208
 
4547
- var AST_DotHash = DEFNODE("DotHash", "", {
5209
+ var AST_DotHash = DEFNODE("DotHash", "", function AST_DotHash(props) {
5210
+ if (props) {
5211
+ this.expression = props.expression;
5212
+ this.property = props.property;
5213
+ this.optional = props.optional;
5214
+ this.start = props.start;
5215
+ this.end = props.end;
5216
+ }
5217
+
5218
+ this.flags = 0;
5219
+ }, {
4548
5220
  $documentation: "A dotted property access to a private property",
4549
5221
  _walk: function(visitor) {
4550
5222
  return visitor._visit(this, function() {
@@ -4556,7 +5228,17 @@ var AST_DotHash = DEFNODE("DotHash", "", {
4556
5228
  },
4557
5229
  }, AST_PropAccess);
4558
5230
 
4559
- var AST_Sub = DEFNODE("Sub", null, {
5231
+ var AST_Sub = DEFNODE("Sub", null, function AST_Sub(props) {
5232
+ if (props) {
5233
+ this.expression = props.expression;
5234
+ this.property = props.property;
5235
+ this.optional = props.optional;
5236
+ this.start = props.start;
5237
+ this.end = props.end;
5238
+ }
5239
+
5240
+ this.flags = 0;
5241
+ }, {
4560
5242
  $documentation: "Index-style property access, i.e. `a[\"foo\"]`",
4561
5243
  _walk: function(visitor) {
4562
5244
  return visitor._visit(this, function() {
@@ -4570,7 +5252,15 @@ var AST_Sub = DEFNODE("Sub", null, {
4570
5252
  },
4571
5253
  }, AST_PropAccess);
4572
5254
 
4573
- var AST_Chain = DEFNODE("Chain", "expression", {
5255
+ var AST_Chain = DEFNODE("Chain", "expression", function AST_Chain(props) {
5256
+ if (props) {
5257
+ this.expression = props.expression;
5258
+ this.start = props.start;
5259
+ this.end = props.end;
5260
+ }
5261
+
5262
+ this.flags = 0;
5263
+ }, {
4574
5264
  $documentation: "A chain expression like a?.b?.(c)?.[d]",
4575
5265
  $propdoc: {
4576
5266
  expression: "[AST_Call|AST_Dot|AST_DotHash|AST_Sub] chain element."
@@ -4585,7 +5275,16 @@ var AST_Chain = DEFNODE("Chain", "expression", {
4585
5275
  },
4586
5276
  });
4587
5277
 
4588
- var AST_Unary = DEFNODE("Unary", "operator expression", {
5278
+ var AST_Unary = DEFNODE("Unary", "operator expression", function AST_Unary(props) {
5279
+ if (props) {
5280
+ this.operator = props.operator;
5281
+ this.expression = props.expression;
5282
+ this.start = props.start;
5283
+ this.end = props.end;
5284
+ }
5285
+
5286
+ this.flags = 0;
5287
+ }, {
4589
5288
  $documentation: "Base class for unary expressions",
4590
5289
  $propdoc: {
4591
5290
  operator: "[string] the operator",
@@ -4601,15 +5300,43 @@ var AST_Unary = DEFNODE("Unary", "operator expression", {
4601
5300
  },
4602
5301
  });
4603
5302
 
4604
- var AST_UnaryPrefix = DEFNODE("UnaryPrefix", null, {
5303
+ var AST_UnaryPrefix = DEFNODE("UnaryPrefix", null, function AST_UnaryPrefix(props) {
5304
+ if (props) {
5305
+ this.operator = props.operator;
5306
+ this.expression = props.expression;
5307
+ this.start = props.start;
5308
+ this.end = props.end;
5309
+ }
5310
+
5311
+ this.flags = 0;
5312
+ }, {
4605
5313
  $documentation: "Unary prefix expression, i.e. `typeof i` or `++i`"
4606
5314
  }, AST_Unary);
4607
5315
 
4608
- var AST_UnaryPostfix = DEFNODE("UnaryPostfix", null, {
5316
+ var AST_UnaryPostfix = DEFNODE("UnaryPostfix", null, function AST_UnaryPostfix(props) {
5317
+ if (props) {
5318
+ this.operator = props.operator;
5319
+ this.expression = props.expression;
5320
+ this.start = props.start;
5321
+ this.end = props.end;
5322
+ }
5323
+
5324
+ this.flags = 0;
5325
+ }, {
4609
5326
  $documentation: "Unary postfix expression, i.e. `i++`"
4610
5327
  }, AST_Unary);
4611
5328
 
4612
- var AST_Binary = DEFNODE("Binary", "operator left right", {
5329
+ var AST_Binary = DEFNODE("Binary", "operator left right", function AST_Binary(props) {
5330
+ if (props) {
5331
+ this.operator = props.operator;
5332
+ this.left = props.left;
5333
+ this.right = props.right;
5334
+ this.start = props.start;
5335
+ this.end = props.end;
5336
+ }
5337
+
5338
+ this.flags = 0;
5339
+ }, {
4613
5340
  $documentation: "Binary expression, i.e. `a + b`",
4614
5341
  $propdoc: {
4615
5342
  left: "[AST_Node] left-hand side expression",
@@ -4628,41 +5355,85 @@ var AST_Binary = DEFNODE("Binary", "operator left right", {
4628
5355
  },
4629
5356
  });
4630
5357
 
4631
- var AST_Conditional = DEFNODE("Conditional", "condition consequent alternative", {
4632
- $documentation: "Conditional expression using the ternary operator, i.e. `a ? b : c`",
4633
- $propdoc: {
4634
- condition: "[AST_Node]",
4635
- consequent: "[AST_Node]",
4636
- alternative: "[AST_Node]"
4637
- },
4638
- _walk: function(visitor) {
4639
- return visitor._visit(this, function() {
4640
- this.condition._walk(visitor);
4641
- this.consequent._walk(visitor);
4642
- this.alternative._walk(visitor);
4643
- });
4644
- },
4645
- _children_backwards(push) {
4646
- push(this.alternative);
4647
- push(this.consequent);
4648
- push(this.condition);
5358
+ var AST_Conditional = DEFNODE(
5359
+ "Conditional",
5360
+ "condition consequent alternative",
5361
+ function AST_Conditional(props) {
5362
+ if (props) {
5363
+ this.condition = props.condition;
5364
+ this.consequent = props.consequent;
5365
+ this.alternative = props.alternative;
5366
+ this.start = props.start;
5367
+ this.end = props.end;
5368
+ }
5369
+
5370
+ this.flags = 0;
4649
5371
  },
4650
- });
5372
+ {
5373
+ $documentation: "Conditional expression using the ternary operator, i.e. `a ? b : c`",
5374
+ $propdoc: {
5375
+ condition: "[AST_Node]",
5376
+ consequent: "[AST_Node]",
5377
+ alternative: "[AST_Node]"
5378
+ },
5379
+ _walk: function(visitor) {
5380
+ return visitor._visit(this, function() {
5381
+ this.condition._walk(visitor);
5382
+ this.consequent._walk(visitor);
5383
+ this.alternative._walk(visitor);
5384
+ });
5385
+ },
5386
+ _children_backwards(push) {
5387
+ push(this.alternative);
5388
+ push(this.consequent);
5389
+ push(this.condition);
5390
+ },
5391
+ }
5392
+ );
5393
+
5394
+ var AST_Assign = DEFNODE("Assign", "logical", function AST_Assign(props) {
5395
+ if (props) {
5396
+ this.logical = props.logical;
5397
+ this.operator = props.operator;
5398
+ this.left = props.left;
5399
+ this.right = props.right;
5400
+ this.start = props.start;
5401
+ this.end = props.end;
5402
+ }
4651
5403
 
4652
- var AST_Assign = DEFNODE("Assign", "logical", {
5404
+ this.flags = 0;
5405
+ }, {
4653
5406
  $documentation: "An assignment expression — `a = b + 5`",
4654
5407
  $propdoc: {
4655
5408
  logical: "Whether it's a logical assignment"
4656
5409
  }
4657
5410
  }, AST_Binary);
4658
5411
 
4659
- var AST_DefaultAssign = DEFNODE("DefaultAssign", null, {
5412
+ var AST_DefaultAssign = DEFNODE("DefaultAssign", null, function AST_DefaultAssign(props) {
5413
+ if (props) {
5414
+ this.operator = props.operator;
5415
+ this.left = props.left;
5416
+ this.right = props.right;
5417
+ this.start = props.start;
5418
+ this.end = props.end;
5419
+ }
5420
+
5421
+ this.flags = 0;
5422
+ }, {
4660
5423
  $documentation: "A default assignment expression like in `(a = 3) => a`"
4661
5424
  }, AST_Binary);
4662
5425
 
4663
5426
  /* -----[ LITERALS ]----- */
4664
5427
 
4665
- var AST_Array = DEFNODE("Array", "elements", {
5428
+ var AST_Array = DEFNODE("Array", "elements", function AST_Array(props) {
5429
+ if (props) {
5430
+ this.elements = props.elements;
5431
+ this.start = props.start;
5432
+ this.end = props.end;
5433
+ }
5434
+
5435
+ this.flags = 0;
5436
+ }, {
4666
5437
  $documentation: "An array literal",
4667
5438
  $propdoc: {
4668
5439
  elements: "[AST_Node*] array of elements"
@@ -4681,7 +5452,15 @@ var AST_Array = DEFNODE("Array", "elements", {
4681
5452
  },
4682
5453
  });
4683
5454
 
4684
- var AST_Object = DEFNODE("Object", "properties", {
5455
+ var AST_Object = DEFNODE("Object", "properties", function AST_Object(props) {
5456
+ if (props) {
5457
+ this.properties = props.properties;
5458
+ this.start = props.start;
5459
+ this.end = props.end;
5460
+ }
5461
+
5462
+ this.flags = 0;
5463
+ }, {
4685
5464
  $documentation: "An object literal",
4686
5465
  $propdoc: {
4687
5466
  properties: "[AST_ObjectProperty*] array of properties"
@@ -4700,7 +5479,16 @@ var AST_Object = DEFNODE("Object", "properties", {
4700
5479
  },
4701
5480
  });
4702
5481
 
4703
- var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", {
5482
+ var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", function AST_ObjectProperty(props) {
5483
+ if (props) {
5484
+ this.key = props.key;
5485
+ this.value = props.value;
5486
+ this.start = props.start;
5487
+ this.end = props.end;
5488
+ }
5489
+
5490
+ this.flags = 0;
5491
+ }, {
4704
5492
  $documentation: "Base class for literal object properties",
4705
5493
  $propdoc: {
4706
5494
  key: "[string|AST_Node] property name. For ObjectKeyVal this is a string. For getters, setters and computed property this is an AST_Node.",
@@ -4719,7 +5507,17 @@ var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", {
4719
5507
  }
4720
5508
  });
4721
5509
 
4722
- var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", {
5510
+ var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", function AST_ObjectKeyVal(props) {
5511
+ if (props) {
5512
+ this.quote = props.quote;
5513
+ this.key = props.key;
5514
+ this.value = props.value;
5515
+ this.start = props.start;
5516
+ this.end = props.end;
5517
+ }
5518
+
5519
+ this.flags = 0;
5520
+ }, {
4723
5521
  $documentation: "A key: value object property",
4724
5522
  $propdoc: {
4725
5523
  quote: "[string] the original quote character"
@@ -4729,7 +5527,17 @@ var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", {
4729
5527
  }
4730
5528
  }, AST_ObjectProperty);
4731
5529
 
4732
- var AST_PrivateSetter = DEFNODE("PrivateSetter", "static", {
5530
+ var AST_PrivateSetter = DEFNODE("PrivateSetter", "static", function AST_PrivateSetter(props) {
5531
+ if (props) {
5532
+ this.static = props.static;
5533
+ this.key = props.key;
5534
+ this.value = props.value;
5535
+ this.start = props.start;
5536
+ this.end = props.end;
5537
+ }
5538
+
5539
+ this.flags = 0;
5540
+ }, {
4733
5541
  $propdoc: {
4734
5542
  static: "[boolean] whether this is a static private setter"
4735
5543
  },
@@ -4739,7 +5547,17 @@ var AST_PrivateSetter = DEFNODE("PrivateSetter", "static", {
4739
5547
  }
4740
5548
  }, AST_ObjectProperty);
4741
5549
 
4742
- var AST_PrivateGetter = DEFNODE("PrivateGetter", "static", {
5550
+ var AST_PrivateGetter = DEFNODE("PrivateGetter", "static", function AST_PrivateGetter(props) {
5551
+ if (props) {
5552
+ this.static = props.static;
5553
+ this.key = props.key;
5554
+ this.value = props.value;
5555
+ this.start = props.start;
5556
+ this.end = props.end;
5557
+ }
5558
+
5559
+ this.flags = 0;
5560
+ }, {
4743
5561
  $propdoc: {
4744
5562
  static: "[boolean] whether this is a static private getter"
4745
5563
  },
@@ -4749,7 +5567,18 @@ var AST_PrivateGetter = DEFNODE("PrivateGetter", "static", {
4749
5567
  }
4750
5568
  }, AST_ObjectProperty);
4751
5569
 
4752
- var AST_ObjectSetter = DEFNODE("ObjectSetter", "quote static", {
5570
+ var AST_ObjectSetter = DEFNODE("ObjectSetter", "quote static", function AST_ObjectSetter(props) {
5571
+ if (props) {
5572
+ this.quote = props.quote;
5573
+ this.static = props.static;
5574
+ this.key = props.key;
5575
+ this.value = props.value;
5576
+ this.start = props.start;
5577
+ this.end = props.end;
5578
+ }
5579
+
5580
+ this.flags = 0;
5581
+ }, {
4753
5582
  $propdoc: {
4754
5583
  quote: "[string|undefined] the original quote character, if any",
4755
5584
  static: "[boolean] whether this is a static setter (classes only)"
@@ -4760,7 +5589,18 @@ var AST_ObjectSetter = DEFNODE("ObjectSetter", "quote static", {
4760
5589
  }
4761
5590
  }, AST_ObjectProperty);
4762
5591
 
4763
- var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", {
5592
+ var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", function AST_ObjectGetter(props) {
5593
+ if (props) {
5594
+ this.quote = props.quote;
5595
+ this.static = props.static;
5596
+ this.key = props.key;
5597
+ this.value = props.value;
5598
+ this.start = props.start;
5599
+ this.end = props.end;
5600
+ }
5601
+
5602
+ this.flags = 0;
5603
+ }, {
4764
5604
  $propdoc: {
4765
5605
  quote: "[string|undefined] the original quote character, if any",
4766
5606
  static: "[boolean] whether this is a static getter (classes only)"
@@ -4771,24 +5611,75 @@ var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", {
4771
5611
  }
4772
5612
  }, AST_ObjectProperty);
4773
5613
 
4774
- var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static is_generator async", {
4775
- $propdoc: {
4776
- quote: "[string|undefined] the original quote character, if any",
4777
- static: "[boolean] is this method static (classes only)",
4778
- is_generator: "[boolean] is this a generator method",
4779
- async: "[boolean] is this method async",
5614
+ var AST_ConciseMethod = DEFNODE(
5615
+ "ConciseMethod",
5616
+ "quote static is_generator async",
5617
+ function AST_ConciseMethod(props) {
5618
+ if (props) {
5619
+ this.quote = props.quote;
5620
+ this.static = props.static;
5621
+ this.is_generator = props.is_generator;
5622
+ this.async = props.async;
5623
+ this.key = props.key;
5624
+ this.value = props.value;
5625
+ this.start = props.start;
5626
+ this.end = props.end;
5627
+ }
5628
+
5629
+ this.flags = 0;
4780
5630
  },
4781
- $documentation: "An ES6 concise method inside an object or class",
4782
- computed_key() {
4783
- return !(this.key instanceof AST_SymbolMethod);
5631
+ {
5632
+ $propdoc: {
5633
+ quote: "[string|undefined] the original quote character, if any",
5634
+ static: "[boolean] is this method static (classes only)",
5635
+ is_generator: "[boolean] is this a generator method",
5636
+ async: "[boolean] is this method async",
5637
+ },
5638
+ $documentation: "An ES6 concise method inside an object or class",
5639
+ computed_key() {
5640
+ return !(this.key instanceof AST_SymbolMethod);
5641
+ }
5642
+ },
5643
+ AST_ObjectProperty
5644
+ );
5645
+
5646
+ var AST_PrivateMethod = DEFNODE("PrivateMethod", "", function AST_PrivateMethod(props) {
5647
+ if (props) {
5648
+ this.quote = props.quote;
5649
+ this.static = props.static;
5650
+ this.is_generator = props.is_generator;
5651
+ this.async = props.async;
5652
+ this.key = props.key;
5653
+ this.value = props.value;
5654
+ this.start = props.start;
5655
+ this.end = props.end;
4784
5656
  }
4785
- }, AST_ObjectProperty);
4786
5657
 
4787
- var AST_PrivateMethod = DEFNODE("PrivateMethod", "", {
5658
+ this.flags = 0;
5659
+ }, {
4788
5660
  $documentation: "A private class method inside a class",
4789
5661
  }, AST_ConciseMethod);
4790
5662
 
4791
- var AST_Class = DEFNODE("Class", "name extends properties", {
5663
+ var AST_Class = DEFNODE("Class", "name extends properties", function AST_Class(props) {
5664
+ if (props) {
5665
+ this.name = props.name;
5666
+ this.extends = props.extends;
5667
+ this.properties = props.properties;
5668
+ this.variables = props.variables;
5669
+ this.functions = props.functions;
5670
+ this.uses_with = props.uses_with;
5671
+ this.uses_eval = props.uses_eval;
5672
+ this.parent_scope = props.parent_scope;
5673
+ this.enclosed = props.enclosed;
5674
+ this.cname = props.cname;
5675
+ this.body = props.body;
5676
+ this.block_scope = props.block_scope;
5677
+ this.start = props.start;
5678
+ this.end = props.end;
5679
+ }
5680
+
5681
+ this.flags = 0;
5682
+ }, {
4792
5683
  $propdoc: {
4793
5684
  name: "[AST_SymbolClass|AST_SymbolDefClass?] optional class name.",
4794
5685
  extends: "[AST_Node]? optional parent class",
@@ -4814,7 +5705,18 @@ var AST_Class = DEFNODE("Class", "name extends properties", {
4814
5705
  },
4815
5706
  }, AST_Scope /* TODO a class might have a scope but it's not a scope */);
4816
5707
 
4817
- var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", {
5708
+ var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", function AST_ClassProperty(props) {
5709
+ if (props) {
5710
+ this.static = props.static;
5711
+ this.quote = props.quote;
5712
+ this.key = props.key;
5713
+ this.value = props.value;
5714
+ this.start = props.start;
5715
+ this.end = props.end;
5716
+ }
5717
+
5718
+ this.flags = 0;
5719
+ }, {
4818
5720
  $documentation: "A class property",
4819
5721
  $propdoc: {
4820
5722
  static: "[boolean] whether this is a static key",
@@ -4837,19 +5739,78 @@ var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", {
4837
5739
  }
4838
5740
  }, AST_ObjectProperty);
4839
5741
 
4840
- var AST_ClassPrivateProperty = DEFNODE("ClassPrivateProperty", "", {
5742
+ var AST_ClassPrivateProperty = DEFNODE("ClassPrivateProperty", "", function AST_ClassPrivateProperty(props) {
5743
+ if (props) {
5744
+ this.static = props.static;
5745
+ this.quote = props.quote;
5746
+ this.key = props.key;
5747
+ this.value = props.value;
5748
+ this.start = props.start;
5749
+ this.end = props.end;
5750
+ }
5751
+
5752
+ this.flags = 0;
5753
+ }, {
4841
5754
  $documentation: "A class property for a private property",
4842
5755
  }, AST_ClassProperty);
4843
5756
 
4844
- var AST_DefClass = DEFNODE("DefClass", null, {
5757
+ var AST_DefClass = DEFNODE("DefClass", null, function AST_DefClass(props) {
5758
+ if (props) {
5759
+ this.name = props.name;
5760
+ this.extends = props.extends;
5761
+ this.properties = props.properties;
5762
+ this.variables = props.variables;
5763
+ this.functions = props.functions;
5764
+ this.uses_with = props.uses_with;
5765
+ this.uses_eval = props.uses_eval;
5766
+ this.parent_scope = props.parent_scope;
5767
+ this.enclosed = props.enclosed;
5768
+ this.cname = props.cname;
5769
+ this.body = props.body;
5770
+ this.block_scope = props.block_scope;
5771
+ this.start = props.start;
5772
+ this.end = props.end;
5773
+ }
5774
+
5775
+ this.flags = 0;
5776
+ }, {
4845
5777
  $documentation: "A class definition",
4846
5778
  }, AST_Class);
4847
5779
 
4848
- var AST_ClassExpression = DEFNODE("ClassExpression", null, {
5780
+ var AST_ClassExpression = DEFNODE("ClassExpression", null, function AST_ClassExpression(props) {
5781
+ if (props) {
5782
+ this.name = props.name;
5783
+ this.extends = props.extends;
5784
+ this.properties = props.properties;
5785
+ this.variables = props.variables;
5786
+ this.functions = props.functions;
5787
+ this.uses_with = props.uses_with;
5788
+ this.uses_eval = props.uses_eval;
5789
+ this.parent_scope = props.parent_scope;
5790
+ this.enclosed = props.enclosed;
5791
+ this.cname = props.cname;
5792
+ this.body = props.body;
5793
+ this.block_scope = props.block_scope;
5794
+ this.start = props.start;
5795
+ this.end = props.end;
5796
+ }
5797
+
5798
+ this.flags = 0;
5799
+ }, {
4849
5800
  $documentation: "A class expression."
4850
5801
  }, AST_Class);
4851
5802
 
4852
- var AST_Symbol = DEFNODE("Symbol", "scope name thedef", {
5803
+ var AST_Symbol = DEFNODE("Symbol", "scope name thedef", function AST_Symbol(props) {
5804
+ if (props) {
5805
+ this.scope = props.scope;
5806
+ this.name = props.name;
5807
+ this.thedef = props.thedef;
5808
+ this.start = props.start;
5809
+ this.end = props.end;
5810
+ }
5811
+
5812
+ this.flags = 0;
5813
+ }, {
4853
5814
  $propdoc: {
4854
5815
  name: "[string] name of this symbol",
4855
5816
  scope: "[AST_Scope/S] the current scope (not necessarily the definition scope)",
@@ -4858,71 +5819,258 @@ var AST_Symbol = DEFNODE("Symbol", "scope name thedef", {
4858
5819
  $documentation: "Base class for all symbols"
4859
5820
  });
4860
5821
 
4861
- var AST_NewTarget = DEFNODE("NewTarget", null, {
5822
+ var AST_NewTarget = DEFNODE("NewTarget", null, function AST_NewTarget(props) {
5823
+ if (props) {
5824
+ this.start = props.start;
5825
+ this.end = props.end;
5826
+ }
5827
+
5828
+ this.flags = 0;
5829
+ }, {
4862
5830
  $documentation: "A reference to new.target"
4863
5831
  });
4864
5832
 
4865
- var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", {
5833
+ var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", function AST_SymbolDeclaration(props) {
5834
+ if (props) {
5835
+ this.init = props.init;
5836
+ this.scope = props.scope;
5837
+ this.name = props.name;
5838
+ this.thedef = props.thedef;
5839
+ this.start = props.start;
5840
+ this.end = props.end;
5841
+ }
5842
+
5843
+ this.flags = 0;
5844
+ }, {
4866
5845
  $documentation: "A declaration symbol (symbol in var/const, function name or argument, symbol in catch)",
4867
5846
  }, AST_Symbol);
4868
5847
 
4869
- var AST_SymbolVar = DEFNODE("SymbolVar", null, {
5848
+ var AST_SymbolVar = DEFNODE("SymbolVar", null, function AST_SymbolVar(props) {
5849
+ if (props) {
5850
+ this.init = props.init;
5851
+ this.scope = props.scope;
5852
+ this.name = props.name;
5853
+ this.thedef = props.thedef;
5854
+ this.start = props.start;
5855
+ this.end = props.end;
5856
+ }
5857
+
5858
+ this.flags = 0;
5859
+ }, {
4870
5860
  $documentation: "Symbol defining a variable",
4871
5861
  }, AST_SymbolDeclaration);
4872
5862
 
4873
- var AST_SymbolBlockDeclaration = DEFNODE("SymbolBlockDeclaration", null, {
4874
- $documentation: "Base class for block-scoped declaration symbols"
4875
- }, AST_SymbolDeclaration);
5863
+ var AST_SymbolBlockDeclaration = DEFNODE(
5864
+ "SymbolBlockDeclaration",
5865
+ null,
5866
+ function AST_SymbolBlockDeclaration(props) {
5867
+ if (props) {
5868
+ this.init = props.init;
5869
+ this.scope = props.scope;
5870
+ this.name = props.name;
5871
+ this.thedef = props.thedef;
5872
+ this.start = props.start;
5873
+ this.end = props.end;
5874
+ }
4876
5875
 
4877
- var AST_SymbolConst = DEFNODE("SymbolConst", null, {
5876
+ this.flags = 0;
5877
+ },
5878
+ {
5879
+ $documentation: "Base class for block-scoped declaration symbols"
5880
+ },
5881
+ AST_SymbolDeclaration
5882
+ );
5883
+
5884
+ var AST_SymbolConst = DEFNODE("SymbolConst", null, function AST_SymbolConst(props) {
5885
+ if (props) {
5886
+ this.init = props.init;
5887
+ this.scope = props.scope;
5888
+ this.name = props.name;
5889
+ this.thedef = props.thedef;
5890
+ this.start = props.start;
5891
+ this.end = props.end;
5892
+ }
5893
+
5894
+ this.flags = 0;
5895
+ }, {
4878
5896
  $documentation: "A constant declaration"
4879
5897
  }, AST_SymbolBlockDeclaration);
4880
5898
 
4881
- var AST_SymbolLet = DEFNODE("SymbolLet", null, {
5899
+ var AST_SymbolLet = DEFNODE("SymbolLet", null, function AST_SymbolLet(props) {
5900
+ if (props) {
5901
+ this.init = props.init;
5902
+ this.scope = props.scope;
5903
+ this.name = props.name;
5904
+ this.thedef = props.thedef;
5905
+ this.start = props.start;
5906
+ this.end = props.end;
5907
+ }
5908
+
5909
+ this.flags = 0;
5910
+ }, {
4882
5911
  $documentation: "A block-scoped `let` declaration"
4883
5912
  }, AST_SymbolBlockDeclaration);
4884
5913
 
4885
- var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, {
5914
+ var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, function AST_SymbolFunarg(props) {
5915
+ if (props) {
5916
+ this.init = props.init;
5917
+ this.scope = props.scope;
5918
+ this.name = props.name;
5919
+ this.thedef = props.thedef;
5920
+ this.start = props.start;
5921
+ this.end = props.end;
5922
+ }
5923
+
5924
+ this.flags = 0;
5925
+ }, {
4886
5926
  $documentation: "Symbol naming a function argument",
4887
5927
  }, AST_SymbolVar);
4888
5928
 
4889
- var AST_SymbolDefun = DEFNODE("SymbolDefun", null, {
5929
+ var AST_SymbolDefun = DEFNODE("SymbolDefun", null, function AST_SymbolDefun(props) {
5930
+ if (props) {
5931
+ this.init = props.init;
5932
+ this.scope = props.scope;
5933
+ this.name = props.name;
5934
+ this.thedef = props.thedef;
5935
+ this.start = props.start;
5936
+ this.end = props.end;
5937
+ }
5938
+
5939
+ this.flags = 0;
5940
+ }, {
4890
5941
  $documentation: "Symbol defining a function",
4891
5942
  }, AST_SymbolDeclaration);
4892
5943
 
4893
- var AST_SymbolMethod = DEFNODE("SymbolMethod", null, {
5944
+ var AST_SymbolMethod = DEFNODE("SymbolMethod", null, function AST_SymbolMethod(props) {
5945
+ if (props) {
5946
+ this.scope = props.scope;
5947
+ this.name = props.name;
5948
+ this.thedef = props.thedef;
5949
+ this.start = props.start;
5950
+ this.end = props.end;
5951
+ }
5952
+
5953
+ this.flags = 0;
5954
+ }, {
4894
5955
  $documentation: "Symbol in an object defining a method",
4895
5956
  }, AST_Symbol);
4896
5957
 
4897
- var AST_SymbolClassProperty = DEFNODE("SymbolClassProperty", null, {
5958
+ var AST_SymbolClassProperty = DEFNODE("SymbolClassProperty", null, function AST_SymbolClassProperty(props) {
5959
+ if (props) {
5960
+ this.scope = props.scope;
5961
+ this.name = props.name;
5962
+ this.thedef = props.thedef;
5963
+ this.start = props.start;
5964
+ this.end = props.end;
5965
+ }
5966
+
5967
+ this.flags = 0;
5968
+ }, {
4898
5969
  $documentation: "Symbol for a class property",
4899
5970
  }, AST_Symbol);
4900
5971
 
4901
- var AST_SymbolLambda = DEFNODE("SymbolLambda", null, {
5972
+ var AST_SymbolLambda = DEFNODE("SymbolLambda", null, function AST_SymbolLambda(props) {
5973
+ if (props) {
5974
+ this.init = props.init;
5975
+ this.scope = props.scope;
5976
+ this.name = props.name;
5977
+ this.thedef = props.thedef;
5978
+ this.start = props.start;
5979
+ this.end = props.end;
5980
+ }
5981
+
5982
+ this.flags = 0;
5983
+ }, {
4902
5984
  $documentation: "Symbol naming a function expression",
4903
5985
  }, AST_SymbolDeclaration);
4904
5986
 
4905
- var AST_SymbolDefClass = DEFNODE("SymbolDefClass", null, {
5987
+ var AST_SymbolDefClass = DEFNODE("SymbolDefClass", null, function AST_SymbolDefClass(props) {
5988
+ if (props) {
5989
+ this.init = props.init;
5990
+ this.scope = props.scope;
5991
+ this.name = props.name;
5992
+ this.thedef = props.thedef;
5993
+ this.start = props.start;
5994
+ this.end = props.end;
5995
+ }
5996
+
5997
+ this.flags = 0;
5998
+ }, {
4906
5999
  $documentation: "Symbol naming a class's name in a class declaration. Lexically scoped to its containing scope, and accessible within the class."
4907
6000
  }, AST_SymbolBlockDeclaration);
4908
6001
 
4909
- var AST_SymbolClass = DEFNODE("SymbolClass", null, {
6002
+ var AST_SymbolClass = DEFNODE("SymbolClass", null, function AST_SymbolClass(props) {
6003
+ if (props) {
6004
+ this.init = props.init;
6005
+ this.scope = props.scope;
6006
+ this.name = props.name;
6007
+ this.thedef = props.thedef;
6008
+ this.start = props.start;
6009
+ this.end = props.end;
6010
+ }
6011
+
6012
+ this.flags = 0;
6013
+ }, {
4910
6014
  $documentation: "Symbol naming a class's name. Lexically scoped to the class."
4911
6015
  }, AST_SymbolDeclaration);
4912
6016
 
4913
- var AST_SymbolCatch = DEFNODE("SymbolCatch", null, {
6017
+ var AST_SymbolCatch = DEFNODE("SymbolCatch", null, function AST_SymbolCatch(props) {
6018
+ if (props) {
6019
+ this.init = props.init;
6020
+ this.scope = props.scope;
6021
+ this.name = props.name;
6022
+ this.thedef = props.thedef;
6023
+ this.start = props.start;
6024
+ this.end = props.end;
6025
+ }
6026
+
6027
+ this.flags = 0;
6028
+ }, {
4914
6029
  $documentation: "Symbol naming the exception in catch",
4915
6030
  }, AST_SymbolBlockDeclaration);
4916
6031
 
4917
- var AST_SymbolImport = DEFNODE("SymbolImport", null, {
6032
+ var AST_SymbolImport = DEFNODE("SymbolImport", null, function AST_SymbolImport(props) {
6033
+ if (props) {
6034
+ this.init = props.init;
6035
+ this.scope = props.scope;
6036
+ this.name = props.name;
6037
+ this.thedef = props.thedef;
6038
+ this.start = props.start;
6039
+ this.end = props.end;
6040
+ }
6041
+
6042
+ this.flags = 0;
6043
+ }, {
4918
6044
  $documentation: "Symbol referring to an imported name",
4919
6045
  }, AST_SymbolBlockDeclaration);
4920
6046
 
4921
- var AST_SymbolImportForeign = DEFNODE("SymbolImportForeign", null, {
6047
+ var AST_SymbolImportForeign = DEFNODE("SymbolImportForeign", null, function AST_SymbolImportForeign(props) {
6048
+ if (props) {
6049
+ this.scope = props.scope;
6050
+ this.name = props.name;
6051
+ this.thedef = props.thedef;
6052
+ this.start = props.start;
6053
+ this.end = props.end;
6054
+ }
6055
+
6056
+ this.flags = 0;
6057
+ }, {
4922
6058
  $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",
4923
6059
  }, AST_Symbol);
4924
6060
 
4925
- var AST_Label = DEFNODE("Label", "references", {
6061
+ var AST_Label = DEFNODE("Label", "references", function AST_Label(props) {
6062
+ if (props) {
6063
+ this.references = props.references;
6064
+ this.scope = props.scope;
6065
+ this.name = props.name;
6066
+ this.thedef = props.thedef;
6067
+ this.start = props.start;
6068
+ this.end = props.end;
6069
+ this.initialize();
6070
+ }
6071
+
6072
+ this.flags = 0;
6073
+ }, {
4926
6074
  $documentation: "Symbol naming a label (declaration)",
4927
6075
  $propdoc: {
4928
6076
  references: "[AST_LoopControl*] a list of nodes referring to this label"
@@ -4933,38 +6081,114 @@ var AST_Label = DEFNODE("Label", "references", {
4933
6081
  }
4934
6082
  }, AST_Symbol);
4935
6083
 
4936
- var AST_SymbolRef = DEFNODE("SymbolRef", null, {
6084
+ var AST_SymbolRef = DEFNODE("SymbolRef", null, function AST_SymbolRef(props) {
6085
+ if (props) {
6086
+ this.scope = props.scope;
6087
+ this.name = props.name;
6088
+ this.thedef = props.thedef;
6089
+ this.start = props.start;
6090
+ this.end = props.end;
6091
+ }
6092
+
6093
+ this.flags = 0;
6094
+ }, {
4937
6095
  $documentation: "Reference to some symbol (not definition/declaration)",
4938
6096
  }, AST_Symbol);
4939
6097
 
4940
- var AST_SymbolExport = DEFNODE("SymbolExport", null, {
6098
+ var AST_SymbolExport = DEFNODE("SymbolExport", null, function AST_SymbolExport(props) {
6099
+ if (props) {
6100
+ this.scope = props.scope;
6101
+ this.name = props.name;
6102
+ this.thedef = props.thedef;
6103
+ this.start = props.start;
6104
+ this.end = props.end;
6105
+ }
6106
+
6107
+ this.flags = 0;
6108
+ }, {
4941
6109
  $documentation: "Symbol referring to a name to export",
4942
6110
  }, AST_SymbolRef);
4943
6111
 
4944
- var AST_SymbolExportForeign = DEFNODE("SymbolExportForeign", null, {
6112
+ var AST_SymbolExportForeign = DEFNODE("SymbolExportForeign", null, function AST_SymbolExportForeign(props) {
6113
+ if (props) {
6114
+ this.scope = props.scope;
6115
+ this.name = props.name;
6116
+ this.thedef = props.thedef;
6117
+ this.start = props.start;
6118
+ this.end = props.end;
6119
+ }
6120
+
6121
+ this.flags = 0;
6122
+ }, {
4945
6123
  $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",
4946
6124
  }, AST_Symbol);
4947
6125
 
4948
- var AST_LabelRef = DEFNODE("LabelRef", null, {
6126
+ var AST_LabelRef = DEFNODE("LabelRef", null, function AST_LabelRef(props) {
6127
+ if (props) {
6128
+ this.scope = props.scope;
6129
+ this.name = props.name;
6130
+ this.thedef = props.thedef;
6131
+ this.start = props.start;
6132
+ this.end = props.end;
6133
+ }
6134
+
6135
+ this.flags = 0;
6136
+ }, {
4949
6137
  $documentation: "Reference to a label symbol",
4950
6138
  }, AST_Symbol);
4951
6139
 
4952
- var AST_This = DEFNODE("This", null, {
6140
+ var AST_This = DEFNODE("This", null, function AST_This(props) {
6141
+ if (props) {
6142
+ this.scope = props.scope;
6143
+ this.name = props.name;
6144
+ this.thedef = props.thedef;
6145
+ this.start = props.start;
6146
+ this.end = props.end;
6147
+ }
6148
+
6149
+ this.flags = 0;
6150
+ }, {
4953
6151
  $documentation: "The `this` symbol",
4954
6152
  }, AST_Symbol);
4955
6153
 
4956
- var AST_Super = DEFNODE("Super", null, {
6154
+ var AST_Super = DEFNODE("Super", null, function AST_Super(props) {
6155
+ if (props) {
6156
+ this.scope = props.scope;
6157
+ this.name = props.name;
6158
+ this.thedef = props.thedef;
6159
+ this.start = props.start;
6160
+ this.end = props.end;
6161
+ }
6162
+
6163
+ this.flags = 0;
6164
+ }, {
4957
6165
  $documentation: "The `super` symbol",
4958
6166
  }, AST_This);
4959
6167
 
4960
- var AST_Constant = DEFNODE("Constant", null, {
6168
+ var AST_Constant = DEFNODE("Constant", null, function AST_Constant(props) {
6169
+ if (props) {
6170
+ this.start = props.start;
6171
+ this.end = props.end;
6172
+ }
6173
+
6174
+ this.flags = 0;
6175
+ }, {
4961
6176
  $documentation: "Base class for all constants",
4962
6177
  getValue: function() {
4963
6178
  return this.value;
4964
6179
  }
4965
6180
  });
4966
6181
 
4967
- var AST_String = DEFNODE("String", "value quote", {
6182
+ var AST_String = DEFNODE("String", "value quote", function AST_String(props) {
6183
+ if (props) {
6184
+ this.value = props.value;
6185
+ this.quote = props.quote;
6186
+ this.start = props.start;
6187
+ this.end = props.end;
6188
+ }
6189
+
6190
+ this.flags = 0;
6191
+ }, {
4968
6192
  $documentation: "A string literal",
4969
6193
  $propdoc: {
4970
6194
  value: "[string] the contents of this string",
@@ -4972,7 +6196,16 @@ var AST_String = DEFNODE("String", "value quote", {
4972
6196
  }
4973
6197
  }, AST_Constant);
4974
6198
 
4975
- var AST_Number = DEFNODE("Number", "value raw", {
6199
+ var AST_Number = DEFNODE("Number", "value raw", function AST_Number(props) {
6200
+ if (props) {
6201
+ this.value = props.value;
6202
+ this.raw = props.raw;
6203
+ this.start = props.start;
6204
+ this.end = props.end;
6205
+ }
6206
+
6207
+ this.flags = 0;
6208
+ }, {
4976
6209
  $documentation: "A number literal",
4977
6210
  $propdoc: {
4978
6211
  value: "[number] the numeric value",
@@ -4980,59 +6213,138 @@ var AST_Number = DEFNODE("Number", "value raw", {
4980
6213
  }
4981
6214
  }, AST_Constant);
4982
6215
 
4983
- var AST_BigInt = DEFNODE("BigInt", "value", {
6216
+ var AST_BigInt = DEFNODE("BigInt", "value", function AST_BigInt(props) {
6217
+ if (props) {
6218
+ this.value = props.value;
6219
+ this.start = props.start;
6220
+ this.end = props.end;
6221
+ }
6222
+
6223
+ this.flags = 0;
6224
+ }, {
4984
6225
  $documentation: "A big int literal",
4985
6226
  $propdoc: {
4986
6227
  value: "[string] big int value"
4987
6228
  }
4988
6229
  }, AST_Constant);
4989
6230
 
4990
- var AST_RegExp = DEFNODE("RegExp", "value", {
6231
+ var AST_RegExp = DEFNODE("RegExp", "value", function AST_RegExp(props) {
6232
+ if (props) {
6233
+ this.value = props.value;
6234
+ this.start = props.start;
6235
+ this.end = props.end;
6236
+ }
6237
+
6238
+ this.flags = 0;
6239
+ }, {
4991
6240
  $documentation: "A regexp literal",
4992
6241
  $propdoc: {
4993
6242
  value: "[RegExp] the actual regexp",
4994
6243
  }
4995
6244
  }, AST_Constant);
4996
6245
 
4997
- var AST_Atom = DEFNODE("Atom", null, {
6246
+ var AST_Atom = DEFNODE("Atom", null, function AST_Atom(props) {
6247
+ if (props) {
6248
+ this.start = props.start;
6249
+ this.end = props.end;
6250
+ }
6251
+
6252
+ this.flags = 0;
6253
+ }, {
4998
6254
  $documentation: "Base class for atoms",
4999
6255
  }, AST_Constant);
5000
6256
 
5001
- var AST_Null = DEFNODE("Null", null, {
6257
+ var AST_Null = DEFNODE("Null", null, function AST_Null(props) {
6258
+ if (props) {
6259
+ this.start = props.start;
6260
+ this.end = props.end;
6261
+ }
6262
+
6263
+ this.flags = 0;
6264
+ }, {
5002
6265
  $documentation: "The `null` atom",
5003
6266
  value: null
5004
6267
  }, AST_Atom);
5005
6268
 
5006
- var AST_NaN = DEFNODE("NaN", null, {
6269
+ var AST_NaN = DEFNODE("NaN", null, function AST_NaN(props) {
6270
+ if (props) {
6271
+ this.start = props.start;
6272
+ this.end = props.end;
6273
+ }
6274
+
6275
+ this.flags = 0;
6276
+ }, {
5007
6277
  $documentation: "The impossible value",
5008
6278
  value: 0/0
5009
6279
  }, AST_Atom);
5010
6280
 
5011
- var AST_Undefined = DEFNODE("Undefined", null, {
6281
+ var AST_Undefined = DEFNODE("Undefined", null, function AST_Undefined(props) {
6282
+ if (props) {
6283
+ this.start = props.start;
6284
+ this.end = props.end;
6285
+ }
6286
+
6287
+ this.flags = 0;
6288
+ }, {
5012
6289
  $documentation: "The `undefined` value",
5013
6290
  value: (function() {}())
5014
6291
  }, AST_Atom);
5015
6292
 
5016
- var AST_Hole = DEFNODE("Hole", null, {
6293
+ var AST_Hole = DEFNODE("Hole", null, function AST_Hole(props) {
6294
+ if (props) {
6295
+ this.start = props.start;
6296
+ this.end = props.end;
6297
+ }
6298
+
6299
+ this.flags = 0;
6300
+ }, {
5017
6301
  $documentation: "A hole in an array",
5018
6302
  value: (function() {}())
5019
6303
  }, AST_Atom);
5020
6304
 
5021
- var AST_Infinity = DEFNODE("Infinity", null, {
6305
+ var AST_Infinity = DEFNODE("Infinity", null, function AST_Infinity(props) {
6306
+ if (props) {
6307
+ this.start = props.start;
6308
+ this.end = props.end;
6309
+ }
6310
+
6311
+ this.flags = 0;
6312
+ }, {
5022
6313
  $documentation: "The `Infinity` value",
5023
6314
  value: 1/0
5024
6315
  }, AST_Atom);
5025
6316
 
5026
- var AST_Boolean = DEFNODE("Boolean", null, {
6317
+ var AST_Boolean = DEFNODE("Boolean", null, function AST_Boolean(props) {
6318
+ if (props) {
6319
+ this.start = props.start;
6320
+ this.end = props.end;
6321
+ }
6322
+
6323
+ this.flags = 0;
6324
+ }, {
5027
6325
  $documentation: "Base class for booleans",
5028
6326
  }, AST_Atom);
5029
6327
 
5030
- var AST_False = DEFNODE("False", null, {
6328
+ var AST_False = DEFNODE("False", null, function AST_False(props) {
6329
+ if (props) {
6330
+ this.start = props.start;
6331
+ this.end = props.end;
6332
+ }
6333
+
6334
+ this.flags = 0;
6335
+ }, {
5031
6336
  $documentation: "The `false` atom",
5032
6337
  value: false
5033
6338
  }, AST_Boolean);
5034
6339
 
5035
- var AST_True = DEFNODE("True", null, {
6340
+ var AST_True = DEFNODE("True", null, function AST_True(props) {
6341
+ if (props) {
6342
+ this.start = props.start;
6343
+ this.end = props.end;
6344
+ }
6345
+
6346
+ this.flags = 0;
6347
+ }, {
5036
6348
  $documentation: "The `true` atom",
5037
6349
  value: true
5038
6350
  }, AST_Boolean);
@@ -5221,144 +6533,6 @@ const _PURE = 0b00000001;
5221
6533
  const _INLINE = 0b00000010;
5222
6534
  const _NOINLINE = 0b00000100;
5223
6535
 
5224
- var ast = /*#__PURE__*/Object.freeze({
5225
- __proto__: null,
5226
- AST_Accessor: AST_Accessor,
5227
- AST_Array: AST_Array,
5228
- AST_Arrow: AST_Arrow,
5229
- AST_Assign: AST_Assign,
5230
- AST_Atom: AST_Atom,
5231
- AST_Await: AST_Await,
5232
- AST_BigInt: AST_BigInt,
5233
- AST_Binary: AST_Binary,
5234
- AST_Block: AST_Block,
5235
- AST_BlockStatement: AST_BlockStatement,
5236
- AST_Boolean: AST_Boolean,
5237
- AST_Break: AST_Break,
5238
- AST_Call: AST_Call,
5239
- AST_Case: AST_Case,
5240
- AST_Catch: AST_Catch,
5241
- AST_Chain: AST_Chain,
5242
- AST_Class: AST_Class,
5243
- AST_ClassExpression: AST_ClassExpression,
5244
- AST_ClassPrivateProperty: AST_ClassPrivateProperty,
5245
- AST_ClassProperty: AST_ClassProperty,
5246
- AST_ConciseMethod: AST_ConciseMethod,
5247
- AST_Conditional: AST_Conditional,
5248
- AST_Const: AST_Const,
5249
- AST_Constant: AST_Constant,
5250
- AST_Continue: AST_Continue,
5251
- AST_Debugger: AST_Debugger,
5252
- AST_Default: AST_Default,
5253
- AST_DefaultAssign: AST_DefaultAssign,
5254
- AST_DefClass: AST_DefClass,
5255
- AST_Definitions: AST_Definitions,
5256
- AST_Defun: AST_Defun,
5257
- AST_Destructuring: AST_Destructuring,
5258
- AST_Directive: AST_Directive,
5259
- AST_Do: AST_Do,
5260
- AST_Dot: AST_Dot,
5261
- AST_DotHash: AST_DotHash,
5262
- AST_DWLoop: AST_DWLoop,
5263
- AST_EmptyStatement: AST_EmptyStatement,
5264
- AST_Exit: AST_Exit,
5265
- AST_Expansion: AST_Expansion,
5266
- AST_Export: AST_Export,
5267
- AST_False: AST_False,
5268
- AST_Finally: AST_Finally,
5269
- AST_For: AST_For,
5270
- AST_ForIn: AST_ForIn,
5271
- AST_ForOf: AST_ForOf,
5272
- AST_Function: AST_Function,
5273
- AST_Hole: AST_Hole,
5274
- AST_If: AST_If,
5275
- AST_Import: AST_Import,
5276
- AST_ImportMeta: AST_ImportMeta,
5277
- AST_Infinity: AST_Infinity,
5278
- AST_IterationStatement: AST_IterationStatement,
5279
- AST_Jump: AST_Jump,
5280
- AST_Label: AST_Label,
5281
- AST_LabeledStatement: AST_LabeledStatement,
5282
- AST_LabelRef: AST_LabelRef,
5283
- AST_Lambda: AST_Lambda,
5284
- AST_Let: AST_Let,
5285
- AST_LoopControl: AST_LoopControl,
5286
- AST_NameMapping: AST_NameMapping,
5287
- AST_NaN: AST_NaN,
5288
- AST_New: AST_New,
5289
- AST_NewTarget: AST_NewTarget,
5290
- AST_Node: AST_Node,
5291
- AST_Null: AST_Null,
5292
- AST_Number: AST_Number,
5293
- AST_Object: AST_Object,
5294
- AST_ObjectGetter: AST_ObjectGetter,
5295
- AST_ObjectKeyVal: AST_ObjectKeyVal,
5296
- AST_ObjectProperty: AST_ObjectProperty,
5297
- AST_ObjectSetter: AST_ObjectSetter,
5298
- AST_PrefixedTemplateString: AST_PrefixedTemplateString,
5299
- AST_PrivateGetter: AST_PrivateGetter,
5300
- AST_PrivateMethod: AST_PrivateMethod,
5301
- AST_PrivateSetter: AST_PrivateSetter,
5302
- AST_PropAccess: AST_PropAccess,
5303
- AST_RegExp: AST_RegExp,
5304
- AST_Return: AST_Return,
5305
- AST_Scope: AST_Scope,
5306
- AST_Sequence: AST_Sequence,
5307
- AST_SimpleStatement: AST_SimpleStatement,
5308
- AST_Statement: AST_Statement,
5309
- AST_StatementWithBody: AST_StatementWithBody,
5310
- AST_String: AST_String,
5311
- AST_Sub: AST_Sub,
5312
- AST_Super: AST_Super,
5313
- AST_Switch: AST_Switch,
5314
- AST_SwitchBranch: AST_SwitchBranch,
5315
- AST_Symbol: AST_Symbol,
5316
- AST_SymbolBlockDeclaration: AST_SymbolBlockDeclaration,
5317
- AST_SymbolCatch: AST_SymbolCatch,
5318
- AST_SymbolClass: AST_SymbolClass,
5319
- AST_SymbolClassProperty: AST_SymbolClassProperty,
5320
- AST_SymbolConst: AST_SymbolConst,
5321
- AST_SymbolDeclaration: AST_SymbolDeclaration,
5322
- AST_SymbolDefClass: AST_SymbolDefClass,
5323
- AST_SymbolDefun: AST_SymbolDefun,
5324
- AST_SymbolExport: AST_SymbolExport,
5325
- AST_SymbolExportForeign: AST_SymbolExportForeign,
5326
- AST_SymbolFunarg: AST_SymbolFunarg,
5327
- AST_SymbolImport: AST_SymbolImport,
5328
- AST_SymbolImportForeign: AST_SymbolImportForeign,
5329
- AST_SymbolLambda: AST_SymbolLambda,
5330
- AST_SymbolLet: AST_SymbolLet,
5331
- AST_SymbolMethod: AST_SymbolMethod,
5332
- AST_SymbolRef: AST_SymbolRef,
5333
- AST_SymbolVar: AST_SymbolVar,
5334
- AST_TemplateSegment: AST_TemplateSegment,
5335
- AST_TemplateString: AST_TemplateString,
5336
- AST_This: AST_This,
5337
- AST_Throw: AST_Throw,
5338
- AST_Token: AST_Token,
5339
- AST_Toplevel: AST_Toplevel,
5340
- AST_True: AST_True,
5341
- AST_Try: AST_Try,
5342
- AST_Unary: AST_Unary,
5343
- AST_UnaryPostfix: AST_UnaryPostfix,
5344
- AST_UnaryPrefix: AST_UnaryPrefix,
5345
- AST_Undefined: AST_Undefined,
5346
- AST_Var: AST_Var,
5347
- AST_VarDef: AST_VarDef,
5348
- AST_While: AST_While,
5349
- AST_With: AST_With,
5350
- AST_Yield: AST_Yield,
5351
- TreeTransformer: TreeTransformer,
5352
- TreeWalker: TreeWalker,
5353
- walk: walk,
5354
- walk_abort: walk_abort,
5355
- walk_body: walk_body,
5356
- walk_parent: walk_parent,
5357
- _INLINE: _INLINE,
5358
- _NOINLINE: _NOINLINE,
5359
- _PURE: _PURE
5360
- });
5361
-
5362
6536
  /***********************************************************************
5363
6537
 
5364
6538
  A JavaScript tokenizer / parser / beautifier / compressor.
@@ -5716,6 +6890,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5716
6890
  body: normalize_directives(M.body.map(from_moz))
5717
6891
  });
5718
6892
  },
6893
+
5719
6894
  ArrayPattern: function(M) {
5720
6895
  return new AST_Destructuring({
5721
6896
  start: my_start_token(M),
@@ -5729,6 +6904,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5729
6904
  is_array: true
5730
6905
  });
5731
6906
  },
6907
+
5732
6908
  ObjectPattern: function(M) {
5733
6909
  return new AST_Destructuring({
5734
6910
  start: my_start_token(M),
@@ -5737,6 +6913,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5737
6913
  is_array: false
5738
6914
  });
5739
6915
  },
6916
+
5740
6917
  AssignmentPattern: function(M) {
5741
6918
  return new AST_DefaultAssign({
5742
6919
  start: my_start_token(M),
@@ -5746,6 +6923,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5746
6923
  right: from_moz(M.right)
5747
6924
  });
5748
6925
  },
6926
+
5749
6927
  SpreadElement: function(M) {
5750
6928
  return new AST_Expansion({
5751
6929
  start: my_start_token(M),
@@ -5753,6 +6931,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5753
6931
  expression: from_moz(M.argument)
5754
6932
  });
5755
6933
  },
6934
+
5756
6935
  RestElement: function(M) {
5757
6936
  return new AST_Expansion({
5758
6937
  start: my_start_token(M),
@@ -5760,6 +6939,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5760
6939
  expression: from_moz(M.argument)
5761
6940
  });
5762
6941
  },
6942
+
5763
6943
  TemplateElement: function(M) {
5764
6944
  return new AST_TemplateSegment({
5765
6945
  start: my_start_token(M),
@@ -5768,6 +6948,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5768
6948
  raw: M.value.raw
5769
6949
  });
5770
6950
  },
6951
+
5771
6952
  TemplateLiteral: function(M) {
5772
6953
  var segments = [];
5773
6954
  for (var i = 0; i < M.quasis.length; i++) {
@@ -5782,6 +6963,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5782
6963
  segments: segments
5783
6964
  });
5784
6965
  },
6966
+
5785
6967
  TaggedTemplateExpression: function(M) {
5786
6968
  return new AST_PrefixedTemplateString({
5787
6969
  start: my_start_token(M),
@@ -5790,6 +6972,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5790
6972
  prefix: from_moz(M.tag)
5791
6973
  });
5792
6974
  },
6975
+
5793
6976
  FunctionDeclaration: function(M) {
5794
6977
  return new AST_Defun({
5795
6978
  start: my_start_token(M),
@@ -5801,6 +6984,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5801
6984
  body: normalize_directives(from_moz(M.body).body)
5802
6985
  });
5803
6986
  },
6987
+
5804
6988
  FunctionExpression: function(M) {
5805
6989
  return new AST_Function({
5806
6990
  start: my_start_token(M),
@@ -5812,6 +6996,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5812
6996
  body: normalize_directives(from_moz(M.body).body)
5813
6997
  });
5814
6998
  },
6999
+
5815
7000
  ArrowFunctionExpression: function(M) {
5816
7001
  const body = M.body.type === "BlockStatement"
5817
7002
  ? from_moz(M.body).body
@@ -5824,6 +7009,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5824
7009
  async: M.async,
5825
7010
  });
5826
7011
  },
7012
+
5827
7013
  ExpressionStatement: function(M) {
5828
7014
  return new AST_SimpleStatement({
5829
7015
  start: my_start_token(M),
@@ -5831,6 +7017,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5831
7017
  body: from_moz(M.expression)
5832
7018
  });
5833
7019
  },
7020
+
5834
7021
  TryStatement: function(M) {
5835
7022
  var handlers = M.handlers || [M.handler];
5836
7023
  if (handlers.length > 1 || M.guardedHandlers && M.guardedHandlers.length) {
@@ -5844,6 +7031,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5844
7031
  bfinally : M.finalizer ? new AST_Finally(from_moz(M.finalizer)) : null
5845
7032
  });
5846
7033
  },
7034
+
5847
7035
  Property: function(M) {
5848
7036
  var key = M.key;
5849
7037
  var args = {
@@ -5886,6 +7074,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5886
7074
  return new AST_ConciseMethod(args);
5887
7075
  }
5888
7076
  },
7077
+
5889
7078
  MethodDefinition: function(M) {
5890
7079
  var args = {
5891
7080
  start : my_start_token(M),
@@ -5904,6 +7093,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5904
7093
  args.async = M.value.async;
5905
7094
  return new AST_ConciseMethod(args);
5906
7095
  },
7096
+
5907
7097
  FieldDefinition: function(M) {
5908
7098
  let key;
5909
7099
  if (M.computed) {
@@ -5920,6 +7110,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5920
7110
  static : M.static,
5921
7111
  });
5922
7112
  },
7113
+
5923
7114
  PropertyDefinition: function(M) {
5924
7115
  let key;
5925
7116
  if (M.computed) {
@@ -5937,6 +7128,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5937
7128
  static : M.static,
5938
7129
  });
5939
7130
  },
7131
+
5940
7132
  ArrayExpression: function(M) {
5941
7133
  return new AST_Array({
5942
7134
  start : my_start_token(M),
@@ -5946,6 +7138,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5946
7138
  })
5947
7139
  });
5948
7140
  },
7141
+
5949
7142
  ObjectExpression: function(M) {
5950
7143
  return new AST_Object({
5951
7144
  start : my_start_token(M),
@@ -5959,6 +7152,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5959
7152
  })
5960
7153
  });
5961
7154
  },
7155
+
5962
7156
  SequenceExpression: function(M) {
5963
7157
  return new AST_Sequence({
5964
7158
  start : my_start_token(M),
@@ -5966,6 +7160,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5966
7160
  expressions: M.expressions.map(from_moz)
5967
7161
  });
5968
7162
  },
7163
+
5969
7164
  MemberExpression: function(M) {
5970
7165
  return new (M.computed ? AST_Sub : AST_Dot)({
5971
7166
  start : my_start_token(M),
@@ -5975,6 +7170,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5975
7170
  optional : M.optional || false
5976
7171
  });
5977
7172
  },
7173
+
5978
7174
  ChainExpression: function(M) {
5979
7175
  return new AST_Chain({
5980
7176
  start : my_start_token(M),
@@ -5982,6 +7178,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5982
7178
  expression : from_moz(M.expression)
5983
7179
  });
5984
7180
  },
7181
+
5985
7182
  SwitchCase: function(M) {
5986
7183
  return new (M.test ? AST_Case : AST_Default)({
5987
7184
  start : my_start_token(M),
@@ -5990,6 +7187,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
5990
7187
  body : M.consequent.map(from_moz)
5991
7188
  });
5992
7189
  },
7190
+
5993
7191
  VariableDeclaration: function(M) {
5994
7192
  return new (M.kind === "const" ? AST_Const :
5995
7193
  M.kind === "let" ? AST_Let : AST_Var)({
@@ -6032,6 +7230,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
6032
7230
  assert_clause: assert_clause_from_moz(M.assertions)
6033
7231
  });
6034
7232
  },
7233
+
6035
7234
  ExportAllDeclaration: function(M) {
6036
7235
  return new AST_Export({
6037
7236
  start: my_start_token(M),
@@ -6046,6 +7245,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
6046
7245
  assert_clause: assert_clause_from_moz(M.assertions)
6047
7246
  });
6048
7247
  },
7248
+
6049
7249
  ExportNamedDeclaration: function(M) {
6050
7250
  return new AST_Export({
6051
7251
  start: my_start_token(M),
@@ -6061,6 +7261,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
6061
7261
  assert_clause: assert_clause_from_moz(M.assertions)
6062
7262
  });
6063
7263
  },
7264
+
6064
7265
  ExportDefaultDeclaration: function(M) {
6065
7266
  return new AST_Export({
6066
7267
  start: my_start_token(M),
@@ -6069,6 +7270,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
6069
7270
  is_default: true
6070
7271
  });
6071
7272
  },
7273
+
6072
7274
  Literal: function(M) {
6073
7275
  var val = M.value, args = {
6074
7276
  start : my_start_token(M),
@@ -6104,46 +7306,298 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
6104
7306
  return new (val ? AST_True : AST_False)(args);
6105
7307
  }
6106
7308
  },
6107
- MetaProperty: function(M) {
6108
- if (M.meta.name === "new" && M.property.name === "target") {
6109
- return new AST_NewTarget({
6110
- start: my_start_token(M),
6111
- end: my_end_token(M)
6112
- });
6113
- } else if (M.meta.name === "import" && M.property.name === "meta") {
6114
- return new AST_ImportMeta({
6115
- start: my_start_token(M),
6116
- end: my_end_token(M)
6117
- });
6118
- }
7309
+
7310
+ MetaProperty: function(M) {
7311
+ if (M.meta.name === "new" && M.property.name === "target") {
7312
+ return new AST_NewTarget({
7313
+ start: my_start_token(M),
7314
+ end: my_end_token(M)
7315
+ });
7316
+ } else if (M.meta.name === "import" && M.property.name === "meta") {
7317
+ return new AST_ImportMeta({
7318
+ start: my_start_token(M),
7319
+ end: my_end_token(M)
7320
+ });
7321
+ }
7322
+ },
7323
+
7324
+ Identifier: function(M) {
7325
+ var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2];
7326
+ return new ( p.type == "LabeledStatement" ? AST_Label
7327
+ : p.type == "VariableDeclarator" && p.id === M ? (p.kind == "const" ? AST_SymbolConst : p.kind == "let" ? AST_SymbolLet : AST_SymbolVar)
7328
+ : /Import.*Specifier/.test(p.type) ? (p.local === M ? AST_SymbolImport : AST_SymbolImportForeign)
7329
+ : p.type == "ExportSpecifier" ? (p.local === M ? AST_SymbolExport : AST_SymbolExportForeign)
7330
+ : p.type == "FunctionExpression" ? (p.id === M ? AST_SymbolLambda : AST_SymbolFunarg)
7331
+ : p.type == "FunctionDeclaration" ? (p.id === M ? AST_SymbolDefun : AST_SymbolFunarg)
7332
+ : p.type == "ArrowFunctionExpression" ? (p.params.includes(M)) ? AST_SymbolFunarg : AST_SymbolRef
7333
+ : p.type == "ClassExpression" ? (p.id === M ? AST_SymbolClass : AST_SymbolRef)
7334
+ : p.type == "Property" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolMethod)
7335
+ : p.type == "PropertyDefinition" || p.type === "FieldDefinition" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolClassProperty)
7336
+ : p.type == "ClassDeclaration" ? (p.id === M ? AST_SymbolDefClass : AST_SymbolRef)
7337
+ : p.type == "MethodDefinition" ? (p.computed ? AST_SymbolRef : AST_SymbolMethod)
7338
+ : p.type == "CatchClause" ? AST_SymbolCatch
7339
+ : p.type == "BreakStatement" || p.type == "ContinueStatement" ? AST_LabelRef
7340
+ : AST_SymbolRef)({
7341
+ start : my_start_token(M),
7342
+ end : my_end_token(M),
7343
+ name : M.name
7344
+ });
7345
+ },
7346
+
7347
+ BigIntLiteral(M) {
7348
+ return new AST_BigInt({
7349
+ start : my_start_token(M),
7350
+ end : my_end_token(M),
7351
+ value : M.value
7352
+ });
7353
+ },
7354
+
7355
+ EmptyStatement: function(M) {
7356
+ return new AST_EmptyStatement({
7357
+ start: my_start_token(M),
7358
+ end: my_end_token(M)
7359
+ });
7360
+ },
7361
+
7362
+ BlockStatement: function(M) {
7363
+ return new AST_BlockStatement({
7364
+ start: my_start_token(M),
7365
+ end: my_end_token(M),
7366
+ body: M.body.map(from_moz)
7367
+ });
7368
+ },
7369
+
7370
+ IfStatement: function(M) {
7371
+ return new AST_If({
7372
+ start: my_start_token(M),
7373
+ end: my_end_token(M),
7374
+ condition: from_moz(M.test),
7375
+ body: from_moz(M.consequent),
7376
+ alternative: from_moz(M.alternate)
7377
+ });
7378
+ },
7379
+
7380
+ LabeledStatement: function(M) {
7381
+ return new AST_LabeledStatement({
7382
+ start: my_start_token(M),
7383
+ end: my_end_token(M),
7384
+ label: from_moz(M.label),
7385
+ body: from_moz(M.body)
7386
+ });
7387
+ },
7388
+
7389
+ BreakStatement: function(M) {
7390
+ return new AST_Break({
7391
+ start: my_start_token(M),
7392
+ end: my_end_token(M),
7393
+ label: from_moz(M.label)
7394
+ });
7395
+ },
7396
+
7397
+ ContinueStatement: function(M) {
7398
+ return new AST_Continue({
7399
+ start: my_start_token(M),
7400
+ end: my_end_token(M),
7401
+ label: from_moz(M.label)
7402
+ });
7403
+ },
7404
+
7405
+ WithStatement: function(M) {
7406
+ return new AST_With({
7407
+ start: my_start_token(M),
7408
+ end: my_end_token(M),
7409
+ expression: from_moz(M.object),
7410
+ body: from_moz(M.body)
7411
+ });
7412
+ },
7413
+
7414
+ SwitchStatement: function(M) {
7415
+ return new AST_Switch({
7416
+ start: my_start_token(M),
7417
+ end: my_end_token(M),
7418
+ expression: from_moz(M.discriminant),
7419
+ body: M.cases.map(from_moz)
7420
+ });
7421
+ },
7422
+
7423
+ ReturnStatement: function(M) {
7424
+ return new AST_Return({
7425
+ start: my_start_token(M),
7426
+ end: my_end_token(M),
7427
+ value: from_moz(M.argument)
7428
+ });
7429
+ },
7430
+
7431
+ ThrowStatement: function(M) {
7432
+ return new AST_Throw({
7433
+ start: my_start_token(M),
7434
+ end: my_end_token(M),
7435
+ value: from_moz(M.argument)
7436
+ });
7437
+ },
7438
+
7439
+ WhileStatement: function(M) {
7440
+ return new AST_While({
7441
+ start: my_start_token(M),
7442
+ end: my_end_token(M),
7443
+ condition: from_moz(M.test),
7444
+ body: from_moz(M.body)
7445
+ });
7446
+ },
7447
+
7448
+ DoWhileStatement: function(M) {
7449
+ return new AST_Do({
7450
+ start: my_start_token(M),
7451
+ end: my_end_token(M),
7452
+ condition: from_moz(M.test),
7453
+ body: from_moz(M.body)
7454
+ });
7455
+ },
7456
+
7457
+ ForStatement: function(M) {
7458
+ return new AST_For({
7459
+ start: my_start_token(M),
7460
+ end: my_end_token(M),
7461
+ init: from_moz(M.init),
7462
+ condition: from_moz(M.test),
7463
+ step: from_moz(M.update),
7464
+ body: from_moz(M.body)
7465
+ });
7466
+ },
7467
+
7468
+ ForInStatement: function(M) {
7469
+ return new AST_ForIn({
7470
+ start: my_start_token(M),
7471
+ end: my_end_token(M),
7472
+ init: from_moz(M.left),
7473
+ object: from_moz(M.right),
7474
+ body: from_moz(M.body)
7475
+ });
7476
+ },
7477
+
7478
+ ForOfStatement: function(M) {
7479
+ return new AST_ForOf({
7480
+ start: my_start_token(M),
7481
+ end: my_end_token(M),
7482
+ init: from_moz(M.left),
7483
+ object: from_moz(M.right),
7484
+ body: from_moz(M.body),
7485
+ await: M.await
7486
+ });
7487
+ },
7488
+
7489
+ AwaitExpression: function(M) {
7490
+ return new AST_Await({
7491
+ start: my_start_token(M),
7492
+ end: my_end_token(M),
7493
+ expression: from_moz(M.argument)
7494
+ });
7495
+ },
7496
+
7497
+ YieldExpression: function(M) {
7498
+ return new AST_Yield({
7499
+ start: my_start_token(M),
7500
+ end: my_end_token(M),
7501
+ expression: from_moz(M.argument),
7502
+ is_star: M.delegate
7503
+ });
7504
+ },
7505
+
7506
+ DebuggerStatement: function(M) {
7507
+ return new AST_Debugger({
7508
+ start: my_start_token(M),
7509
+ end: my_end_token(M)
7510
+ });
7511
+ },
7512
+
7513
+ VariableDeclarator: function(M) {
7514
+ return new AST_VarDef({
7515
+ start: my_start_token(M),
7516
+ end: my_end_token(M),
7517
+ name: from_moz(M.id),
7518
+ value: from_moz(M.init)
7519
+ });
7520
+ },
7521
+
7522
+ CatchClause: function(M) {
7523
+ return new AST_Catch({
7524
+ start: my_start_token(M),
7525
+ end: my_end_token(M),
7526
+ argname: from_moz(M.param),
7527
+ body: from_moz(M.body).body
7528
+ });
7529
+ },
7530
+
7531
+ ThisExpression: function(M) {
7532
+ return new AST_This({
7533
+ start: my_start_token(M),
7534
+ end: my_end_token(M)
7535
+ });
7536
+ },
7537
+
7538
+ Super: function(M) {
7539
+ return new AST_Super({
7540
+ start: my_start_token(M),
7541
+ end: my_end_token(M)
7542
+ });
7543
+ },
7544
+
7545
+ BinaryExpression: function(M) {
7546
+ return new AST_Binary({
7547
+ start: my_start_token(M),
7548
+ end: my_end_token(M),
7549
+ operator: M.operator,
7550
+ left: from_moz(M.left),
7551
+ right: from_moz(M.right)
7552
+ });
7553
+ },
7554
+
7555
+ LogicalExpression: function(M) {
7556
+ return new AST_Binary({
7557
+ start: my_start_token(M),
7558
+ end: my_end_token(M),
7559
+ operator: M.operator,
7560
+ left: from_moz(M.left),
7561
+ right: from_moz(M.right)
7562
+ });
7563
+ },
7564
+
7565
+ AssignmentExpression: function(M) {
7566
+ return new AST_Assign({
7567
+ start: my_start_token(M),
7568
+ end: my_end_token(M),
7569
+ operator: M.operator,
7570
+ left: from_moz(M.left),
7571
+ right: from_moz(M.right)
7572
+ });
7573
+ },
7574
+
7575
+ ConditionalExpression: function(M) {
7576
+ return new AST_Conditional({
7577
+ start: my_start_token(M),
7578
+ end: my_end_token(M),
7579
+ condition: from_moz(M.test),
7580
+ consequent: from_moz(M.consequent),
7581
+ alternative: from_moz(M.alternate)
7582
+ });
6119
7583
  },
6120
- Identifier: function(M) {
6121
- var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2];
6122
- return new ( p.type == "LabeledStatement" ? AST_Label
6123
- : p.type == "VariableDeclarator" && p.id === M ? (p.kind == "const" ? AST_SymbolConst : p.kind == "let" ? AST_SymbolLet : AST_SymbolVar)
6124
- : /Import.*Specifier/.test(p.type) ? (p.local === M ? AST_SymbolImport : AST_SymbolImportForeign)
6125
- : p.type == "ExportSpecifier" ? (p.local === M ? AST_SymbolExport : AST_SymbolExportForeign)
6126
- : p.type == "FunctionExpression" ? (p.id === M ? AST_SymbolLambda : AST_SymbolFunarg)
6127
- : p.type == "FunctionDeclaration" ? (p.id === M ? AST_SymbolDefun : AST_SymbolFunarg)
6128
- : p.type == "ArrowFunctionExpression" ? (p.params.includes(M)) ? AST_SymbolFunarg : AST_SymbolRef
6129
- : p.type == "ClassExpression" ? (p.id === M ? AST_SymbolClass : AST_SymbolRef)
6130
- : p.type == "Property" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolMethod)
6131
- : p.type == "PropertyDefinition" || p.type === "FieldDefinition" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolClassProperty)
6132
- : p.type == "ClassDeclaration" ? (p.id === M ? AST_SymbolDefClass : AST_SymbolRef)
6133
- : p.type == "MethodDefinition" ? (p.computed ? AST_SymbolRef : AST_SymbolMethod)
6134
- : p.type == "CatchClause" ? AST_SymbolCatch
6135
- : p.type == "BreakStatement" || p.type == "ContinueStatement" ? AST_LabelRef
6136
- : AST_SymbolRef)({
6137
- start : my_start_token(M),
6138
- end : my_end_token(M),
6139
- name : M.name
6140
- });
7584
+
7585
+ NewExpression: function(M) {
7586
+ return new AST_New({
7587
+ start: my_start_token(M),
7588
+ end: my_end_token(M),
7589
+ expression: from_moz(M.callee),
7590
+ args: M.arguments.map(from_moz)
7591
+ });
6141
7592
  },
6142
- BigIntLiteral(M) {
6143
- return new AST_BigInt({
6144
- start : my_start_token(M),
6145
- end : my_end_token(M),
6146
- value : M.value
7593
+
7594
+ CallExpression: function(M) {
7595
+ return new AST_Call({
7596
+ start: my_start_token(M),
7597
+ end: my_end_token(M),
7598
+ expression: from_moz(M.callee),
7599
+ optional: M.optional,
7600
+ args: M.arguments.map(from_moz)
6147
7601
  });
6148
7602
  }
6149
7603
  };
@@ -6171,35 +7625,200 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
6171
7625
  });
6172
7626
  };
6173
7627
 
6174
- map("EmptyStatement", AST_EmptyStatement);
6175
- map("BlockStatement", AST_BlockStatement, "body@body");
6176
- map("IfStatement", AST_If, "test>condition, consequent>body, alternate>alternative");
6177
- map("LabeledStatement", AST_LabeledStatement, "label>label, body>body");
6178
- map("BreakStatement", AST_Break, "label>label");
6179
- map("ContinueStatement", AST_Continue, "label>label");
6180
- map("WithStatement", AST_With, "object>expression, body>body");
6181
- map("SwitchStatement", AST_Switch, "discriminant>expression, cases@body");
6182
- map("ReturnStatement", AST_Return, "argument>value");
6183
- map("ThrowStatement", AST_Throw, "argument>value");
6184
- map("WhileStatement", AST_While, "test>condition, body>body");
6185
- map("DoWhileStatement", AST_Do, "test>condition, body>body");
6186
- map("ForStatement", AST_For, "init>init, test>condition, update>step, body>body");
6187
- map("ForInStatement", AST_ForIn, "left>init, right>object, body>body");
6188
- map("ForOfStatement", AST_ForOf, "left>init, right>object, body>body, await=await");
6189
- map("AwaitExpression", AST_Await, "argument>expression");
6190
- map("YieldExpression", AST_Yield, "argument>expression, delegate=is_star");
6191
- map("DebuggerStatement", AST_Debugger);
6192
- map("VariableDeclarator", AST_VarDef, "id>name, init>value");
6193
- map("CatchClause", AST_Catch, "param>argname, body%body");
6194
-
6195
- map("ThisExpression", AST_This);
6196
- map("Super", AST_Super);
6197
- map("BinaryExpression", AST_Binary, "operator=operator, left>left, right>right");
6198
- map("LogicalExpression", AST_Binary, "operator=operator, left>left, right>right");
6199
- map("AssignmentExpression", AST_Assign, "operator=operator, left>left, right>right");
6200
- map("ConditionalExpression", AST_Conditional, "test>condition, consequent>consequent, alternate>alternative");
6201
- map("NewExpression", AST_New, "callee>expression, arguments@args");
6202
- map("CallExpression", AST_Call, "callee>expression, optional=optional, arguments@args");
7628
+ def_to_moz(AST_EmptyStatement, function To_Moz_EmptyStatement() {
7629
+ return {
7630
+ type: "EmptyStatement"
7631
+ };
7632
+ });
7633
+ def_to_moz(AST_BlockStatement, function To_Moz_BlockStatement(M) {
7634
+ return {
7635
+ type: "BlockStatement",
7636
+ body: M.body.map(to_moz)
7637
+ };
7638
+ });
7639
+ def_to_moz(AST_If, function To_Moz_IfStatement(M) {
7640
+ return {
7641
+ type: "IfStatement",
7642
+ test: to_moz(M.condition),
7643
+ consequent: to_moz(M.body),
7644
+ alternate: to_moz(M.alternative)
7645
+ };
7646
+ });
7647
+ def_to_moz(AST_LabeledStatement, function To_Moz_LabeledStatement(M) {
7648
+ return {
7649
+ type: "LabeledStatement",
7650
+ label: to_moz(M.label),
7651
+ body: to_moz(M.body)
7652
+ };
7653
+ });
7654
+ def_to_moz(AST_Break, function To_Moz_BreakStatement(M) {
7655
+ return {
7656
+ type: "BreakStatement",
7657
+ label: to_moz(M.label)
7658
+ };
7659
+ });
7660
+ def_to_moz(AST_Continue, function To_Moz_ContinueStatement(M) {
7661
+ return {
7662
+ type: "ContinueStatement",
7663
+ label: to_moz(M.label)
7664
+ };
7665
+ });
7666
+ def_to_moz(AST_With, function To_Moz_WithStatement(M) {
7667
+ return {
7668
+ type: "WithStatement",
7669
+ object: to_moz(M.expression),
7670
+ body: to_moz(M.body)
7671
+ };
7672
+ });
7673
+ def_to_moz(AST_Switch, function To_Moz_SwitchStatement(M) {
7674
+ return {
7675
+ type: "SwitchStatement",
7676
+ discriminant: to_moz(M.expression),
7677
+ cases: M.body.map(to_moz)
7678
+ };
7679
+ });
7680
+ def_to_moz(AST_Return, function To_Moz_ReturnStatement(M) {
7681
+ return {
7682
+ type: "ReturnStatement",
7683
+ argument: to_moz(M.value)
7684
+ };
7685
+ });
7686
+ def_to_moz(AST_Throw, function To_Moz_ThrowStatement(M) {
7687
+ return {
7688
+ type: "ThrowStatement",
7689
+ argument: to_moz(M.value)
7690
+ };
7691
+ });
7692
+ def_to_moz(AST_While, function To_Moz_WhileStatement(M) {
7693
+ return {
7694
+ type: "WhileStatement",
7695
+ test: to_moz(M.condition),
7696
+ body: to_moz(M.body)
7697
+ };
7698
+ });
7699
+ def_to_moz(AST_Do, function To_Moz_DoWhileStatement(M) {
7700
+ return {
7701
+ type: "DoWhileStatement",
7702
+ test: to_moz(M.condition),
7703
+ body: to_moz(M.body)
7704
+ };
7705
+ });
7706
+ def_to_moz(AST_For, function To_Moz_ForStatement(M) {
7707
+ return {
7708
+ type: "ForStatement",
7709
+ init: to_moz(M.init),
7710
+ test: to_moz(M.condition),
7711
+ update: to_moz(M.step),
7712
+ body: to_moz(M.body)
7713
+ };
7714
+ });
7715
+ def_to_moz(AST_ForIn, function To_Moz_ForInStatement(M) {
7716
+ return {
7717
+ type: "ForInStatement",
7718
+ left: to_moz(M.init),
7719
+ right: to_moz(M.object),
7720
+ body: to_moz(M.body)
7721
+ };
7722
+ });
7723
+ def_to_moz(AST_ForOf, function To_Moz_ForOfStatement(M) {
7724
+ return {
7725
+ type: "ForOfStatement",
7726
+ left: to_moz(M.init),
7727
+ right: to_moz(M.object),
7728
+ body: to_moz(M.body),
7729
+ await: M.await
7730
+ };
7731
+ });
7732
+ def_to_moz(AST_Await, function To_Moz_AwaitExpression(M) {
7733
+ return {
7734
+ type: "AwaitExpression",
7735
+ argument: to_moz(M.expression)
7736
+ };
7737
+ });
7738
+ def_to_moz(AST_Yield, function To_Moz_YieldExpression(M) {
7739
+ return {
7740
+ type: "YieldExpression",
7741
+ argument: to_moz(M.expression),
7742
+ delegate: M.is_star
7743
+ };
7744
+ });
7745
+ def_to_moz(AST_Debugger, function To_Moz_DebuggerStatement() {
7746
+ return {
7747
+ type: "DebuggerStatement"
7748
+ };
7749
+ });
7750
+ def_to_moz(AST_VarDef, function To_Moz_VariableDeclarator(M) {
7751
+ return {
7752
+ type: "VariableDeclarator",
7753
+ id: to_moz(M.name),
7754
+ init: to_moz(M.value)
7755
+ };
7756
+ });
7757
+ def_to_moz(AST_Catch, function To_Moz_CatchClause(M) {
7758
+ return {
7759
+ type: "CatchClause",
7760
+ param: to_moz(M.argname),
7761
+ body: to_moz_block(M)
7762
+ };
7763
+ });
7764
+
7765
+ def_to_moz(AST_This, function To_Moz_ThisExpression() {
7766
+ return {
7767
+ type: "ThisExpression"
7768
+ };
7769
+ });
7770
+ def_to_moz(AST_Super, function To_Moz_Super() {
7771
+ return {
7772
+ type: "Super"
7773
+ };
7774
+ });
7775
+ def_to_moz(AST_Binary, function To_Moz_BinaryExpression(M) {
7776
+ return {
7777
+ type: "BinaryExpression",
7778
+ operator: M.operator,
7779
+ left: to_moz(M.left),
7780
+ right: to_moz(M.right)
7781
+ };
7782
+ });
7783
+ def_to_moz(AST_Binary, function To_Moz_LogicalExpression(M) {
7784
+ return {
7785
+ type: "LogicalExpression",
7786
+ operator: M.operator,
7787
+ left: to_moz(M.left),
7788
+ right: to_moz(M.right)
7789
+ };
7790
+ });
7791
+ def_to_moz(AST_Assign, function To_Moz_AssignmentExpression(M) {
7792
+ return {
7793
+ type: "AssignmentExpression",
7794
+ operator: M.operator,
7795
+ left: to_moz(M.left),
7796
+ right: to_moz(M.right)
7797
+ };
7798
+ });
7799
+ def_to_moz(AST_Conditional, function To_Moz_ConditionalExpression(M) {
7800
+ return {
7801
+ type: "ConditionalExpression",
7802
+ test: to_moz(M.condition),
7803
+ consequent: to_moz(M.consequent),
7804
+ alternate: to_moz(M.alternative)
7805
+ };
7806
+ });
7807
+ def_to_moz(AST_New, function To_Moz_NewExpression(M) {
7808
+ return {
7809
+ type: "NewExpression",
7810
+ callee: to_moz(M.expression),
7811
+ arguments: M.args.map(to_moz)
7812
+ };
7813
+ });
7814
+ def_to_moz(AST_Call, function To_Moz_CallExpression(M) {
7815
+ return {
7816
+ type: "CallExpression",
7817
+ callee: to_moz(M.expression),
7818
+ optional: M.optional,
7819
+ arguments: M.args.map(to_moz)
7820
+ };
7821
+ });
6203
7822
 
6204
7823
  def_to_moz(AST_Toplevel, function To_Moz_Program(M) {
6205
7824
  return to_moz_scope("Program", M);
@@ -6750,57 +8369,6 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
6750
8369
  );
6751
8370
  }
6752
8371
 
6753
- function map(moztype, mytype, propmap) {
6754
- var moz_to_me = "function From_Moz_" + moztype + "(M){\n";
6755
- moz_to_me += "return new U2." + mytype.name + "({\n" +
6756
- "start: my_start_token(M),\n" +
6757
- "end: my_end_token(M)";
6758
-
6759
- var me_to_moz = "function To_Moz_" + moztype + "(M){\n";
6760
- me_to_moz += "return {\n" +
6761
- "type: " + JSON.stringify(moztype);
6762
-
6763
- if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop) {
6764
- var m = /([a-z0-9$_]+)([=@>%])([a-z0-9$_]+)/i.exec(prop);
6765
- if (!m) throw new Error("Can't understand property map: " + prop);
6766
- var moz = m[1], how = m[2], my = m[3];
6767
- moz_to_me += ",\n" + my + ": ";
6768
- me_to_moz += ",\n" + moz + ": ";
6769
- switch (how) {
6770
- case "@":
6771
- moz_to_me += "M." + moz + ".map(from_moz)";
6772
- me_to_moz += "M." + my + ".map(to_moz)";
6773
- break;
6774
- case ">":
6775
- moz_to_me += "from_moz(M." + moz + ")";
6776
- me_to_moz += "to_moz(M." + my + ")";
6777
- break;
6778
- case "=":
6779
- moz_to_me += "M." + moz;
6780
- me_to_moz += "M." + my;
6781
- break;
6782
- case "%":
6783
- moz_to_me += "from_moz(M." + moz + ").body";
6784
- me_to_moz += "to_moz_block(M)";
6785
- break;
6786
- default:
6787
- throw new Error("Can't understand operator in propmap: " + prop);
6788
- }
6789
- });
6790
-
6791
- moz_to_me += "\n})\n}";
6792
- me_to_moz += "\n}\n}";
6793
-
6794
- moz_to_me = new Function("U2", "my_start_token", "my_end_token", "from_moz", "return(" + moz_to_me + ")")(
6795
- ast, my_start_token, my_end_token, from_moz
6796
- );
6797
- me_to_moz = new Function("to_moz", "to_moz_block", "to_moz_scope", "return(" + me_to_moz + ")")(
6798
- to_moz, to_moz_block, to_moz_scope
6799
- );
6800
- MOZ_TO_ME[moztype] = moz_to_me;
6801
- def_to_moz(mytype, me_to_moz);
6802
- }
6803
-
6804
8372
  var FROM_MOZ_STACK = null;
6805
8373
 
6806
8374
  function from_moz(node) {
@@ -6975,7 +8543,7 @@ function is_some_comments(comment) {
6975
8543
  // multiline comment
6976
8544
  return (
6977
8545
  (comment.type === "comment2" || comment.type === "comment1")
6978
- && /@preserve|@lic|@cc_on|^\**!/i.test(comment.value)
8546
+ && /@preserve|@copyright|@lic|@cc_on|^\**!/i.test(comment.value)
6979
8547
  );
6980
8548
  }
6981
8549
 
@@ -7901,7 +9469,8 @@ function OutputStream(options) {
7901
9469
  var p = output.parent();
7902
9470
  if (this.args.length === 0
7903
9471
  && (p instanceof AST_PropAccess // (new Date).getTime(), (new Date)["getTime"]()
7904
- || p instanceof AST_Call && p.expression === this)) // (new foo)(bar)
9472
+ || p instanceof AST_Call && p.expression === this
9473
+ || p instanceof AST_PrefixedTemplateString && p.prefix === this)) // (new foo)(bar)
7905
9474
  return true;
7906
9475
  });
7907
9476
 
@@ -9177,24 +10746,6 @@ const equivalent_to = (tree1, tree2) => {
9177
10746
  return walk_1_state.length == 0 && walk_2_state.length == 0;
9178
10747
  };
9179
10748
 
9180
- // Creates a shallow compare function
9181
- const mkshallow = (props) => {
9182
- const comparisons = Object
9183
- .keys(props)
9184
- .map(key => {
9185
- if (props[key] === "eq") {
9186
- return `this.${key} === other.${key}`;
9187
- } else if (props[key] === "exist") {
9188
- return `(this.${key} == null ? other.${key} == null : this.${key} === other.${key})`;
9189
- } else {
9190
- throw new Error(`mkshallow: Unexpected instruction: ${props[key]}`);
9191
- }
9192
- })
9193
- .join(" && ");
9194
-
9195
- return new Function("other", "return " + comparisons);
9196
- };
9197
-
9198
10749
  const pass_through = () => true;
9199
10750
 
9200
10751
  AST_Node.prototype.shallow_cmp = function () {
@@ -9203,7 +10754,9 @@ AST_Node.prototype.shallow_cmp = function () {
9203
10754
 
9204
10755
  AST_Debugger.prototype.shallow_cmp = pass_through;
9205
10756
 
9206
- AST_Directive.prototype.shallow_cmp = mkshallow({ value: "eq" });
10757
+ AST_Directive.prototype.shallow_cmp = function(other) {
10758
+ return this.value === other.value;
10759
+ };
9207
10760
 
9208
10761
  AST_SimpleStatement.prototype.shallow_cmp = pass_through;
9209
10762
 
@@ -9211,17 +10764,17 @@ AST_Block.prototype.shallow_cmp = pass_through;
9211
10764
 
9212
10765
  AST_EmptyStatement.prototype.shallow_cmp = pass_through;
9213
10766
 
9214
- AST_LabeledStatement.prototype.shallow_cmp = mkshallow({ "label.name": "eq" });
10767
+ AST_LabeledStatement.prototype.shallow_cmp = function(other) {
10768
+ return this.label.name === other.label.name;
10769
+ };
9215
10770
 
9216
10771
  AST_Do.prototype.shallow_cmp = pass_through;
9217
10772
 
9218
10773
  AST_While.prototype.shallow_cmp = pass_through;
9219
10774
 
9220
- AST_For.prototype.shallow_cmp = mkshallow({
9221
- init: "exist",
9222
- condition: "exist",
9223
- step: "exist"
9224
- });
10775
+ AST_For.prototype.shallow_cmp = function(other) {
10776
+ return (this.init == null ? other.init == null : this.init === other.init) && (this.condition == null ? other.condition == null : this.condition === other.condition) && (this.step == null ? other.step == null : this.step === other.step);
10777
+ };
9225
10778
 
9226
10779
  AST_ForIn.prototype.shallow_cmp = pass_through;
9227
10780
 
@@ -9233,22 +10786,21 @@ AST_Toplevel.prototype.shallow_cmp = pass_through;
9233
10786
 
9234
10787
  AST_Expansion.prototype.shallow_cmp = pass_through;
9235
10788
 
9236
- AST_Lambda.prototype.shallow_cmp = mkshallow({
9237
- is_generator: "eq",
9238
- async: "eq"
9239
- });
10789
+ AST_Lambda.prototype.shallow_cmp = function(other) {
10790
+ return this.is_generator === other.is_generator && this.async === other.async;
10791
+ };
9240
10792
 
9241
- AST_Destructuring.prototype.shallow_cmp = mkshallow({
9242
- is_array: "eq"
9243
- });
10793
+ AST_Destructuring.prototype.shallow_cmp = function(other) {
10794
+ return this.is_array === other.is_array;
10795
+ };
9244
10796
 
9245
10797
  AST_PrefixedTemplateString.prototype.shallow_cmp = pass_through;
9246
10798
 
9247
10799
  AST_TemplateString.prototype.shallow_cmp = pass_through;
9248
10800
 
9249
- AST_TemplateSegment.prototype.shallow_cmp = mkshallow({
9250
- "value": "eq"
9251
- });
10801
+ AST_TemplateSegment.prototype.shallow_cmp = function(other) {
10802
+ return this.value === other.value;
10803
+ };
9252
10804
 
9253
10805
  AST_Jump.prototype.shallow_cmp = pass_through;
9254
10806
 
@@ -9256,51 +10808,45 @@ AST_LoopControl.prototype.shallow_cmp = pass_through;
9256
10808
 
9257
10809
  AST_Await.prototype.shallow_cmp = pass_through;
9258
10810
 
9259
- AST_Yield.prototype.shallow_cmp = mkshallow({
9260
- is_star: "eq"
9261
- });
10811
+ AST_Yield.prototype.shallow_cmp = function(other) {
10812
+ return this.is_star === other.is_star;
10813
+ };
9262
10814
 
9263
- AST_If.prototype.shallow_cmp = mkshallow({
9264
- alternative: "exist"
9265
- });
10815
+ AST_If.prototype.shallow_cmp = function(other) {
10816
+ return this.alternative == null ? other.alternative == null : this.alternative === other.alternative;
10817
+ };
9266
10818
 
9267
10819
  AST_Switch.prototype.shallow_cmp = pass_through;
9268
10820
 
9269
10821
  AST_SwitchBranch.prototype.shallow_cmp = pass_through;
9270
10822
 
9271
- AST_Try.prototype.shallow_cmp = mkshallow({
9272
- bcatch: "exist",
9273
- bfinally: "exist"
9274
- });
10823
+ AST_Try.prototype.shallow_cmp = function(other) {
10824
+ return (this.bcatch == null ? other.bcatch == null : this.bcatch === other.bcatch) && (this.bfinally == null ? other.bfinally == null : this.bfinally === other.bfinally);
10825
+ };
9275
10826
 
9276
- AST_Catch.prototype.shallow_cmp = mkshallow({
9277
- argname: "exist"
9278
- });
10827
+ AST_Catch.prototype.shallow_cmp = function(other) {
10828
+ return this.argname == null ? other.argname == null : this.argname === other.argname;
10829
+ };
9279
10830
 
9280
10831
  AST_Finally.prototype.shallow_cmp = pass_through;
9281
10832
 
9282
10833
  AST_Definitions.prototype.shallow_cmp = pass_through;
9283
10834
 
9284
- AST_VarDef.prototype.shallow_cmp = mkshallow({
9285
- value: "exist"
9286
- });
10835
+ AST_VarDef.prototype.shallow_cmp = function(other) {
10836
+ return this.value == null ? other.value == null : this.value === other.value;
10837
+ };
9287
10838
 
9288
10839
  AST_NameMapping.prototype.shallow_cmp = pass_through;
9289
10840
 
9290
- AST_Import.prototype.shallow_cmp = mkshallow({
9291
- imported_name: "exist",
9292
- imported_names: "exist"
9293
- });
10841
+ AST_Import.prototype.shallow_cmp = function(other) {
10842
+ return (this.imported_name == null ? other.imported_name == null : this.imported_name === other.imported_name) && (this.imported_names == null ? other.imported_names == null : this.imported_names === other.imported_names);
10843
+ };
9294
10844
 
9295
10845
  AST_ImportMeta.prototype.shallow_cmp = pass_through;
9296
10846
 
9297
- AST_Export.prototype.shallow_cmp = mkshallow({
9298
- exported_definition: "exist",
9299
- exported_value: "exist",
9300
- exported_names: "exist",
9301
- module_name: "eq",
9302
- is_default: "eq",
9303
- });
10847
+ AST_Export.prototype.shallow_cmp = function(other) {
10848
+ return (this.exported_definition == null ? other.exported_definition == null : this.exported_definition === other.exported_definition) && (this.exported_value == null ? other.exported_value == null : this.exported_value === other.exported_value) && (this.exported_names == null ? other.exported_names == null : this.exported_names === other.exported_names) && this.module_name === other.module_name && this.is_default === other.is_default;
10849
+ };
9304
10850
 
9305
10851
  AST_Call.prototype.shallow_cmp = pass_through;
9306
10852
 
@@ -9310,21 +10856,21 @@ AST_PropAccess.prototype.shallow_cmp = pass_through;
9310
10856
 
9311
10857
  AST_Chain.prototype.shallow_cmp = pass_through;
9312
10858
 
9313
- AST_Dot.prototype.shallow_cmp = mkshallow({
9314
- property: "eq"
9315
- });
10859
+ AST_Dot.prototype.shallow_cmp = function(other) {
10860
+ return this.property === other.property;
10861
+ };
9316
10862
 
9317
- AST_DotHash.prototype.shallow_cmp = mkshallow({
9318
- property: "eq"
9319
- });
10863
+ AST_DotHash.prototype.shallow_cmp = function(other) {
10864
+ return this.property === other.property;
10865
+ };
9320
10866
 
9321
- AST_Unary.prototype.shallow_cmp = mkshallow({
9322
- operator: "eq"
9323
- });
10867
+ AST_Unary.prototype.shallow_cmp = function(other) {
10868
+ return this.operator === other.operator;
10869
+ };
9324
10870
 
9325
- AST_Binary.prototype.shallow_cmp = mkshallow({
9326
- operator: "eq"
9327
- });
10871
+ AST_Binary.prototype.shallow_cmp = function(other) {
10872
+ return this.operator === other.operator;
10873
+ };
9328
10874
 
9329
10875
  AST_Conditional.prototype.shallow_cmp = pass_through;
9330
10876
 
@@ -9334,36 +10880,33 @@ AST_Object.prototype.shallow_cmp = pass_through;
9334
10880
 
9335
10881
  AST_ObjectProperty.prototype.shallow_cmp = pass_through;
9336
10882
 
9337
- AST_ObjectKeyVal.prototype.shallow_cmp = mkshallow({
9338
- key: "eq"
9339
- });
10883
+ AST_ObjectKeyVal.prototype.shallow_cmp = function(other) {
10884
+ return this.key === other.key;
10885
+ };
9340
10886
 
9341
- AST_ObjectSetter.prototype.shallow_cmp = mkshallow({
9342
- static: "eq"
9343
- });
10887
+ AST_ObjectSetter.prototype.shallow_cmp = function(other) {
10888
+ return this.static === other.static;
10889
+ };
9344
10890
 
9345
- AST_ObjectGetter.prototype.shallow_cmp = mkshallow({
9346
- static: "eq"
9347
- });
10891
+ AST_ObjectGetter.prototype.shallow_cmp = function(other) {
10892
+ return this.static === other.static;
10893
+ };
9348
10894
 
9349
- AST_ConciseMethod.prototype.shallow_cmp = mkshallow({
9350
- static: "eq",
9351
- is_generator: "eq",
9352
- async: "eq",
9353
- });
10895
+ AST_ConciseMethod.prototype.shallow_cmp = function(other) {
10896
+ return this.static === other.static && this.is_generator === other.is_generator && this.async === other.async;
10897
+ };
9354
10898
 
9355
- AST_Class.prototype.shallow_cmp = mkshallow({
9356
- name: "exist",
9357
- extends: "exist",
9358
- });
10899
+ AST_Class.prototype.shallow_cmp = function(other) {
10900
+ return (this.name == null ? other.name == null : this.name === other.name) && (this.extends == null ? other.extends == null : this.extends === other.extends);
10901
+ };
9359
10902
 
9360
- AST_ClassProperty.prototype.shallow_cmp = mkshallow({
9361
- static: "eq"
9362
- });
10903
+ AST_ClassProperty.prototype.shallow_cmp = function(other) {
10904
+ return this.static === other.static;
10905
+ };
9363
10906
 
9364
- AST_Symbol.prototype.shallow_cmp = mkshallow({
9365
- name: "eq"
9366
- });
10907
+ AST_Symbol.prototype.shallow_cmp = function(other) {
10908
+ return this.name === other.name;
10909
+ };
9367
10910
 
9368
10911
  AST_NewTarget.prototype.shallow_cmp = pass_through;
9369
10912
 
@@ -9371,17 +10914,17 @@ AST_This.prototype.shallow_cmp = pass_through;
9371
10914
 
9372
10915
  AST_Super.prototype.shallow_cmp = pass_through;
9373
10916
 
9374
- AST_String.prototype.shallow_cmp = mkshallow({
9375
- value: "eq"
9376
- });
10917
+ AST_String.prototype.shallow_cmp = function(other) {
10918
+ return this.value === other.value;
10919
+ };
9377
10920
 
9378
- AST_Number.prototype.shallow_cmp = mkshallow({
9379
- value: "eq"
9380
- });
10921
+ AST_Number.prototype.shallow_cmp = function(other) {
10922
+ return this.value === other.value;
10923
+ };
9381
10924
 
9382
- AST_BigInt.prototype.shallow_cmp = mkshallow({
9383
- value: "eq"
9384
- });
10925
+ AST_BigInt.prototype.shallow_cmp = function(other) {
10926
+ return this.value === other.value;
10927
+ };
9385
10928
 
9386
10929
  AST_RegExp.prototype.shallow_cmp = function (other) {
9387
10930
  return (
@@ -9440,6 +10983,11 @@ const MASK_EXPORT_WANT_MANGLE = 1 << 1;
9440
10983
 
9441
10984
  let function_defs = null;
9442
10985
  let unmangleable_names = null;
10986
+ /**
10987
+ * When defined, there is a function declaration somewhere that's inside of a block.
10988
+ * See https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics
10989
+ */
10990
+ let scopes_with_block_defuns = null;
9443
10991
 
9444
10992
  class SymbolDef {
9445
10993
  constructor(scope, orig, init) {
@@ -9990,6 +11538,15 @@ AST_Scope.DEFMETHOD("def_variable", function(symbol, init) {
9990
11538
  });
9991
11539
 
9992
11540
  function next_mangled(scope, options) {
11541
+ let defun_scope;
11542
+ if (
11543
+ scopes_with_block_defuns
11544
+ && (defun_scope = scope.get_defun_scope())
11545
+ && scopes_with_block_defuns.has(defun_scope)
11546
+ ) {
11547
+ scope = defun_scope;
11548
+ }
11549
+
9993
11550
  var ext = scope.enclosed;
9994
11551
  var nth_identifier = options.nth_identifier;
9995
11552
  out: while (true) {
@@ -10124,6 +11681,13 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
10124
11681
  lname = save_nesting;
10125
11682
  return true; // don't descend again in TreeWalker
10126
11683
  }
11684
+ if (
11685
+ node instanceof AST_Defun
11686
+ && !(tw.parent() instanceof AST_Scope)
11687
+ ) {
11688
+ scopes_with_block_defuns = scopes_with_block_defuns || new Set();
11689
+ scopes_with_block_defuns.add(node.parent_scope.get_defun_scope());
11690
+ }
10127
11691
  if (node instanceof AST_Scope) {
10128
11692
  node.variables.forEach(collect);
10129
11693
  return;
@@ -10172,6 +11736,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
10172
11736
 
10173
11737
  function_defs = null;
10174
11738
  unmangleable_names = null;
11739
+ scopes_with_block_defuns = null;
10175
11740
 
10176
11741
  function collect(symbol) {
10177
11742
  if (symbol.export & MASK_EXPORT_DONT_MANGLE) {
@@ -12204,14 +13769,15 @@ def_eval(AST_Constant, function () {
12204
13769
  def_eval(AST_BigInt, return_this);
12205
13770
 
12206
13771
  def_eval(AST_RegExp, function (compressor) {
12207
- let evaluated = compressor.evaluated_regexps.get(this);
13772
+ let evaluated = compressor.evaluated_regexps.get(this.value);
12208
13773
  if (evaluated === undefined) {
12209
13774
  try {
12210
- evaluated = (0, eval)(this.print_to_string());
13775
+ const { source, flags } = this.value;
13776
+ evaluated = new RegExp(source, flags);
12211
13777
  } catch (e) {
12212
13778
  evaluated = null;
12213
13779
  }
12214
- compressor.evaluated_regexps.set(this, evaluated);
13780
+ compressor.evaluated_regexps.set(this.value, evaluated);
12215
13781
  }
12216
13782
  return evaluated || this;
12217
13783
  });
@@ -22383,6 +23949,7 @@ var domprops = [
22383
23949
  "applyElement",
22384
23950
  "arc",
22385
23951
  "arcTo",
23952
+ "architecture",
22386
23953
  "archive",
22387
23954
  "areas",
22388
23955
  "arguments",
@@ -22557,6 +24124,7 @@ var domprops = [
22557
24124
  "bindTexture",
22558
24125
  "bindTransformFeedback",
22559
24126
  "bindVertexArray",
24127
+ "bitness",
22560
24128
  "blendColor",
22561
24129
  "blendEquation",
22562
24130
  "blendEquationSeparate",
@@ -22718,6 +24286,8 @@ var domprops = [
22718
24286
  "boxDecorationBreak",
22719
24287
  "boxShadow",
22720
24288
  "boxSizing",
24289
+ "brand",
24290
+ "brands",
22721
24291
  "break-after",
22722
24292
  "break-before",
22723
24293
  "break-inside",
@@ -23716,6 +25286,7 @@ var domprops = [
23716
25286
  "fround",
23717
25287
  "fullPath",
23718
25288
  "fullScreen",
25289
+ "fullVersionList",
23719
25290
  "fullscreen",
23720
25291
  "fullscreenElement",
23721
25292
  "fullscreenEnabled",
@@ -23841,6 +25412,7 @@ var domprops = [
23841
25412
  "getFrequencyResponse",
23842
25413
  "getFullYear",
23843
25414
  "getGamepads",
25415
+ "getHighEntropyValues",
23844
25416
  "getHitTestResults",
23845
25417
  "getHitTestResultsForTransientInput",
23846
25418
  "getHours",
@@ -24681,7 +26253,9 @@ var domprops = [
24681
26253
  "mix-blend-mode",
24682
26254
  "mixBlendMode",
24683
26255
  "mm",
26256
+ "mobile",
24684
26257
  "mode",
26258
+ "model",
24685
26259
  "modify",
24686
26260
  "mount",
24687
26261
  "move",
@@ -25587,6 +27161,7 @@ var domprops = [
25587
27161
  "placeItems",
25588
27162
  "placeSelf",
25589
27163
  "placeholder",
27164
+ "platformVersion",
25590
27165
  "platform",
25591
27166
  "platforms",
25592
27167
  "play",
@@ -26825,6 +28400,7 @@ var domprops = [
26825
28400
  "user-select",
26826
28401
  "userActivation",
26827
28402
  "userAgent",
28403
+ "userAgentData",
26828
28404
  "userChoice",
26829
28405
  "userHandle",
26830
28406
  "userHint",
@@ -27138,6 +28714,7 @@ var domprops = [
27138
28714
  "wordSpacing",
27139
28715
  "wordWrap",
27140
28716
  "workerStart",
28717
+ "wow64",
27141
28718
  "wrap",
27142
28719
  "wrapKey",
27143
28720
  "writable",
@@ -27226,7 +28803,7 @@ function find_builtins(reserved) {
27226
28803
  var global_ref = typeof global === "object" ? global : self;
27227
28804
 
27228
28805
  new_globals.forEach(function (new_global) {
27229
- objects[new_global] = global_ref[new_global] || new Function();
28806
+ objects[new_global] = global_ref[new_global] || function() {};
27230
28807
  });
27231
28808
 
27232
28809
  [
@@ -27555,7 +29132,54 @@ function cache_to_json(cache) {
27555
29132
  };
27556
29133
  }
27557
29134
 
27558
- async function minify(files, options) {
29135
+ function log_input(files, options, fs, debug_folder) {
29136
+ if (!(fs && fs.writeFileSync && fs.mkdirSync)) {
29137
+ return;
29138
+ }
29139
+
29140
+ try {
29141
+ fs.mkdirSync(debug_folder);
29142
+ } catch (e) {
29143
+ if (e.code !== "EEXIST") throw e;
29144
+ }
29145
+
29146
+ const log_path = `${debug_folder}/terser-debug-${(Math.random() * 9999999) | 0}.log`;
29147
+
29148
+ options = options || {};
29149
+
29150
+ const options_str = JSON.stringify(options, (_key, thing) => {
29151
+ if (typeof thing === "function") return "[Function " + thing.toString() + "]";
29152
+ if (thing instanceof RegExp) return "[RegExp " + thing.toString() + "]";
29153
+ return thing;
29154
+ }, 4);
29155
+
29156
+ const files_str = (file) => {
29157
+ if (typeof file === "object" && options.parse && options.parse.spidermonkey) {
29158
+ return JSON.stringify(file, null, 2);
29159
+ } else if (typeof file === "object") {
29160
+ return Object.keys(file)
29161
+ .map((key) => key + ": " + files_str(file[key]))
29162
+ .join("\n\n");
29163
+ } else if (typeof file === "string") {
29164
+ return "```\n" + file + "\n```";
29165
+ } else {
29166
+ return file; // What do?
29167
+ }
29168
+ };
29169
+
29170
+ fs.writeFileSync(log_path, "Options: \n" + options_str + "\n\nInput files:\n\n" + files_str(files) + "\n");
29171
+ }
29172
+
29173
+ async function minify(files, options, _fs_module) {
29174
+ if (
29175
+ _fs_module
29176
+ && typeof process === "object"
29177
+ && process.env
29178
+ && typeof process.env.TERSER_DEBUG_DIR === "string"
29179
+ ) {
29180
+ log_input(files, options, _fs_module, process.env.TERSER_DEBUG_DIR);
29181
+ }
29182
+
27559
29183
  options = defaults(options, {
27560
29184
  compress: {},
27561
29185
  ecma: undefined,
@@ -27578,6 +29202,7 @@ async function minify(files, options) {
27578
29202
  warnings: false,
27579
29203
  wrap: false,
27580
29204
  }, true);
29205
+
27581
29206
  var timings = options.timings && {
27582
29207
  start: Date.now()
27583
29208
  };
@@ -27979,7 +29604,7 @@ async function run_cli({ program, packageJson, fs, path }) {
27979
29604
 
27980
29605
  let result;
27981
29606
  try {
27982
- result = await minify(files, options);
29607
+ result = await minify(files, options, fs);
27983
29608
  } catch (ex) {
27984
29609
  if (ex.name == "SyntaxError") {
27985
29610
  print_error("Parse error at " + ex.filename + ":" + ex.line + "," + ex.col);
@@ -28042,14 +29667,18 @@ async function run_cli({ program, packageJson, fs, path }) {
28042
29667
  }, 2));
28043
29668
  } else if (program.output == "spidermonkey") {
28044
29669
  try {
28045
- const minified = await minify(result.code, {
28046
- compress: false,
28047
- mangle: false,
28048
- format: {
28049
- ast: true,
28050
- code: false
28051
- }
28052
- });
29670
+ const minified = await minify(
29671
+ result.code,
29672
+ {
29673
+ compress: false,
29674
+ mangle: false,
29675
+ format: {
29676
+ ast: true,
29677
+ code: false
29678
+ }
29679
+ },
29680
+ fs
29681
+ );
28053
29682
  console.log(JSON.stringify(minified.ast.to_mozilla_ast(), null, 2));
28054
29683
  } catch (ex) {
28055
29684
  fatal(ex);