terser 1.2.4 → 1.2.6

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.
data/lib/terser.js CHANGED
@@ -329,7 +329,6 @@ ALL_RESERVED_WORDS = makePredicate(ALL_RESERVED_WORDS);
329
329
 
330
330
  var OPERATOR_CHARS = makePredicate(characters("+-*&%=<>!?|~^"));
331
331
 
332
- var RE_NUM_LITERAL = /[0-9a-f]/i;
333
332
  var RE_HEX_NUMBER = /^0x[0-9a-f]+$/i;
334
333
  var RE_OCT_NUMBER = /^0[0-7]+$/;
335
334
  var RE_ES6_OCT_NUMBER = /^0o[0-7]+$/i;
@@ -694,15 +693,16 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
694
693
  return after_e;
695
694
  case (after_e = false, 46): // .
696
695
  return (!has_dot && !has_x && !has_e) ? (has_dot = true) : false;
697
- }
698
-
699
- if (ch === "n") {
696
+ case 110: // n
700
697
  is_big_int = true;
701
-
702
698
  return true;
703
699
  }
704
700
 
705
- return RE_NUM_LITERAL.test(ch);
701
+ return (
702
+ code >= 48 && code <= 57 // 0-9
703
+ || code >= 97 && code <= 102 // a-f
704
+ || code >= 65 && code <= 70 // A-F
705
+ );
706
706
  });
707
707
  if (prefix) num = prefix + num;
708
708
 
@@ -719,7 +719,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
719
719
  }
720
720
  num = num.replace(/_/g, "");
721
721
  }
722
- if (num.endsWith("n")) {
722
+ if (is_big_int) {
723
723
  const without_n = num.slice(0, -1);
724
724
  const allow_e = RE_HEX_NUMBER.test(without_n);
725
725
  const valid = parse_js_number(without_n, allow_e);
@@ -843,7 +843,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
843
843
  } else if (ch == "$" && peek() == "{") {
844
844
  next(true, true);
845
845
  S.brace_counter++;
846
- tok = token(begin ? "template_head" : "template_substitution", content);
846
+ tok = token(begin ? "template_head" : "template_cont", content);
847
847
  TEMPLATE_RAWS.set(tok, raw);
848
848
  tok.template_end = false;
849
849
  return tok;
@@ -860,7 +860,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
860
860
  content += ch;
861
861
  }
862
862
  S.template_braces.pop();
863
- tok = token(begin ? "template_head" : "template_substitution", content);
863
+ tok = token(begin ? "template_head" : "template_cont", content);
864
864
  TEMPLATE_RAWS.set(tok, raw);
865
865
  tok.template_end = true;
866
866
  return tok;
@@ -894,7 +894,24 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
894
894
  return next_token;
895
895
  });
896
896
 
897
- var read_name = with_eof_error("Unterminated identifier name", function() {
897
+ var read_name = function () {
898
+ let start = S.pos, end = start - 1, ch = "c";
899
+
900
+ while (
901
+ (ch = S.text.charAt(++end))
902
+ && (ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z")
903
+ );
904
+
905
+ if (end > start + 1 && ch && ch !== "\\" && !is_identifier_char(ch)) {
906
+ S.pos += end - start;
907
+ S.col += end - start;
908
+ return S.text.slice(start, S.pos);
909
+ }
910
+
911
+ return read_name_hard();
912
+ };
913
+
914
+ var read_name_hard = with_eof_error("Unterminated identifier name", function() {
898
915
  var name = [], ch, escaped = false;
899
916
  var read_escaped_identifier_char = function() {
900
917
  escaped = true;
@@ -1685,24 +1702,19 @@ function parse($TEXT, options) {
1685
1702
 
1686
1703
  var body = _function_body(is("punc", "{"), false, is_async);
1687
1704
 
1688
- var end =
1689
- body instanceof Array && body.length ? body[body.length - 1].end :
1690
- body instanceof Array ? start :
1691
- body.end;
1692
-
1693
1705
  return new AST_Arrow({
1694
1706
  start : start,
1695
- end : end,
1707
+ end : body.end,
1696
1708
  async : is_async,
1697
1709
  argnames : argnames,
1698
1710
  body : body
1699
1711
  });
1700
1712
  };
1701
1713
 
1702
- var function_ = function(ctor, is_generator_property, is_async, is_export_default) {
1714
+ var function_ = function(ctor, is_generator, is_async, is_export_default) {
1703
1715
  var in_statement = ctor === AST_Defun;
1704
- var is_generator = is("operator", "*");
1705
- if (is_generator) {
1716
+ if (is("operator", "*")) {
1717
+ is_generator = true;
1706
1718
  next();
1707
1719
  }
1708
1720
 
@@ -1719,7 +1731,7 @@ function parse($TEXT, options) {
1719
1731
  unexpected(prev());
1720
1732
 
1721
1733
  var args = [];
1722
- var body = _function_body(true, is_generator || is_generator_property, is_async, name, args);
1734
+ var body = _function_body(true, is_generator, is_async, name, args);
1723
1735
  return new ctor({
1724
1736
  start : args.start,
1725
1737
  end : body.end,
@@ -2111,11 +2123,6 @@ function parse($TEXT, options) {
2111
2123
  }
2112
2124
 
2113
2125
  function _yield_expression() {
2114
- // Previous token must be keyword yield and not be interpret as an identifier
2115
- if (!is_in_generator()) {
2116
- croak("Unexpected yield expression outside generator function",
2117
- S.prev.line, S.prev.col, S.prev.pos);
2118
- }
2119
2126
  var start = S.token;
2120
2127
  var star = false;
2121
2128
  var has_expression = true;
@@ -2130,10 +2137,12 @@ function parse($TEXT, options) {
2130
2137
  // Note 1: It isn't allowed for yield* to close without an expression
2131
2138
  // Note 2: If there is a nlb between yield and star, it is interpret as
2132
2139
  // yield <explicit undefined> <inserted automatic semicolon> *
2133
- if (can_insert_semicolon() ||
2134
- (is("punc") && PUNC_AFTER_EXPRESSION.has(S.token.value))) {
2140
+ if (
2141
+ can_insert_semicolon()
2142
+ || is("punc") && PUNC_AFTER_EXPRESSION.has(S.token.value)
2143
+ || is("template_cont")
2144
+ ) {
2135
2145
  has_expression = false;
2136
-
2137
2146
  } else if (is("operator", "*")) {
2138
2147
  star = true;
2139
2148
  next();
@@ -2354,7 +2363,12 @@ function parse($TEXT, options) {
2354
2363
  });
2355
2364
  break;
2356
2365
  case "big_int":
2357
- ret = new AST_BigInt({ start: tok, end: tok, value: tok.value });
2366
+ ret = new AST_BigInt({
2367
+ start: tok,
2368
+ end: tok,
2369
+ value: tok.value,
2370
+ raw: LATEST_RAW,
2371
+ });
2358
2372
  break;
2359
2373
  case "string":
2360
2374
  ret = new AST_String({
@@ -2618,7 +2632,7 @@ function parse($TEXT, options) {
2618
2632
 
2619
2633
  // Check property and fetch value
2620
2634
  if (!is("punc", ":")) {
2621
- var concise = concise_method_or_getset(name, start);
2635
+ var concise = object_or_class_property(name, start);
2622
2636
  if (concise) {
2623
2637
  a.push(concise);
2624
2638
  continue;
@@ -2653,7 +2667,7 @@ function parse($TEXT, options) {
2653
2667
  const kv = new AST_ObjectKeyVal({
2654
2668
  start: start,
2655
2669
  quote: start.quote,
2656
- key: name instanceof AST_Node ? name : "" + name,
2670
+ key: name,
2657
2671
  value: value,
2658
2672
  end: prev()
2659
2673
  });
@@ -2664,7 +2678,7 @@ function parse($TEXT, options) {
2664
2678
  });
2665
2679
 
2666
2680
  function class_(KindOfClass, is_export_default) {
2667
- var start, method, class_name, extends_, a = [];
2681
+ var start, method, class_name, extends_, properties = [];
2668
2682
 
2669
2683
  S.input.push_directives_stack(); // Push directive stack, but not scope stack
2670
2684
  S.input.add_directive("use strict");
@@ -2693,9 +2707,9 @@ function parse($TEXT, options) {
2693
2707
  while (is("punc", ";")) { next(); } // Leading semicolons are okay in class bodies.
2694
2708
  while (!is("punc", "}")) {
2695
2709
  start = S.token;
2696
- method = concise_method_or_getset(as_property_name(), start, true);
2710
+ method = object_or_class_property(as_property_name(), start, true);
2697
2711
  if (!method) { unexpected(); }
2698
- a.push(method);
2712
+ properties.push(method);
2699
2713
  while (is("punc", ";")) { next(); }
2700
2714
  }
2701
2715
  // mark in class feild,
@@ -2709,19 +2723,15 @@ function parse($TEXT, options) {
2709
2723
  start: start,
2710
2724
  name: class_name,
2711
2725
  extends: extends_,
2712
- properties: a,
2726
+ properties: properties,
2713
2727
  end: prev(),
2714
2728
  });
2715
2729
  }
2716
2730
 
2717
- function concise_method_or_getset(name, start, is_class) {
2718
- const get_symbol_ast = (name, SymbolClass = AST_SymbolMethod) => {
2719
- if (typeof name === "string" || typeof name === "number") {
2720
- return new SymbolClass({
2721
- start,
2722
- name: "" + name,
2723
- end: prev()
2724
- });
2731
+ function object_or_class_property(name, start, is_class) {
2732
+ const get_symbol_ast = (name, SymbolClass) => {
2733
+ if (typeof name === "string") {
2734
+ return new SymbolClass({ start, name, end: prev() });
2725
2735
  } else if (name === null) {
2726
2736
  unexpected();
2727
2737
  }
@@ -2769,7 +2779,7 @@ function parse($TEXT, options) {
2769
2779
  ? AST_ObjectGetter
2770
2780
  : AST_ObjectSetter;
2771
2781
 
2772
- name = get_symbol_ast(name);
2782
+ name = get_symbol_ast(name, AST_SymbolMethod);
2773
2783
  return annotate(new AccessorClass({
2774
2784
  start,
2775
2785
  static: is_static,
@@ -2786,7 +2796,7 @@ function parse($TEXT, options) {
2786
2796
  return annotate(new AccessorClass({
2787
2797
  start,
2788
2798
  static: is_static,
2789
- key: get_symbol_ast(name),
2799
+ key: get_symbol_ast(name, AST_SymbolMethod),
2790
2800
  value: create_accessor(),
2791
2801
  end: prev(),
2792
2802
  }));
@@ -2794,15 +2804,13 @@ function parse($TEXT, options) {
2794
2804
  }
2795
2805
 
2796
2806
  if (is("punc", "(")) {
2797
- name = get_symbol_ast(name);
2807
+ name = get_symbol_ast(name, AST_SymbolMethod);
2798
2808
  const AST_MethodVariant = is_private
2799
2809
  ? AST_PrivateMethod
2800
2810
  : AST_ConciseMethod;
2801
2811
  var node = new AST_MethodVariant({
2802
2812
  start : start,
2803
2813
  static : is_static,
2804
- is_generator: is_generator,
2805
- async : is_async,
2806
2814
  key : name,
2807
2815
  quote : name instanceof AST_SymbolMethod ?
2808
2816
  property_token.quote : undefined,
@@ -2813,13 +2821,17 @@ function parse($TEXT, options) {
2813
2821
  }
2814
2822
 
2815
2823
  if (is_class) {
2816
- const key = get_symbol_ast(name, AST_SymbolClassProperty);
2817
- const quote = key instanceof AST_SymbolClassProperty
2818
- ? property_token.quote
2819
- : undefined;
2824
+ const AST_SymbolVariant = is_private
2825
+ ? AST_SymbolPrivateProperty
2826
+ : AST_SymbolClassProperty;
2820
2827
  const AST_ClassPropertyVariant = is_private
2821
2828
  ? AST_ClassPrivateProperty
2822
2829
  : AST_ClassProperty;
2830
+
2831
+ const key = get_symbol_ast(name, AST_SymbolVariant);
2832
+ const quote = key instanceof AST_SymbolClassProperty
2833
+ ? property_token.quote
2834
+ : undefined;
2823
2835
  if (is("operator", "=")) {
2824
2836
  next();
2825
2837
  return annotate(
@@ -2835,9 +2847,13 @@ function parse($TEXT, options) {
2835
2847
  } else if (
2836
2848
  is("name")
2837
2849
  || is("privatename")
2850
+ || is("punc", "[")
2838
2851
  || is("operator", "*")
2839
2852
  || is("punc", ";")
2840
2853
  || is("punc", "}")
2854
+ || is("string")
2855
+ || is("num")
2856
+ || is("big_int")
2841
2857
  ) {
2842
2858
  return annotate(
2843
2859
  new AST_ClassPropertyVariant({
@@ -2871,8 +2887,11 @@ function parse($TEXT, options) {
2871
2887
  return new AST_ClassStaticBlock({ start, body, end: prev() });
2872
2888
  }
2873
2889
 
2874
- function maybe_import_assertion() {
2875
- if (is("name", "assert") && !has_newline_before(S.token)) {
2890
+ function maybe_import_attributes() {
2891
+ if (
2892
+ (is("keyword", "with") || is("name", "assert"))
2893
+ && !has_newline_before(S.token)
2894
+ ) {
2876
2895
  next();
2877
2896
  return object_or_destructuring_();
2878
2897
  }
@@ -2903,7 +2922,7 @@ function parse($TEXT, options) {
2903
2922
  }
2904
2923
  next();
2905
2924
 
2906
- const assert_clause = maybe_import_assertion();
2925
+ const attributes = maybe_import_attributes();
2907
2926
 
2908
2927
  return new AST_Import({
2909
2928
  start,
@@ -2915,7 +2934,7 @@ function parse($TEXT, options) {
2915
2934
  quote: mod_str.quote,
2916
2935
  end: mod_str,
2917
2936
  }),
2918
- assert_clause,
2937
+ attributes,
2919
2938
  end: S.token,
2920
2939
  });
2921
2940
  }
@@ -2959,10 +2978,12 @@ function parse($TEXT, options) {
2959
2978
  } else {
2960
2979
  foreign_name = make_symbol(foreign_type, S.token.quote);
2961
2980
  }
2962
- } else if (is_import) {
2963
- name = new type(foreign_name);
2964
2981
  } else {
2965
- foreign_name = new foreign_type(name);
2982
+ if (is_import) {
2983
+ name = new type(foreign_name);
2984
+ } else {
2985
+ foreign_name = new foreign_type(name);
2986
+ }
2966
2987
  }
2967
2988
 
2968
2989
  return new AST_NameMapping({
@@ -3048,7 +3069,7 @@ function parse($TEXT, options) {
3048
3069
  }
3049
3070
  next();
3050
3071
 
3051
- const assert_clause = maybe_import_assertion();
3072
+ const attributes = maybe_import_attributes();
3052
3073
 
3053
3074
  return new AST_Export({
3054
3075
  start: start,
@@ -3061,7 +3082,7 @@ function parse($TEXT, options) {
3061
3082
  end: mod_str,
3062
3083
  }),
3063
3084
  end: prev(),
3064
- assert_clause
3085
+ attributes
3065
3086
  });
3066
3087
  } else {
3067
3088
  return new AST_Export({
@@ -3107,7 +3128,7 @@ function parse($TEXT, options) {
3107
3128
  exported_value: exported_value,
3108
3129
  exported_definition: exported_definition,
3109
3130
  end: prev(),
3110
- assert_clause: null
3131
+ attributes: null
3111
3132
  });
3112
3133
  }
3113
3134
 
@@ -3133,12 +3154,14 @@ function parse($TEXT, options) {
3133
3154
  case "name":
3134
3155
  case "privatename":
3135
3156
  case "string":
3136
- case "num":
3137
- case "big_int":
3138
3157
  case "keyword":
3139
3158
  case "atom":
3140
3159
  next();
3141
3160
  return tmp.value;
3161
+ case "num":
3162
+ case "big_int":
3163
+ next();
3164
+ return "" + tmp.value;
3142
3165
  default:
3143
3166
  unexpected(tmp);
3144
3167
  }
@@ -3282,6 +3305,7 @@ function parse($TEXT, options) {
3282
3305
  return subscripts(call, true, is_chain);
3283
3306
  }
3284
3307
 
3308
+ // Optional chain
3285
3309
  if (is("punc", "?.")) {
3286
3310
  next();
3287
3311
 
@@ -5097,13 +5121,13 @@ var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", function AST_N
5097
5121
 
5098
5122
  var AST_Import = DEFNODE(
5099
5123
  "Import",
5100
- "imported_name imported_names module_name assert_clause",
5124
+ "imported_name imported_names module_name attributes",
5101
5125
  function AST_Import(props) {
5102
5126
  if (props) {
5103
5127
  this.imported_name = props.imported_name;
5104
5128
  this.imported_names = props.imported_names;
5105
5129
  this.module_name = props.module_name;
5106
- this.assert_clause = props.assert_clause;
5130
+ this.attributes = props.attributes;
5107
5131
  this.start = props.start;
5108
5132
  this.end = props.end;
5109
5133
  }
@@ -5116,7 +5140,7 @@ var AST_Import = DEFNODE(
5116
5140
  imported_name: "[AST_SymbolImport] The name of the variable holding the module's default export.",
5117
5141
  imported_names: "[AST_NameMapping*] The names of non-default imported variables",
5118
5142
  module_name: "[AST_String] String literal describing where this module came from",
5119
- assert_clause: "[AST_Object?] The import assertion"
5143
+ attributes: "[AST_Object?] The import attributes (with {...})"
5120
5144
  },
5121
5145
  _walk: function(visitor) {
5122
5146
  return visitor._visit(this, function() {
@@ -5155,7 +5179,7 @@ var AST_ImportMeta = DEFNODE("ImportMeta", null, function AST_ImportMeta(props)
5155
5179
 
5156
5180
  var AST_Export = DEFNODE(
5157
5181
  "Export",
5158
- "exported_definition exported_value is_default exported_names module_name assert_clause",
5182
+ "exported_definition exported_value is_default exported_names module_name attributes",
5159
5183
  function AST_Export(props) {
5160
5184
  if (props) {
5161
5185
  this.exported_definition = props.exported_definition;
@@ -5163,7 +5187,7 @@ var AST_Export = DEFNODE(
5163
5187
  this.is_default = props.is_default;
5164
5188
  this.exported_names = props.exported_names;
5165
5189
  this.module_name = props.module_name;
5166
- this.assert_clause = props.assert_clause;
5190
+ this.attributes = props.attributes;
5167
5191
  this.start = props.start;
5168
5192
  this.end = props.end;
5169
5193
  }
@@ -5178,7 +5202,7 @@ var AST_Export = DEFNODE(
5178
5202
  exported_names: "[AST_NameMapping*?] List of exported names",
5179
5203
  module_name: "[AST_String?] Name of the file to load exports from",
5180
5204
  is_default: "[Boolean] Whether this is the default exported value of this module",
5181
- assert_clause: "[AST_Object?] The import assertion"
5205
+ attributes: "[AST_Object?] The import attributes"
5182
5206
  },
5183
5207
  _walk: function (visitor) {
5184
5208
  return visitor._visit(this, function () {
@@ -5625,6 +5649,11 @@ var AST_Object = DEFNODE("Object", "properties", function AST_Object(props) {
5625
5649
  },
5626
5650
  });
5627
5651
 
5652
+ /* -----[ OBJECT/CLASS PROPERTIES ]----- */
5653
+
5654
+ /**
5655
+ * Everything inside the curly braces of an object/class is a subclass of AST_ObjectProperty, except for AST_ClassStaticBlock.
5656
+ **/
5628
5657
  var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", function AST_ObjectProperty(props) {
5629
5658
  if (props) {
5630
5659
  this.key = props.key;
@@ -5639,7 +5668,7 @@ var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", function AST_Obj
5639
5668
  $documentation: "Base class for literal object properties",
5640
5669
  $propdoc: {
5641
5670
  key: "[string|AST_Node] property name. For ObjectKeyVal this is a string. For getters, setters and computed property this is an AST_Node.",
5642
- value: "[AST_Node] property value. For getters and setters this is an AST_Accessor."
5671
+ value: "[AST_Node] property value. For getters, setters and methods this is an AST_Accessor."
5643
5672
  },
5644
5673
  _walk: function(visitor) {
5645
5674
  return visitor._visit(this, function() {
@@ -5651,7 +5680,7 @@ var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", function AST_Obj
5651
5680
  _children_backwards(push) {
5652
5681
  push(this.value);
5653
5682
  if (this.key instanceof AST_Node) push(this.key);
5654
- }
5683
+ },
5655
5684
  });
5656
5685
 
5657
5686
  var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", function AST_ObjectKeyVal(props) {
@@ -5761,45 +5790,32 @@ var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", function AST_Obje
5761
5790
  }
5762
5791
  }, AST_ObjectProperty);
5763
5792
 
5764
- var AST_ConciseMethod = DEFNODE(
5765
- "ConciseMethod",
5766
- "quote static is_generator async",
5767
- function AST_ConciseMethod(props) {
5768
- if (props) {
5769
- this.quote = props.quote;
5770
- this.static = props.static;
5771
- this.is_generator = props.is_generator;
5772
- this.async = props.async;
5773
- this.key = props.key;
5774
- this.value = props.value;
5775
- this.start = props.start;
5776
- this.end = props.end;
5777
- this._annotations = props._annotations;
5778
- }
5793
+ var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static", function AST_ConciseMethod(props) {
5794
+ if (props) {
5795
+ this.quote = props.quote;
5796
+ this.static = props.static;
5797
+ this.key = props.key;
5798
+ this.value = props.value;
5799
+ this.start = props.start;
5800
+ this.end = props.end;
5801
+ this._annotations = props._annotations;
5802
+ }
5779
5803
 
5780
- this.flags = 0;
5781
- },
5782
- {
5783
- $propdoc: {
5784
- quote: "[string|undefined] the original quote character, if any",
5785
- static: "[boolean] is this method static (classes only)",
5786
- is_generator: "[boolean] is this a generator method",
5787
- async: "[boolean] is this method async",
5788
- },
5789
- $documentation: "An ES6 concise method inside an object or class",
5790
- computed_key() {
5791
- return !(this.key instanceof AST_SymbolMethod);
5792
- }
5804
+ this.flags = 0;
5805
+ }, {
5806
+ $propdoc: {
5807
+ quote: "[string|undefined] the original quote character, if any",
5808
+ static: "[boolean] is this method static (classes only)",
5793
5809
  },
5794
- AST_ObjectProperty
5795
- );
5810
+ $documentation: "An ES6 concise method inside an object or class",
5811
+ computed_key() {
5812
+ return !(this.key instanceof AST_SymbolMethod);
5813
+ }
5814
+ }, AST_ObjectProperty);
5796
5815
 
5797
- var AST_PrivateMethod = DEFNODE("PrivateMethod", "", function AST_PrivateMethod(props) {
5816
+ var AST_PrivateMethod = DEFNODE("PrivateMethod", "static", function AST_PrivateMethod(props) {
5798
5817
  if (props) {
5799
- this.quote = props.quote;
5800
5818
  this.static = props.static;
5801
- this.is_generator = props.is_generator;
5802
- this.async = props.async;
5803
5819
  this.key = props.key;
5804
5820
  this.value = props.value;
5805
5821
  this.start = props.start;
@@ -5809,7 +5825,13 @@ var AST_PrivateMethod = DEFNODE("PrivateMethod", "", function AST_PrivateMethod(
5809
5825
  this.flags = 0;
5810
5826
  }, {
5811
5827
  $documentation: "A private class method inside a class",
5812
- }, AST_ConciseMethod);
5828
+ $propdoc: {
5829
+ static: "[boolean] is this a static private method",
5830
+ },
5831
+ computed_key() {
5832
+ return false;
5833
+ },
5834
+ }, AST_ObjectProperty);
5813
5835
 
5814
5836
  var AST_Class = DEFNODE("Class", "name extends properties", function AST_Class(props) {
5815
5837
  if (props) {
@@ -5833,7 +5855,7 @@ var AST_Class = DEFNODE("Class", "name extends properties", function AST_Class(p
5833
5855
  $propdoc: {
5834
5856
  name: "[AST_SymbolClass|AST_SymbolDefClass?] optional class name.",
5835
5857
  extends: "[AST_Node]? optional parent class",
5836
- properties: "[AST_ObjectProperty*] array of properties"
5858
+ properties: "[AST_ObjectProperty|AST_ClassStaticBlock]* array of properties or static blocks"
5837
5859
  },
5838
5860
  $documentation: "An ES6 class",
5839
5861
  _walk: function(visitor) {
@@ -5868,7 +5890,10 @@ var AST_Class = DEFNODE("Class", "name extends properties", function AST_Class(p
5868
5890
  prop.key._walk(visitor);
5869
5891
  visitor.pop();
5870
5892
  }
5871
- if ((prop instanceof AST_ClassPrivateProperty || prop instanceof AST_ClassProperty) && prop.static && prop.value) {
5893
+ if (
5894
+ prop instanceof AST_ClassPrivateProperty && prop.static && prop.value
5895
+ || prop instanceof AST_ClassProperty && prop.static && prop.value
5896
+ ) {
5872
5897
  visitor.push(prop);
5873
5898
  prop.value._walk(visitor);
5874
5899
  visitor.pop();
@@ -5878,9 +5903,15 @@ var AST_Class = DEFNODE("Class", "name extends properties", function AST_Class(p
5878
5903
  /** go through the bits that are executed later, when the class is `new`'d or a static method is called */
5879
5904
  visit_deferred_class_parts(visitor) {
5880
5905
  this.properties.forEach((prop) => {
5881
- if (prop instanceof AST_ConciseMethod) {
5906
+ if (
5907
+ prop instanceof AST_ConciseMethod
5908
+ || prop instanceof AST_PrivateMethod
5909
+ ) {
5882
5910
  prop.walk(visitor);
5883
- } else if (prop instanceof AST_ClassProperty && !prop.static && prop.value) {
5911
+ } else if (
5912
+ prop instanceof AST_ClassProperty && !prop.static && prop.value
5913
+ || prop instanceof AST_ClassPrivateProperty && !prop.static && prop.value
5914
+ ) {
5884
5915
  visitor.push(prop);
5885
5916
  prop.value._walk(visitor);
5886
5917
  visitor.pop();
@@ -5945,7 +5976,6 @@ var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", function AST_Cl
5945
5976
  var AST_ClassPrivateProperty = DEFNODE("ClassPrivateProperty", "", function AST_ClassPrivateProperty(props) {
5946
5977
  if (props) {
5947
5978
  this.static = props.static;
5948
- this.quote = props.quote;
5949
5979
  this.key = props.key;
5950
5980
  this.value = props.value;
5951
5981
  this.start = props.start;
@@ -5955,7 +5985,19 @@ var AST_ClassPrivateProperty = DEFNODE("ClassPrivateProperty", "", function AST_
5955
5985
  this.flags = 0;
5956
5986
  }, {
5957
5987
  $documentation: "A class property for a private property",
5958
- }, AST_ClassProperty);
5988
+ _walk: function(visitor) {
5989
+ return visitor._visit(this, function() {
5990
+ if (this.value instanceof AST_Node)
5991
+ this.value._walk(visitor);
5992
+ });
5993
+ },
5994
+ _children_backwards(push) {
5995
+ if (this.value instanceof AST_Node) push(this.value);
5996
+ },
5997
+ computed_key() {
5998
+ return false;
5999
+ },
6000
+ }, AST_ObjectProperty);
5959
6001
 
5960
6002
  var AST_PrivateIn = DEFNODE("PrivateIn", "key value", function AST_PrivateIn(props) {
5961
6003
  if (props) {
@@ -6022,7 +6064,9 @@ var AST_ClassStaticBlock = DEFNODE("ClassStaticBlock", "body block_scope", funct
6022
6064
  while (i--) push(this.body[i]);
6023
6065
  },
6024
6066
  clone: clone_block_scope,
6025
- computed_key: () => false
6067
+ computed_key() {
6068
+ return false;
6069
+ },
6026
6070
  }, AST_Scope);
6027
6071
 
6028
6072
  var AST_ClassExpression = DEFNODE("ClassExpression", null, function AST_ClassExpression(props) {
@@ -6291,12 +6335,12 @@ var AST_SymbolImport = DEFNODE("SymbolImport", null, function AST_SymbolImport(p
6291
6335
  $documentation: "Symbol referring to an imported name",
6292
6336
  }, AST_SymbolBlockDeclaration);
6293
6337
 
6294
- var AST_SymbolImportForeign = DEFNODE("SymbolImportForeign", null, function AST_SymbolImportForeign(props) {
6338
+ var AST_SymbolImportForeign = DEFNODE("SymbolImportForeign", "quote", function AST_SymbolImportForeign(props) {
6295
6339
  if (props) {
6340
+ this.quote = props.quote;
6296
6341
  this.scope = props.scope;
6297
6342
  this.name = props.name;
6298
6343
  this.thedef = props.thedef;
6299
- this.quote = props.quote;
6300
6344
  this.start = props.start;
6301
6345
  this.end = props.end;
6302
6346
  }
@@ -6343,12 +6387,12 @@ var AST_SymbolRef = DEFNODE("SymbolRef", null, function AST_SymbolRef(props) {
6343
6387
  $documentation: "Reference to some symbol (not definition/declaration)",
6344
6388
  }, AST_Symbol);
6345
6389
 
6346
- var AST_SymbolExport = DEFNODE("SymbolExport", null, function AST_SymbolExport(props) {
6390
+ var AST_SymbolExport = DEFNODE("SymbolExport", "quote", function AST_SymbolExport(props) {
6347
6391
  if (props) {
6392
+ this.quote = props.quote;
6348
6393
  this.scope = props.scope;
6349
6394
  this.name = props.name;
6350
6395
  this.thedef = props.thedef;
6351
- this.quote = props.quote;
6352
6396
  this.start = props.start;
6353
6397
  this.end = props.end;
6354
6398
  }
@@ -6358,12 +6402,12 @@ var AST_SymbolExport = DEFNODE("SymbolExport", null, function AST_SymbolExport(p
6358
6402
  $documentation: "Symbol referring to a name to export",
6359
6403
  }, AST_SymbolRef);
6360
6404
 
6361
- var AST_SymbolExportForeign = DEFNODE("SymbolExportForeign", null, function AST_SymbolExportForeign(props) {
6405
+ var AST_SymbolExportForeign = DEFNODE("SymbolExportForeign", "quote", function AST_SymbolExportForeign(props) {
6362
6406
  if (props) {
6407
+ this.quote = props.quote;
6363
6408
  this.scope = props.scope;
6364
6409
  this.name = props.name;
6365
6410
  this.thedef = props.thedef;
6366
- this.quote = props.quote;
6367
6411
  this.start = props.start;
6368
6412
  this.end = props.end;
6369
6413
  }
@@ -6478,9 +6522,10 @@ var AST_Number = DEFNODE("Number", "value raw", function AST_Number(props) {
6478
6522
  }
6479
6523
  }, AST_Constant);
6480
6524
 
6481
- var AST_BigInt = DEFNODE("BigInt", "value", function AST_BigInt(props) {
6525
+ var AST_BigInt = DEFNODE("BigInt", "value raw", function AST_BigInt(props) {
6482
6526
  if (props) {
6483
6527
  this.value = props.value;
6528
+ this.raw = props.raw;
6484
6529
  this.start = props.start;
6485
6530
  this.end = props.end;
6486
6531
  }
@@ -6489,7 +6534,8 @@ var AST_BigInt = DEFNODE("BigInt", "value", function AST_BigInt(props) {
6489
6534
  }, {
6490
6535
  $documentation: "A big int literal",
6491
6536
  $propdoc: {
6492
- value: "[string] big int value"
6537
+ value: "[string] big int value, represented as a string",
6538
+ raw: "[string] the original format preserved"
6493
6539
  }
6494
6540
  }, AST_Constant);
6495
6541
 
@@ -6772,6 +6818,28 @@ class TreeWalker {
6772
6818
  }
6773
6819
  }
6774
6820
 
6821
+ is_within_loop() {
6822
+ let i = this.stack.length - 1;
6823
+ let child = this.stack[i];
6824
+ while (i--) {
6825
+ const node = this.stack[i];
6826
+
6827
+ if (node instanceof AST_Lambda) return false;
6828
+ if (
6829
+ node instanceof AST_IterationStatement
6830
+ // exclude for-loop bits that only run once
6831
+ && !((node instanceof AST_For) && child === node.init)
6832
+ && !((node instanceof AST_ForIn || node instanceof AST_ForOf) && child === node.object)
6833
+ ) {
6834
+ return true;
6835
+ }
6836
+
6837
+ child = node;
6838
+ }
6839
+
6840
+ return false;
6841
+ }
6842
+
6775
6843
  find_scope() {
6776
6844
  var stack = this.stack;
6777
6845
  for (var i = stack.length; --i >= 0;) {
@@ -7147,6 +7215,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7147
7215
  body[i] = new AST_Directive({
7148
7216
  start: body[i].start,
7149
7217
  end: body[i].end,
7218
+ quote: '"',
7150
7219
  value: body[i].body.value
7151
7220
  });
7152
7221
  } else {
@@ -7157,23 +7226,23 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7157
7226
  return body;
7158
7227
  };
7159
7228
 
7160
- const assert_clause_from_moz = (assertions) => {
7161
- if (assertions && assertions.length > 0) {
7229
+ function import_attributes_from_moz(attributes) {
7230
+ if (attributes && attributes.length > 0) {
7162
7231
  return new AST_Object({
7163
- start: my_start_token(assertions),
7164
- end: my_end_token(assertions),
7165
- properties: assertions.map((assertion_kv) =>
7232
+ start: my_start_token(attributes),
7233
+ end: my_end_token(attributes),
7234
+ properties: attributes.map((attr) =>
7166
7235
  new AST_ObjectKeyVal({
7167
- start: my_start_token(assertion_kv),
7168
- end: my_end_token(assertion_kv),
7169
- key: assertion_kv.key.name || assertion_kv.key.value,
7170
- value: from_moz(assertion_kv.value)
7236
+ start: my_start_token(attr),
7237
+ end: my_end_token(attr),
7238
+ key: attr.key.name || attr.key.value,
7239
+ value: from_moz(attr.value)
7171
7240
  })
7172
7241
  )
7173
7242
  });
7174
7243
  }
7175
7244
  return null;
7176
- };
7245
+ }
7177
7246
 
7178
7247
  var MOZ_TO_ME = {
7179
7248
  Program: function(M) {
@@ -7270,8 +7339,8 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7270
7339
  return new AST_Defun({
7271
7340
  start: my_start_token(M),
7272
7341
  end: my_end_token(M),
7273
- name: from_moz(M.id),
7274
- argnames: M.params.map(from_moz),
7342
+ name: M.id && from_moz_symbol(AST_SymbolDefun, M.id),
7343
+ argnames: M.params.map(M => from_moz_pattern(M, AST_SymbolFunarg)),
7275
7344
  is_generator: M.generator,
7276
7345
  async: M.async,
7277
7346
  body: normalize_directives(from_moz(M.body).body)
@@ -7279,15 +7348,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7279
7348
  },
7280
7349
 
7281
7350
  FunctionExpression: function(M) {
7282
- return new AST_Function({
7283
- start: my_start_token(M),
7284
- end: my_end_token(M),
7285
- name: from_moz(M.id),
7286
- argnames: M.params.map(from_moz),
7287
- is_generator: M.generator,
7288
- async: M.async,
7289
- body: normalize_directives(from_moz(M.body).body)
7290
- });
7351
+ return from_moz_lambda(M, /*is_method=*/false);
7291
7352
  },
7292
7353
 
7293
7354
  ArrowFunctionExpression: function(M) {
@@ -7297,7 +7358,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7297
7358
  return new AST_Arrow({
7298
7359
  start: my_start_token(M),
7299
7360
  end: my_end_token(M),
7300
- argnames: M.params.map(from_moz),
7361
+ argnames: M.params.map(p => from_moz_pattern(p, AST_SymbolFunarg)),
7301
7362
  body,
7302
7363
  async: M.async,
7303
7364
  });
@@ -7326,57 +7387,48 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7326
7387
  },
7327
7388
 
7328
7389
  Property: function(M) {
7329
- var key = M.key;
7330
- var args = {
7331
- start : my_start_token(key || M.value),
7332
- end : my_end_token(M.value),
7333
- key : key.type == "Identifier" ? key.name : key.value,
7334
- value : from_moz(M.value)
7335
- };
7336
- if (M.computed) {
7337
- args.key = from_moz(M.key);
7338
- }
7339
- if (M.method) {
7340
- args.is_generator = M.value.generator;
7341
- args.async = M.value.async;
7342
- if (!M.computed) {
7343
- args.key = new AST_SymbolMethod({ name: args.key });
7344
- } else {
7345
- args.key = from_moz(M.key);
7346
- }
7347
- return new AST_ConciseMethod(args);
7348
- }
7349
- if (M.kind == "init") {
7350
- if (key.type != "Identifier" && key.type != "Literal") {
7351
- args.key = from_moz(key);
7352
- }
7390
+ if (M.kind == "init" && !M.method) {
7391
+ var args = {
7392
+ start : my_start_token(M.key || M.value),
7393
+ end : my_end_token(M.value),
7394
+ key : M.computed
7395
+ ? from_moz(M.key)
7396
+ : M.key.name || String(M.key.value),
7397
+ quote : from_moz_quote(M.key, M.computed),
7398
+ static : false, // always an object
7399
+ value : from_moz(M.value)
7400
+ };
7401
+
7353
7402
  return new AST_ObjectKeyVal(args);
7354
- }
7355
- if (typeof args.key === "string" || typeof args.key === "number") {
7356
- args.key = new AST_SymbolMethod({
7357
- name: args.key
7358
- });
7359
- }
7360
- args.value = new AST_Accessor(args.value);
7361
- if (M.kind == "get") return new AST_ObjectGetter(args);
7362
- if (M.kind == "set") return new AST_ObjectSetter(args);
7363
- if (M.kind == "method") {
7364
- args.async = M.value.async;
7365
- args.is_generator = M.value.generator;
7366
- args.quote = M.computed ? "\"" : null;
7367
- return new AST_ConciseMethod(args);
7403
+ } else {
7404
+ var value = from_moz_lambda(M.value, /*is_method=*/true);
7405
+ var args = {
7406
+ start : my_start_token(M.key || M.value),
7407
+ end : my_end_token(M.value),
7408
+ key : M.computed
7409
+ ? from_moz(M.key)
7410
+ : from_moz_symbol(AST_SymbolMethod, M.key),
7411
+ quote : from_moz_quote(M.key, M.computed),
7412
+ static : false, // always an object
7413
+ value,
7414
+ };
7415
+
7416
+ if (M.kind == "get") return new AST_ObjectGetter(args);
7417
+ if (M.kind == "set") return new AST_ObjectSetter(args);
7418
+ if (M.method) return new AST_ConciseMethod(args);
7368
7419
  }
7369
7420
  },
7370
7421
 
7371
7422
  MethodDefinition: function(M) {
7372
7423
  const is_private = M.key.type === "PrivateIdentifier";
7373
- const key = M.computed ? from_moz(M.key) : new AST_SymbolMethod({ name: M.key.name || M.key.value });
7424
+ const key = M.computed ? from_moz(M.key) : new AST_SymbolMethod({ name: M.key.name || String(M.key.value) });
7374
7425
 
7375
7426
  var args = {
7376
7427
  start : my_start_token(M),
7377
7428
  end : my_end_token(M),
7378
7429
  key,
7379
- value : from_moz(M.value),
7430
+ quote : from_moz_quote(M.key, M.computed),
7431
+ value : from_moz_lambda(M.value, /*is_method=*/true),
7380
7432
  static : M.static,
7381
7433
  };
7382
7434
  if (M.kind == "get") {
@@ -7385,8 +7437,6 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7385
7437
  if (M.kind == "set") {
7386
7438
  return new (is_private ? AST_PrivateSetter : AST_ObjectSetter)(args);
7387
7439
  }
7388
- args.is_generator = M.value.generator;
7389
- args.async = M.value.async;
7390
7440
  return new (is_private ? AST_PrivateMethod : AST_ConciseMethod)(args);
7391
7441
  },
7392
7442
 
@@ -7401,6 +7451,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7401
7451
  return new AST_ClassProperty({
7402
7452
  start : my_start_token(M),
7403
7453
  end : my_end_token(M),
7454
+ quote : from_moz_quote(M.key, M.computed),
7404
7455
  key,
7405
7456
  value : from_moz(M.value),
7406
7457
  static : M.static,
@@ -7420,15 +7471,13 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7420
7471
  static : M.static,
7421
7472
  });
7422
7473
  } else {
7423
- if (M.key.type !== "Identifier") {
7424
- throw new Error("Non-Identifier key in PropertyDefinition");
7425
- }
7426
- key = from_moz(M.key);
7474
+ key = from_moz_symbol(AST_SymbolClassProperty, M.key);
7427
7475
  }
7428
7476
 
7429
7477
  return new AST_ClassProperty({
7430
7478
  start : my_start_token(M),
7431
7479
  end : my_end_token(M),
7480
+ quote : from_moz_quote(M.key, M.computed),
7432
7481
  key,
7433
7482
  value : from_moz(M.value),
7434
7483
  static : M.static,
@@ -7520,11 +7569,30 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7520
7569
  },
7521
7570
 
7522
7571
  VariableDeclaration: function(M) {
7523
- return new (M.kind === "const" ? AST_Const :
7524
- M.kind === "let" ? AST_Let : AST_Var)({
7572
+ let decl_type;
7573
+ let sym_type;
7574
+ if (M.kind === "const") {
7575
+ decl_type = AST_Const;
7576
+ sym_type = AST_SymbolConst;
7577
+ } else if (M.kind === "let") {
7578
+ decl_type = AST_Let;
7579
+ sym_type = AST_SymbolLet;
7580
+ } else {
7581
+ decl_type = AST_Var;
7582
+ sym_type = AST_SymbolVar;
7583
+ }
7584
+ const definitions = M.declarations.map(M => {
7585
+ return new AST_VarDef({
7586
+ start: my_start_token(M),
7587
+ end: my_end_token(M),
7588
+ name: from_moz_pattern(M.id, sym_type),
7589
+ value: from_moz(M.init),
7590
+ });
7591
+ });
7592
+ return new decl_type({
7525
7593
  start : my_start_token(M),
7526
7594
  end : my_end_token(M),
7527
- definitions : M.declarations.map(from_moz)
7595
+ definitions : definitions,
7528
7596
  });
7529
7597
  },
7530
7598
 
@@ -7545,7 +7613,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7545
7613
  imported_name: imported_name,
7546
7614
  imported_names : imported_names,
7547
7615
  module_name : from_moz(M.source),
7548
- assert_clause: assert_clause_from_moz(M.assertions)
7616
+ attributes: import_attributes_from_moz(M.attributes || M.assertions)
7549
7617
  });
7550
7618
  },
7551
7619
 
@@ -7553,13 +7621,13 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7553
7621
  return new AST_NameMapping({
7554
7622
  start: my_start_token(M),
7555
7623
  end: my_end_token(M),
7556
- foreign_name: from_moz(M.imported),
7557
- name: from_moz(M.local)
7624
+ foreign_name: from_moz_symbol(AST_SymbolImportForeign, M.imported, M.imported.type === "Literal"),
7625
+ name: from_moz_symbol(AST_SymbolImport, M.local)
7558
7626
  });
7559
7627
  },
7560
7628
 
7561
7629
  ImportDefaultSpecifier: function(M) {
7562
- return from_moz(M.local);
7630
+ return from_moz_symbol(AST_SymbolImport, M.local);
7563
7631
  },
7564
7632
 
7565
7633
  ImportNamespaceSpecifier: function(M) {
@@ -7567,11 +7635,15 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7567
7635
  start: my_start_token(M),
7568
7636
  end: my_end_token(M),
7569
7637
  foreign_name: new AST_SymbolImportForeign({ name: "*" }),
7570
- name: from_moz(M.local)
7638
+ name: from_moz_symbol(AST_SymbolImport, M.local)
7571
7639
  });
7572
7640
  },
7573
7641
 
7574
7642
  ImportExpression: function(M) {
7643
+ const args = [from_moz(M.source)];
7644
+ if (M.options) {
7645
+ args.push(from_moz(M.options));
7646
+ }
7575
7647
  return new AST_Call({
7576
7648
  start: my_start_token(M),
7577
7649
  end: my_end_token(M),
@@ -7580,37 +7652,51 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7580
7652
  name: "import"
7581
7653
  }),
7582
7654
  optional: false,
7583
- args: [from_moz(M.source)]
7655
+ args
7584
7656
  });
7585
7657
  },
7586
7658
 
7587
7659
  ExportAllDeclaration: function(M) {
7588
- var foreign_name = M.exported == null ?
7660
+ var foreign_name = M.exported == null ?
7589
7661
  new AST_SymbolExportForeign({ name: "*" }) :
7590
- from_moz(M.exported);
7662
+ from_moz_symbol(AST_SymbolExportForeign, M.exported, M.exported.type === "Literal");
7591
7663
  return new AST_Export({
7592
7664
  start: my_start_token(M),
7593
7665
  end: my_end_token(M),
7594
7666
  exported_names: [
7595
7667
  new AST_NameMapping({
7596
- name: new AST_SymbolExportForeign({ name: "*" }),
7668
+ start: my_start_token(M),
7669
+ end: my_end_token(M),
7670
+ name: new AST_SymbolExport({ name: "*" }),
7597
7671
  foreign_name: foreign_name
7598
7672
  })
7599
7673
  ],
7600
7674
  module_name: from_moz(M.source),
7601
- assert_clause: assert_clause_from_moz(M.assertions)
7675
+ attributes: import_attributes_from_moz(M.attributes || M.assertions)
7602
7676
  });
7603
7677
  },
7604
7678
 
7605
7679
  ExportNamedDeclaration: function(M) {
7606
- return new AST_Export({
7607
- start: my_start_token(M),
7608
- end: my_end_token(M),
7609
- exported_definition: from_moz(M.declaration),
7610
- exported_names: M.specifiers && M.specifiers.length ? M.specifiers.map(from_moz) : null,
7611
- module_name: from_moz(M.source),
7612
- assert_clause: assert_clause_from_moz(M.assertions)
7613
- });
7680
+ if (M.declaration) {
7681
+ // export const, export function, ...
7682
+ return new AST_Export({
7683
+ start: my_start_token(M),
7684
+ end: my_end_token(M),
7685
+ exported_definition: from_moz(M.declaration),
7686
+ exported_names: null,
7687
+ module_name: null,
7688
+ attributes: null,
7689
+ });
7690
+ } else {
7691
+ return new AST_Export({
7692
+ start: my_start_token(M),
7693
+ end: my_end_token(M),
7694
+ exported_definition: null,
7695
+ exported_names: M.specifiers && M.specifiers.length ? M.specifiers.map(from_moz) : [],
7696
+ module_name: from_moz(M.source),
7697
+ attributes: import_attributes_from_moz(M.attributes || M.assertions),
7698
+ });
7699
+ }
7614
7700
  },
7615
7701
 
7616
7702
  ExportDefaultDeclaration: function(M) {
@@ -7624,8 +7710,10 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7624
7710
 
7625
7711
  ExportSpecifier: function(M) {
7626
7712
  return new AST_NameMapping({
7627
- foreign_name: from_moz(M.exported),
7628
- name: from_moz(M.local)
7713
+ start: my_start_token(M),
7714
+ end: my_end_token(M),
7715
+ foreign_name: from_moz_symbol(AST_SymbolExportForeign, M.exported, M.exported.type === "Literal"),
7716
+ name: from_moz_symbol(AST_SymbolExport, M.local, M.local.type === "Literal"),
7629
7717
  });
7630
7718
  },
7631
7719
 
@@ -7654,27 +7742,13 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7654
7742
  const bi = typeof M.value === "bigint" ? M.value.toString() : M.bigint;
7655
7743
  if (typeof bi === "string") {
7656
7744
  args.value = bi;
7745
+ args.raw = M.raw;
7657
7746
  return new AST_BigInt(args);
7658
7747
  }
7659
7748
  if (val === null) return new AST_Null(args);
7660
7749
  switch (typeof val) {
7661
7750
  case "string":
7662
7751
  args.quote = "\"";
7663
- var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2];
7664
- if (p.type == "ImportSpecifier") {
7665
- args.name = val;
7666
- return new AST_SymbolImportForeign(args);
7667
- } else if (p.type == "ExportSpecifier") {
7668
- args.name = val;
7669
- if (M == p.exported) {
7670
- return new AST_SymbolExportForeign(args);
7671
- } else {
7672
- return new AST_SymbolExport(args);
7673
- }
7674
- } else if (p.type == "ExportAllDeclaration" && M == p.exported) {
7675
- args.name = val;
7676
- return new AST_SymbolExportForeign(args);
7677
- }
7678
7752
  args.value = val;
7679
7753
  return new AST_String(args);
7680
7754
  case "number":
@@ -7701,26 +7775,11 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7701
7775
  },
7702
7776
 
7703
7777
  Identifier: function(M) {
7704
- var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2];
7705
- return new ( p.type == "LabeledStatement" ? AST_Label
7706
- : p.type == "VariableDeclarator" && p.id === M ? (p.kind == "const" ? AST_SymbolConst : p.kind == "let" ? AST_SymbolLet : AST_SymbolVar)
7707
- : /Import.*Specifier/.test(p.type) ? (p.local === M ? AST_SymbolImport : AST_SymbolImportForeign)
7708
- : p.type == "ExportSpecifier" ? (p.local === M ? AST_SymbolExport : AST_SymbolExportForeign)
7709
- : p.type == "FunctionExpression" ? (p.id === M ? AST_SymbolLambda : AST_SymbolFunarg)
7710
- : p.type == "FunctionDeclaration" ? (p.id === M ? AST_SymbolDefun : AST_SymbolFunarg)
7711
- : p.type == "ArrowFunctionExpression" ? (p.params.includes(M)) ? AST_SymbolFunarg : AST_SymbolRef
7712
- : p.type == "ClassExpression" ? (p.id === M ? AST_SymbolClass : AST_SymbolRef)
7713
- : p.type == "Property" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolMethod)
7714
- : p.type == "PropertyDefinition" || p.type === "FieldDefinition" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolClassProperty)
7715
- : p.type == "ClassDeclaration" ? (p.id === M ? AST_SymbolDefClass : AST_SymbolRef)
7716
- : p.type == "MethodDefinition" ? (p.computed ? AST_SymbolRef : AST_SymbolMethod)
7717
- : p.type == "CatchClause" ? AST_SymbolCatch
7718
- : p.type == "BreakStatement" || p.type == "ContinueStatement" ? AST_LabelRef
7719
- : AST_SymbolRef)({
7720
- start : my_start_token(M),
7721
- end : my_end_token(M),
7722
- name : M.name
7723
- });
7778
+ return new AST_SymbolRef({
7779
+ start : my_start_token(M),
7780
+ end : my_end_token(M),
7781
+ name : M.name
7782
+ });
7724
7783
  },
7725
7784
 
7726
7785
  EmptyStatement: function(M) {
@@ -7749,19 +7808,28 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7749
7808
  },
7750
7809
 
7751
7810
  LabeledStatement: function(M) {
7752
- return new AST_LabeledStatement({
7753
- start: my_start_token(M),
7754
- end: my_end_token(M),
7755
- label: from_moz(M.label),
7756
- body: from_moz(M.body)
7757
- });
7811
+ try {
7812
+ const label = from_moz_symbol(AST_Label, M.label);
7813
+ FROM_MOZ_LABELS.push(label);
7814
+
7815
+ const stat = new AST_LabeledStatement({
7816
+ start: my_start_token(M),
7817
+ end: my_end_token(M),
7818
+ label,
7819
+ body: from_moz(M.body)
7820
+ });
7821
+
7822
+ return stat;
7823
+ } finally {
7824
+ FROM_MOZ_LABELS.pop();
7825
+ }
7758
7826
  },
7759
7827
 
7760
7828
  BreakStatement: function(M) {
7761
7829
  return new AST_Break({
7762
7830
  start: my_start_token(M),
7763
7831
  end: my_end_token(M),
7764
- label: from_moz(M.label)
7832
+ label: from_moz_label_ref(M.label),
7765
7833
  });
7766
7834
  },
7767
7835
 
@@ -7769,7 +7837,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7769
7837
  return new AST_Continue({
7770
7838
  start: my_start_token(M),
7771
7839
  end: my_end_token(M),
7772
- label: from_moz(M.label)
7840
+ label: from_moz_label_ref(M.label),
7773
7841
  });
7774
7842
  },
7775
7843
 
@@ -7881,20 +7949,11 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7881
7949
  });
7882
7950
  },
7883
7951
 
7884
- VariableDeclarator: function(M) {
7885
- return new AST_VarDef({
7886
- start: my_start_token(M),
7887
- end: my_end_token(M),
7888
- name: from_moz(M.id),
7889
- value: from_moz(M.init)
7890
- });
7891
- },
7892
-
7893
7952
  CatchClause: function(M) {
7894
7953
  return new AST_Catch({
7895
7954
  start: my_start_token(M),
7896
7955
  end: my_end_token(M),
7897
- argname: from_moz(M.param),
7956
+ argname: M.param ? from_moz_pattern(M.param, AST_SymbolCatch) : null,
7898
7957
  body: from_moz(M.body).body
7899
7958
  });
7900
7959
  },
@@ -7902,6 +7961,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7902
7961
  ThisExpression: function(M) {
7903
7962
  return new AST_This({
7904
7963
  start: my_start_token(M),
7964
+ name: "this",
7905
7965
  end: my_end_token(M)
7906
7966
  });
7907
7967
  },
@@ -7909,7 +7969,8 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7909
7969
  Super: function(M) {
7910
7970
  return new AST_Super({
7911
7971
  start: my_start_token(M),
7912
- end: my_end_token(M)
7972
+ end: my_end_token(M),
7973
+ name: "super",
7913
7974
  });
7914
7975
  },
7915
7976
 
@@ -7950,6 +8011,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7950
8011
  start: my_start_token(M),
7951
8012
  end: my_end_token(M),
7952
8013
  operator: M.operator,
8014
+ logical: M.operator === "??=" || M.operator === "&&=" || M.operator === "||=",
7953
8015
  left: from_moz(M.left),
7954
8016
  right: from_moz(M.right)
7955
8017
  });
@@ -8002,7 +8064,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8002
8064
  return new (M.type === "ClassDeclaration" ? AST_DefClass : AST_ClassExpression)({
8003
8065
  start : my_start_token(M),
8004
8066
  end : my_end_token(M),
8005
- name : from_moz(M.id),
8067
+ name : M.id && from_moz_symbol(M.type === "ClassDeclaration" ? AST_SymbolDefClass : AST_SymbolClass, M.id),
8006
8068
  extends : from_moz(M.superClass),
8007
8069
  properties: M.body.body.map(from_moz)
8008
8070
  });
@@ -8137,13 +8199,6 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8137
8199
  init: to_moz(M.value)
8138
8200
  };
8139
8201
  });
8140
- def_to_moz(AST_Catch, function To_Moz_CatchClause(M) {
8141
- return {
8142
- type: "CatchClause",
8143
- param: to_moz(M.argname),
8144
- body: to_moz_block(M)
8145
- };
8146
- });
8147
8202
 
8148
8203
  def_to_moz(AST_This, function To_Moz_ThisExpression() {
8149
8204
  return {
@@ -8155,30 +8210,6 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8155
8210
  type: "Super"
8156
8211
  };
8157
8212
  });
8158
- def_to_moz(AST_Binary, function To_Moz_BinaryExpression(M) {
8159
- return {
8160
- type: "BinaryExpression",
8161
- operator: M.operator,
8162
- left: to_moz(M.left),
8163
- right: to_moz(M.right)
8164
- };
8165
- });
8166
- def_to_moz(AST_Binary, function To_Moz_LogicalExpression(M) {
8167
- return {
8168
- type: "LogicalExpression",
8169
- operator: M.operator,
8170
- left: to_moz(M.left),
8171
- right: to_moz(M.right)
8172
- };
8173
- });
8174
- def_to_moz(AST_Assign, function To_Moz_AssignmentExpression(M) {
8175
- return {
8176
- type: "AssignmentExpression",
8177
- operator: M.operator,
8178
- left: to_moz(M.left),
8179
- right: to_moz(M.right)
8180
- };
8181
- });
8182
8213
  def_to_moz(AST_Conditional, function To_Moz_ConditionalExpression(M) {
8183
8214
  return {
8184
8215
  type: "ConditionalExpression",
@@ -8196,10 +8227,11 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8196
8227
  });
8197
8228
  def_to_moz(AST_Call, function To_Moz_CallExpression(M) {
8198
8229
  if (M.expression instanceof AST_SymbolRef && M.expression.name === "import") {
8199
- const [source] = M.args.map(to_moz);
8230
+ const [source, options] = M.args.map(to_moz);
8200
8231
  return {
8201
8232
  type: "ImportExpression",
8202
8233
  source,
8234
+ options: options || null
8203
8235
  };
8204
8236
  }
8205
8237
 
@@ -8258,36 +8290,36 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8258
8290
  return {
8259
8291
  type: "FunctionDeclaration",
8260
8292
  id: to_moz(M.name),
8261
- params: M.argnames.map(to_moz),
8293
+ params: M.argnames.map(to_moz_pattern),
8262
8294
  generator: M.is_generator,
8263
8295
  async: M.async,
8264
8296
  body: to_moz_scope("BlockStatement", M)
8265
8297
  };
8266
8298
  });
8267
8299
 
8268
- def_to_moz(AST_Function, function To_Moz_FunctionExpression(M, parent) {
8269
- var is_generator = parent.is_generator !== undefined ?
8270
- parent.is_generator : M.is_generator;
8300
+ def_to_moz(AST_Function, function To_Moz_FunctionExpression(M) {
8271
8301
  return {
8272
8302
  type: "FunctionExpression",
8273
8303
  id: to_moz(M.name),
8274
- params: M.argnames.map(to_moz),
8275
- generator: is_generator,
8276
- async: M.async,
8304
+ params: M.argnames.map(to_moz_pattern),
8305
+ generator: M.is_generator || false,
8306
+ async: M.async || false,
8277
8307
  body: to_moz_scope("BlockStatement", M)
8278
8308
  };
8279
8309
  });
8280
8310
 
8281
8311
  def_to_moz(AST_Arrow, function To_Moz_ArrowFunctionExpression(M) {
8282
- var body = {
8283
- type: "BlockStatement",
8284
- body: M.body.map(to_moz)
8285
- };
8312
+ var body = M.body.length === 1 && M.body[0] instanceof AST_Return && M.body[0].value
8313
+ ? to_moz(M.body[0].value)
8314
+ : {
8315
+ type: "BlockStatement",
8316
+ body: M.body.map(to_moz)
8317
+ };
8286
8318
  return {
8287
8319
  type: "ArrowFunctionExpression",
8288
- params: M.argnames.map(to_moz),
8320
+ params: M.argnames.map(to_moz_pattern),
8289
8321
  async: M.async,
8290
- body: body
8322
+ body: body,
8291
8323
  };
8292
8324
  });
8293
8325
 
@@ -8295,12 +8327,39 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8295
8327
  if (M.is_array) {
8296
8328
  return {
8297
8329
  type: "ArrayPattern",
8298
- elements: M.names.map(to_moz)
8330
+ elements: M.names.map(
8331
+ M => M instanceof AST_Hole ? null : to_moz_pattern(M)
8332
+ ),
8299
8333
  };
8300
8334
  }
8301
8335
  return {
8302
8336
  type: "ObjectPattern",
8303
- properties: M.names.map(to_moz)
8337
+ properties: M.names.map(M => {
8338
+ if (M instanceof AST_ObjectKeyVal) {
8339
+ var computed = M.computed_key();
8340
+ const [shorthand, key] = to_moz_property_key(M.key, computed, M.quote, M.value);
8341
+
8342
+ return {
8343
+ type: "Property",
8344
+ computed,
8345
+ kind: "init",
8346
+ key: key,
8347
+ method: false,
8348
+ shorthand,
8349
+ value: to_moz_pattern(M.value)
8350
+ };
8351
+ } else {
8352
+ return to_moz_pattern(M);
8353
+ }
8354
+ }),
8355
+ };
8356
+ });
8357
+
8358
+ def_to_moz(AST_DefaultAssign, function To_Moz_AssignmentExpression(M) {
8359
+ return {
8360
+ type: "AssignmentPattern",
8361
+ left: to_moz_pattern(M.left),
8362
+ right: to_moz(M.right),
8304
8363
  };
8305
8364
  });
8306
8365
 
@@ -8344,8 +8403,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8344
8403
  def_to_moz(AST_Catch, function To_Moz_CatchClause(M) {
8345
8404
  return {
8346
8405
  type: "CatchClause",
8347
- param: to_moz(M.argname),
8348
- guard: null,
8406
+ param: M.argname != null ? to_moz_pattern(M.argname) : null,
8349
8407
  body: to_moz_block(M)
8350
8408
  };
8351
8409
  });
@@ -8360,28 +8418,27 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8360
8418
  };
8361
8419
  });
8362
8420
 
8363
- const assert_clause_to_moz = assert_clause => {
8364
- const assertions = [];
8365
- if (assert_clause) {
8366
- for (const { key, value } of assert_clause.properties) {
8421
+ function import_attributes_to_moz(attribute) {
8422
+ const import_attributes = [];
8423
+ if (attribute) {
8424
+ for (const { key, value } of attribute.properties) {
8367
8425
  const key_moz = is_basic_identifier_string(key)
8368
8426
  ? { type: "Identifier", name: key }
8369
8427
  : { type: "Literal", value: key, raw: JSON.stringify(key) };
8370
- assertions.push({
8428
+ import_attributes.push({
8371
8429
  type: "ImportAttribute",
8372
8430
  key: key_moz,
8373
8431
  value: to_moz(value)
8374
8432
  });
8375
8433
  }
8376
8434
  }
8377
- return assertions;
8378
- };
8435
+ return import_attributes;
8436
+ }
8379
8437
 
8380
8438
  def_to_moz(AST_Export, function To_Moz_ExportDeclaration(M) {
8381
8439
  if (M.exported_names) {
8382
8440
  var first_exported = M.exported_names[0];
8383
- var first_exported_name = first_exported.name;
8384
- if (first_exported_name.name === "*" && !first_exported_name.quote) {
8441
+ if (first_exported && first_exported.name.name === "*" && !first_exported.name.quote) {
8385
8442
  var foreign_name = first_exported.foreign_name;
8386
8443
  var exported = foreign_name.name === "*" && !foreign_name.quote
8387
8444
  ? null
@@ -8390,7 +8447,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8390
8447
  type: "ExportAllDeclaration",
8391
8448
  source: to_moz(M.module_name),
8392
8449
  exported: exported,
8393
- assertions: assert_clause_to_moz(M.assert_clause)
8450
+ attributes: import_attributes_to_moz(M.attributes)
8394
8451
  };
8395
8452
  }
8396
8453
  return {
@@ -8404,13 +8461,23 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8404
8461
  }),
8405
8462
  declaration: to_moz(M.exported_definition),
8406
8463
  source: to_moz(M.module_name),
8407
- assertions: assert_clause_to_moz(M.assert_clause)
8464
+ attributes: import_attributes_to_moz(M.attributes)
8465
+ };
8466
+ }
8467
+
8468
+ if (M.is_default) {
8469
+ return {
8470
+ type: "ExportDefaultDeclaration",
8471
+ declaration: to_moz(M.exported_value || M.exported_definition),
8472
+ };
8473
+ } else {
8474
+ return {
8475
+ type: "ExportNamedDeclaration",
8476
+ declaration: to_moz(M.exported_value || M.exported_definition),
8477
+ specifiers: [],
8478
+ source: null,
8408
8479
  };
8409
8480
  }
8410
- return {
8411
- type: M.is_default ? "ExportDefaultDeclaration" : "ExportNamedDeclaration",
8412
- declaration: to_moz(M.exported_value || M.exported_definition)
8413
- };
8414
8481
  });
8415
8482
 
8416
8483
  def_to_moz(AST_Import, function To_Moz_ImportDeclaration(M) {
@@ -8442,7 +8509,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8442
8509
  type: "ImportDeclaration",
8443
8510
  specifiers: specifiers,
8444
8511
  source: to_moz(M.module_name),
8445
- assertions: assert_clause_to_moz(M.assert_clause)
8512
+ attributes: import_attributes_to_moz(M.attributes)
8446
8513
  };
8447
8514
  });
8448
8515
 
@@ -8528,6 +8595,15 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8528
8595
  };
8529
8596
  });
8530
8597
 
8598
+ def_to_moz(AST_Assign, function To_Moz_AssignmentExpression(M) {
8599
+ return {
8600
+ type: "AssignmentExpression",
8601
+ operator: M.operator,
8602
+ left: to_moz(M.left),
8603
+ right: to_moz(M.right)
8604
+ };
8605
+ });
8606
+
8531
8607
  def_to_moz(AST_PrivateIn, function To_Moz_BinaryExpression_PrivateIn(M) {
8532
8608
  return {
8533
8609
  type: "BinaryExpression",
@@ -8552,29 +8628,10 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8552
8628
  });
8553
8629
 
8554
8630
  def_to_moz(AST_ObjectProperty, function To_Moz_Property(M, parent) {
8555
- var key = M.key instanceof AST_Node ? to_moz(M.key) : {
8556
- type: "Identifier",
8557
- value: M.key
8558
- };
8559
- if (typeof M.key === "number") {
8560
- key = {
8561
- type: "Literal",
8562
- value: Number(M.key)
8563
- };
8564
- }
8565
- if (typeof M.key === "string") {
8566
- key = {
8567
- type: "Identifier",
8568
- name: M.key
8569
- };
8570
- }
8631
+ var computed = M.computed_key();
8632
+ const [shorthand, key] = to_moz_property_key(M.key, computed, M.quote, M.value);
8633
+
8571
8634
  var kind;
8572
- var string_or_num = typeof M.key === "string" || typeof M.key === "number";
8573
- var computed = string_or_num ? false : !(M.key instanceof AST_Symbol) || M.key instanceof AST_SymbolRef;
8574
- if (M instanceof AST_ObjectKeyVal) {
8575
- kind = "init";
8576
- computed = !string_or_num;
8577
- } else
8578
8635
  if (M instanceof AST_ObjectGetter) {
8579
8636
  kind = "get";
8580
8637
  } else
@@ -8629,38 +8686,62 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8629
8686
  return {
8630
8687
  type: "Property",
8631
8688
  computed: computed,
8632
- kind: kind,
8689
+ method: false,
8690
+ shorthand,
8691
+ kind: kind,
8692
+ key: key,
8693
+ value: to_moz(M.value)
8694
+ };
8695
+ });
8696
+
8697
+ def_to_moz(AST_ObjectKeyVal, function To_Moz_Property(M) {
8698
+ var computed = M.computed_key();
8699
+ const [shorthand, key] = to_moz_property_key(M.key, computed, M.quote, M.value);
8700
+
8701
+ return {
8702
+ type: "Property",
8703
+ computed: computed,
8704
+ shorthand: shorthand,
8705
+ method: false,
8706
+ kind: "init",
8633
8707
  key: key,
8634
8708
  value: to_moz(M.value)
8635
8709
  };
8636
8710
  });
8637
8711
 
8638
8712
  def_to_moz(AST_ConciseMethod, function To_Moz_MethodDefinition(M, parent) {
8713
+ const computed = M.computed_key();
8714
+ const [_always_false, key] = to_moz_property_key(M.key, computed, M.quote, M.value);
8715
+
8639
8716
  if (parent instanceof AST_Object) {
8640
8717
  return {
8641
8718
  type: "Property",
8642
- computed: !(M.key instanceof AST_Symbol) || M.key instanceof AST_SymbolRef,
8643
8719
  kind: "init",
8720
+ computed,
8644
8721
  method: true,
8645
8722
  shorthand: false,
8646
- key: to_moz(M.key),
8647
- value: to_moz(M.value)
8723
+ key,
8724
+ value: to_moz(M.value),
8648
8725
  };
8649
8726
  }
8650
8727
 
8651
- const key = M instanceof AST_PrivateMethod
8652
- ? {
8653
- type: "PrivateIdentifier",
8654
- name: M.key.name
8655
- }
8656
- : to_moz(M.key);
8657
-
8658
8728
  return {
8659
8729
  type: "MethodDefinition",
8660
- kind: M.key === "constructor" ? "constructor" : "method",
8730
+ kind: !computed && M.key.name === "constructor" ? "constructor" : "method",
8731
+ computed,
8661
8732
  key,
8662
8733
  value: to_moz(M.value),
8663
- computed: !(M.key instanceof AST_Symbol) || M.key instanceof AST_SymbolRef,
8734
+ static: M.static,
8735
+ };
8736
+ });
8737
+
8738
+ def_to_moz(AST_PrivateMethod, function To_Moz_MethodDefinition(M) {
8739
+ return {
8740
+ type: "MethodDefinition",
8741
+ kind: "method",
8742
+ key: { type: "PrivateIdentifier", name: M.key.name },
8743
+ value: to_moz(M.value),
8744
+ computed: false,
8664
8745
  static: M.static,
8665
8746
  };
8666
8747
  });
@@ -8755,6 +8836,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8755
8836
  // `M.value` is a string that may be a hex number representation.
8756
8837
  // but "bigint" property should have only decimal digits
8757
8838
  bigint: typeof BigInt === "function" ? BigInt(M.value).toString() : M.value,
8839
+ raw: M.raw,
8758
8840
  }));
8759
8841
 
8760
8842
  AST_Boolean.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast);
@@ -8798,20 +8880,133 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8798
8880
  );
8799
8881
  }
8800
8882
 
8801
- var FROM_MOZ_STACK = null;
8883
+ var FROM_MOZ_LABELS = null;
8802
8884
 
8803
8885
  function from_moz(node) {
8804
- FROM_MOZ_STACK.push(node);
8805
- var ret = node != null ? MOZ_TO_ME[node.type](node) : null;
8806
- FROM_MOZ_STACK.pop();
8807
- return ret;
8886
+ if (node == null) return null;
8887
+ return MOZ_TO_ME[node.type](node);
8888
+ }
8889
+
8890
+ function from_moz_quote(moz_key, computed) {
8891
+ if (!computed && moz_key.type === "Literal" && typeof moz_key.value === "string") {
8892
+ return '"';
8893
+ } else {
8894
+ return "";
8895
+ }
8896
+ }
8897
+
8898
+ function from_moz_symbol(symbol_type, M, has_quote) {
8899
+ return new symbol_type({
8900
+ start: my_start_token(M),
8901
+ quote: has_quote ? '"' : undefined,
8902
+ name: M.type === "Identifier" ? M.name : String(M.value),
8903
+ end: my_end_token(M),
8904
+ });
8905
+ }
8906
+
8907
+ function from_moz_lambda(M, is_method) {
8908
+ return new (is_method ? AST_Accessor : AST_Function)({
8909
+ start: my_start_token(M),
8910
+ end: my_end_token(M),
8911
+ name: M.id && from_moz_symbol(is_method ? AST_SymbolMethod : AST_SymbolLambda, M.id),
8912
+ argnames: M.params.map(M => from_moz_pattern(M, AST_SymbolFunarg)),
8913
+ is_generator: M.generator,
8914
+ async: M.async,
8915
+ body: normalize_directives(from_moz(M.body).body)
8916
+ });
8917
+ }
8918
+
8919
+ function from_moz_pattern(M, sym_type) {
8920
+ switch (M.type) {
8921
+ case "ObjectPattern":
8922
+ return new AST_Destructuring({
8923
+ start: my_start_token(M),
8924
+ end: my_end_token(M),
8925
+ names: M.properties.map(p => from_moz_pattern(p, sym_type)),
8926
+ is_array: false
8927
+ });
8928
+
8929
+ case "Property":
8930
+ var key = M.key;
8931
+ var args = {
8932
+ start : my_start_token(key || M.value),
8933
+ end : my_end_token(M.value),
8934
+ key : key.type == "Identifier" ? key.name : String(key.value),
8935
+ quote : !M.computed && key.type === "Literal" && typeof key.value === "string"
8936
+ ? '"'
8937
+ : "",
8938
+ value : from_moz_pattern(M.value, sym_type)
8939
+ };
8940
+ if (M.computed) {
8941
+ args.key = from_moz(M.key);
8942
+ }
8943
+ return new AST_ObjectKeyVal(args);
8944
+
8945
+ case "ArrayPattern":
8946
+ return new AST_Destructuring({
8947
+ start: my_start_token(M),
8948
+ end: my_end_token(M),
8949
+ names: M.elements.map(function(elm) {
8950
+ if (elm === null) {
8951
+ return new AST_Hole();
8952
+ }
8953
+ return from_moz_pattern(elm, sym_type);
8954
+ }),
8955
+ is_array: true
8956
+ });
8957
+
8958
+ case "SpreadElement":
8959
+ case "RestElement":
8960
+ return new AST_Expansion({
8961
+ start: my_start_token(M),
8962
+ end: my_end_token(M),
8963
+ expression: from_moz_pattern(M.argument, sym_type),
8964
+ });
8965
+
8966
+ case "AssignmentPattern":
8967
+ return new AST_DefaultAssign({
8968
+ start : my_start_token(M),
8969
+ end : my_end_token(M),
8970
+ left : from_moz_pattern(M.left, sym_type),
8971
+ operator: "=",
8972
+ right : from_moz(M.right),
8973
+ });
8974
+
8975
+ case "Identifier":
8976
+ return new sym_type({
8977
+ start : my_start_token(M),
8978
+ end : my_end_token(M),
8979
+ name : M.name,
8980
+ });
8981
+
8982
+ default:
8983
+ throw new Error("Invalid node type for destructuring: " + M.type);
8984
+ }
8985
+ }
8986
+
8987
+ function from_moz_label_ref(m_label) {
8988
+ if (!m_label) return null;
8989
+
8990
+ const label = from_moz_symbol(AST_LabelRef, m_label);
8991
+
8992
+ let i = FROM_MOZ_LABELS.length;
8993
+ while (i--) {
8994
+ const label_origin = FROM_MOZ_LABELS[i];
8995
+
8996
+ if (label.name === label_origin.name) {
8997
+ label.thedef = label_origin;
8998
+ break;
8999
+ }
9000
+ }
9001
+
9002
+ return label;
8808
9003
  }
8809
9004
 
8810
9005
  AST_Node.from_mozilla_ast = function(node) {
8811
- var save_stack = FROM_MOZ_STACK;
8812
- FROM_MOZ_STACK = [];
9006
+ var save_labels = FROM_MOZ_LABELS;
9007
+ FROM_MOZ_LABELS = [];
8813
9008
  var ast = from_moz(node);
8814
- FROM_MOZ_STACK = save_stack;
9009
+ FROM_MOZ_LABELS = save_labels;
8815
9010
  return ast;
8816
9011
  };
8817
9012
 
@@ -8853,6 +9048,52 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8853
9048
  return ast;
8854
9049
  }
8855
9050
 
9051
+ /** Object property keys can be number literals, string literals, or raw names. Additionally they can be shorthand. We decide that here. */
9052
+ function to_moz_property_key(key, computed = false, quote = false, value = null) {
9053
+ if (computed) {
9054
+ return [false, to_moz(key)];
9055
+ }
9056
+
9057
+ const key_name = typeof key === "string" ? key : key.name;
9058
+ let moz_key;
9059
+ if (quote) {
9060
+ moz_key = { type: "Literal", value: key_name, raw: JSON.stringify(key_name) };
9061
+ } else if ("" + +key_name === key_name && +key_name >= 0) {
9062
+ // representable as a number
9063
+ moz_key = { type: "Literal", value: +key_name, raw: JSON.stringify(+key_name) };
9064
+ } else {
9065
+ moz_key = { type: "Identifier", name: key_name };
9066
+ }
9067
+
9068
+ const shorthand =
9069
+ moz_key.type === "Identifier"
9070
+ && moz_key.name === key_name
9071
+ && (value instanceof AST_Symbol && value.name === key_name
9072
+ || value instanceof AST_DefaultAssign && value.left.name === key_name);
9073
+ return [shorthand, moz_key];
9074
+ }
9075
+
9076
+ function to_moz_pattern(node) {
9077
+ if (node instanceof AST_Expansion) {
9078
+ return {
9079
+ type: "RestElement",
9080
+ argument: to_moz_pattern(node.expression),
9081
+ };
9082
+ }
9083
+
9084
+ if ((
9085
+ node instanceof AST_Symbol
9086
+ || node instanceof AST_Destructuring
9087
+ || node instanceof AST_DefaultAssign
9088
+ || node instanceof AST_PropAccess
9089
+ )) {
9090
+ // Plain translation
9091
+ return to_moz(node);
9092
+ }
9093
+
9094
+ throw new Error(node.TYPE);
9095
+ }
9096
+
8856
9097
  function to_moz_in_destructuring() {
8857
9098
  var i = TO_MOZ_STACK.length;
8858
9099
  while (i--) {
@@ -9085,7 +9326,7 @@ function OutputStream(options) {
9085
9326
  webkit : false,
9086
9327
  width : 80,
9087
9328
  wrap_iife : false,
9088
- wrap_func_args : true,
9329
+ wrap_func_args : false,
9089
9330
 
9090
9331
  _destroy_ast : false
9091
9332
  }, true);
@@ -10590,9 +10831,9 @@ function OutputStream(options) {
10590
10831
  output.space();
10591
10832
  }
10592
10833
  self.module_name.print(output);
10593
- if (self.assert_clause) {
10594
- output.print("assert");
10595
- self.assert_clause.print(output);
10834
+ if (self.attributes) {
10835
+ output.print("with");
10836
+ self.attributes.print(output);
10596
10837
  }
10597
10838
  output.semicolon();
10598
10839
  });
@@ -10609,11 +10850,11 @@ function OutputStream(options) {
10609
10850
  foreign_name.name;
10610
10851
  if (!names_are_different &&
10611
10852
  foreign_name.name === "*" &&
10612
- foreign_name.quote != self.name.quote) {
10853
+ !!foreign_name.quote != !!self.name.quote) {
10613
10854
  // export * as "*"
10614
10855
  names_are_different = true;
10615
10856
  }
10616
- var foreign_name_is_name = foreign_name.quote == null;
10857
+ var foreign_name_is_name = !foreign_name.quote;
10617
10858
  if (names_are_different) {
10618
10859
  if (is_import) {
10619
10860
  if (foreign_name_is_name) {
@@ -10622,7 +10863,7 @@ function OutputStream(options) {
10622
10863
  output.print_string(foreign_name.name, foreign_name.quote);
10623
10864
  }
10624
10865
  } else {
10625
- if (self.name.quote == null) {
10866
+ if (!self.name.quote) {
10626
10867
  self.name.print(output);
10627
10868
  } else {
10628
10869
  output.print_string(self.name.name, self.name.quote);
@@ -10642,7 +10883,7 @@ function OutputStream(options) {
10642
10883
  }
10643
10884
  }
10644
10885
  } else {
10645
- if (self.name.quote == null) {
10886
+ if (!self.name.quote) {
10646
10887
  self.name.print(output);
10647
10888
  } else {
10648
10889
  output.print_string(self.name.name, self.name.quote);
@@ -10686,9 +10927,9 @@ function OutputStream(options) {
10686
10927
  output.space();
10687
10928
  self.module_name.print(output);
10688
10929
  }
10689
- if (self.assert_clause) {
10690
- output.print("assert");
10691
- self.assert_clause.print(output);
10930
+ if (self.attributes) {
10931
+ output.print("with");
10932
+ self.attributes.print(output);
10692
10933
  }
10693
10934
  if (self.exported_value
10694
10935
  && !(self.exported_value instanceof AST_Defun ||
@@ -11031,7 +11272,7 @@ function OutputStream(options) {
11031
11272
 
11032
11273
  output.print("#");
11033
11274
 
11034
- print_property_name(self.key.name, self.quote, output);
11275
+ print_property_name(self.key.name, undefined, output);
11035
11276
 
11036
11277
  if (self.value) {
11037
11278
  output.print("=");
@@ -11094,13 +11335,24 @@ function OutputStream(options) {
11094
11335
  DEFPRINT(AST_PrivateGetter, function(self, output) {
11095
11336
  self._print_getter_setter("get", true, output);
11096
11337
  });
11338
+ DEFPRINT(AST_ConciseMethod, function(self, output) {
11339
+ var type;
11340
+ if (self.value.is_generator && self.value.async) {
11341
+ type = "async*";
11342
+ } else if (self.value.is_generator) {
11343
+ type = "*";
11344
+ } else if (self.value.async) {
11345
+ type = "async";
11346
+ }
11347
+ self._print_getter_setter(type, false, output);
11348
+ });
11097
11349
  DEFPRINT(AST_PrivateMethod, function(self, output) {
11098
11350
  var type;
11099
- if (self.is_generator && self.async) {
11351
+ if (self.value.is_generator && self.value.async) {
11100
11352
  type = "async*";
11101
- } else if (self.is_generator) {
11353
+ } else if (self.value.is_generator) {
11102
11354
  type = "*";
11103
- } else if (self.async) {
11355
+ } else if (self.value.async) {
11104
11356
  type = "async";
11105
11357
  }
11106
11358
  self._print_getter_setter(type, true, output);
@@ -11115,17 +11367,6 @@ function OutputStream(options) {
11115
11367
  DEFPRINT(AST_SymbolPrivateProperty, function(self, output) {
11116
11368
  output.print("#" + self.name);
11117
11369
  });
11118
- DEFPRINT(AST_ConciseMethod, function(self, output) {
11119
- var type;
11120
- if (self.is_generator && self.async) {
11121
- type = "async*";
11122
- } else if (self.is_generator) {
11123
- type = "*";
11124
- } else if (self.async) {
11125
- type = "async";
11126
- }
11127
- self._print_getter_setter(type, false, output);
11128
- });
11129
11370
  DEFPRINT(AST_ClassStaticBlock, function (self, output) {
11130
11371
  output.print("static");
11131
11372
  output.space();
@@ -11159,7 +11400,11 @@ function OutputStream(options) {
11159
11400
  }
11160
11401
  });
11161
11402
  DEFPRINT(AST_BigInt, function(self, output) {
11162
- output.print(self.getValue() + "n");
11403
+ if (output.option("keep_numbers") && self.raw) {
11404
+ output.print(self.raw);
11405
+ } else {
11406
+ output.print(self.getValue() + "n");
11407
+ }
11163
11408
  });
11164
11409
 
11165
11410
  const r_slash_script = /(<\s*\/\s*script)/i;
@@ -11447,13 +11692,13 @@ AST_VarDef.prototype.shallow_cmp = function(other) {
11447
11692
  AST_NameMapping.prototype.shallow_cmp = pass_through;
11448
11693
 
11449
11694
  AST_Import.prototype.shallow_cmp = function(other) {
11450
- 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);
11695
+ 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) && (this.attributes == null ? other.attributes == null : this.attributes === other.attributes);
11451
11696
  };
11452
11697
 
11453
11698
  AST_ImportMeta.prototype.shallow_cmp = pass_through;
11454
11699
 
11455
11700
  AST_Export.prototype.shallow_cmp = function(other) {
11456
- 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;
11701
+ 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.attributes == null ? other.attributes == null : this.attributes === other.attributes) && this.module_name === other.module_name && this.is_default === other.is_default;
11457
11702
  };
11458
11703
 
11459
11704
  AST_Call.prototype.shallow_cmp = pass_through;
@@ -11480,6 +11725,8 @@ AST_Binary.prototype.shallow_cmp = function(other) {
11480
11725
  return this.operator === other.operator;
11481
11726
  };
11482
11727
 
11728
+ AST_PrivateIn.prototype.shallow_cmp = pass_through;
11729
+
11483
11730
  AST_Conditional.prototype.shallow_cmp = pass_through;
11484
11731
 
11485
11732
  AST_Array.prototype.shallow_cmp = pass_through;
@@ -11489,7 +11736,7 @@ AST_Object.prototype.shallow_cmp = pass_through;
11489
11736
  AST_ObjectProperty.prototype.shallow_cmp = pass_through;
11490
11737
 
11491
11738
  AST_ObjectKeyVal.prototype.shallow_cmp = function(other) {
11492
- return this.key === other.key;
11739
+ return this.key === other.key && this.quote === other.quote;
11493
11740
  };
11494
11741
 
11495
11742
  AST_ObjectSetter.prototype.shallow_cmp = function(other) {
@@ -11501,7 +11748,11 @@ AST_ObjectGetter.prototype.shallow_cmp = function(other) {
11501
11748
  };
11502
11749
 
11503
11750
  AST_ConciseMethod.prototype.shallow_cmp = function(other) {
11504
- return this.static === other.static && this.is_generator === other.is_generator && this.async === other.async;
11751
+ return this.static === other.static;
11752
+ };
11753
+
11754
+ AST_PrivateMethod.prototype.shallow_cmp = function(other) {
11755
+ return this.static === other.static;
11505
11756
  };
11506
11757
 
11507
11758
  AST_Class.prototype.shallow_cmp = function(other) {
@@ -11509,6 +11760,13 @@ AST_Class.prototype.shallow_cmp = function(other) {
11509
11760
  };
11510
11761
 
11511
11762
  AST_ClassProperty.prototype.shallow_cmp = function(other) {
11763
+ return this.static === other.static
11764
+ && (typeof this.key === "string"
11765
+ ? this.key === other.key
11766
+ : true /* AST_Node handled elsewhere */);
11767
+ };
11768
+
11769
+ AST_ClassPrivateProperty.prototype.shallow_cmp = function(other) {
11512
11770
  return this.static === other.static;
11513
11771
  };
11514
11772
 
@@ -12830,14 +13088,18 @@ AST_ObjectSetter.prototype._size = function () {
12830
13088
  };
12831
13089
 
12832
13090
  AST_ConciseMethod.prototype._size = function () {
12833
- return static_size(this.static) + key_size(this.key) + lambda_modifiers(this);
13091
+ return static_size(this.static) + key_size(this.key);
12834
13092
  };
12835
13093
 
12836
13094
  AST_PrivateMethod.prototype._size = function () {
12837
13095
  return AST_ConciseMethod.prototype._size.call(this) + 1;
12838
13096
  };
12839
13097
 
12840
- AST_PrivateGetter.prototype._size = AST_PrivateSetter.prototype._size = function () {
13098
+ AST_PrivateGetter.prototype._size = function () {
13099
+ return AST_ConciseMethod.prototype._size.call(this) + 4;
13100
+ };
13101
+
13102
+ AST_PrivateSetter.prototype._size = function () {
12841
13103
  return AST_ConciseMethod.prototype._size.call(this) + 4;
12842
13104
  };
12843
13105
 
@@ -12991,7 +13253,6 @@ const TRUTHY = 0b00000010;
12991
13253
  const FALSY = 0b00000100;
12992
13254
  const UNDEFINED = 0b00001000;
12993
13255
  const INLINED = 0b00010000;
12994
-
12995
13256
  // Nodes to which values are ever written. Used when keep_assign is part of the unused option string.
12996
13257
  const WRITE_ONLY = 0b00100000;
12997
13258
 
@@ -13623,18 +13884,24 @@ const unary_side_effects = makePredicate("delete ++ --");
13623
13884
  def_is_number(AST_Node, return_false);
13624
13885
  def_is_number(AST_Number, return_true);
13625
13886
  const unary = makePredicate("+ - ~ ++ --");
13626
- def_is_number(AST_Unary, function() {
13627
- return unary.has(this.operator) && !(this.expression instanceof AST_BigInt);
13887
+ def_is_number(AST_Unary, function(compressor) {
13888
+ return unary.has(this.operator) && this.expression.is_number(compressor);
13628
13889
  });
13629
13890
  const numeric_ops = makePredicate("- * / % & | ^ << >> >>>");
13630
13891
  def_is_number(AST_Binary, function(compressor) {
13631
- return numeric_ops.has(this.operator) || this.operator == "+"
13632
- && this.left.is_number(compressor)
13633
- && this.right.is_number(compressor);
13892
+ if (this.operator === "+") {
13893
+ // Both sides need to be `number`. Or one is a `number` and the other is number-ish.
13894
+ return this.left.is_number(compressor) && this.right.is_number_or_bigint(compressor)
13895
+ || this.right.is_number(compressor) && this.left.is_number_or_bigint(compressor);
13896
+ } else if (numeric_ops.has(this.operator)) {
13897
+ return this.left.is_number(compressor) || this.right.is_number(compressor);
13898
+ } else {
13899
+ return false;
13900
+ }
13634
13901
  });
13635
13902
  def_is_number(AST_Assign, function(compressor) {
13636
- return numeric_ops.has(this.operator.slice(0, -1))
13637
- || this.operator == "=" && this.right.is_number(compressor);
13903
+ return (this.operator === "=" || numeric_ops.has(this.operator.slice(0, -1)))
13904
+ && this.right.is_number(compressor);
13638
13905
  });
13639
13906
  def_is_number(AST_Sequence, function(compressor) {
13640
13907
  return this.tail_node().is_number(compressor);
@@ -13646,19 +13913,83 @@ const unary_side_effects = makePredicate("delete ++ --");
13646
13913
  node.DEFMETHOD("is_number", func);
13647
13914
  });
13648
13915
 
13916
+ // methods to determine if an expression returns a BigInt
13917
+ (function(def_is_bigint) {
13918
+ def_is_bigint(AST_Node, return_false);
13919
+ def_is_bigint(AST_BigInt, return_true);
13920
+ const unary = makePredicate("+ - ~ ++ --");
13921
+ def_is_bigint(AST_Unary, function(compressor) {
13922
+ return unary.has(this.operator) && this.expression.is_bigint(compressor);
13923
+ });
13924
+ const numeric_ops = makePredicate("- * / % & | ^ << >>");
13925
+ def_is_bigint(AST_Binary, function(compressor) {
13926
+ if (this.operator === "+") {
13927
+ return this.left.is_bigint(compressor) && this.right.is_number_or_bigint(compressor)
13928
+ || this.right.is_bigint(compressor) && this.left.is_number_or_bigint(compressor);
13929
+ } else if (numeric_ops.has(this.operator)) {
13930
+ return this.left.is_bigint(compressor) || this.right.is_bigint(compressor);
13931
+ } else {
13932
+ return false;
13933
+ }
13934
+ });
13935
+ def_is_bigint(AST_Assign, function(compressor) {
13936
+ return (numeric_ops.has(this.operator.slice(0, -1)) || this.operator == "=")
13937
+ && this.right.is_bigint(compressor);
13938
+ });
13939
+ def_is_bigint(AST_Sequence, function(compressor) {
13940
+ return this.tail_node().is_bigint(compressor);
13941
+ });
13942
+ def_is_bigint(AST_Conditional, function(compressor) {
13943
+ return this.consequent.is_bigint(compressor) && this.alternative.is_bigint(compressor);
13944
+ });
13945
+ })(function(node, func) {
13946
+ node.DEFMETHOD("is_bigint", func);
13947
+ });
13948
+
13949
+ // methods to determine if an expression is a number or a bigint
13950
+ (function(def_is_number_or_bigint) {
13951
+ def_is_number_or_bigint(AST_Node, return_false);
13952
+ def_is_number_or_bigint(AST_Number, return_true);
13953
+ def_is_number_or_bigint(AST_BigInt, return_true);
13954
+ const numeric_unary_ops = makePredicate("+ - ~ ++ --");
13955
+ def_is_number_or_bigint(AST_Unary, function(_compressor) {
13956
+ return numeric_unary_ops.has(this.operator);
13957
+ });
13958
+ const numeric_ops = makePredicate("- * / % & | ^ << >>");
13959
+ def_is_number_or_bigint(AST_Binary, function(compressor) {
13960
+ return this.operator === "+"
13961
+ ? this.left.is_number_or_bigint(compressor) && this.right.is_number_or_bigint(compressor)
13962
+ : numeric_ops.has(this.operator);
13963
+ });
13964
+ def_is_number_or_bigint(AST_Assign, function(compressor) {
13965
+ return numeric_ops.has(this.operator.slice(0, -1))
13966
+ || this.operator == "=" && this.right.is_number_or_bigint(compressor);
13967
+ });
13968
+ def_is_number_or_bigint(AST_Sequence, function(compressor) {
13969
+ return this.tail_node().is_number_or_bigint(compressor);
13970
+ });
13971
+ def_is_number_or_bigint(AST_Conditional, function(compressor) {
13972
+ return this.consequent.is_number_or_bigint(compressor) && this.alternative.is_number_or_bigint(compressor);
13973
+ });
13974
+ }(function (node, func) {
13975
+ node.DEFMETHOD("is_number_or_bigint", func);
13976
+ }));
13977
+
13978
+
13649
13979
  // methods to determine if an expression is a 32 bit integer (IE results from bitwise ops, or is an integer constant fitting in that size
13650
13980
  (function(def_is_32_bit_integer) {
13651
13981
  def_is_32_bit_integer(AST_Node, return_false);
13652
- def_is_32_bit_integer(AST_Number, function() {
13982
+ def_is_32_bit_integer(AST_Number, function(_compressor) {
13653
13983
  return this.value === (this.value | 0);
13654
13984
  });
13655
- def_is_32_bit_integer(AST_UnaryPrefix, function() {
13656
- return this.operator == "~" ? this.expression.is_number()
13657
- : this.operator === "+" ? this.expression.is_32_bit_integer()
13985
+ def_is_32_bit_integer(AST_UnaryPrefix, function(compressor) {
13986
+ return this.operator == "~" ? this.expression.is_number(compressor)
13987
+ : this.operator === "+" ? this.expression.is_32_bit_integer(compressor)
13658
13988
  : false;
13659
13989
  });
13660
- def_is_32_bit_integer(AST_Binary, function() {
13661
- return bitwise_binop.has(this.operator);
13990
+ def_is_32_bit_integer(AST_Binary, function(compressor) {
13991
+ return bitwise_binop.has(this.operator)
13992
+ && (this.left.is_number(compressor) || this.right.is_number(compressor));
13662
13993
  });
13663
13994
  }(function (node, func) {
13664
13995
  node.DEFMETHOD("is_32_bit_integer", func);
@@ -13819,25 +14150,29 @@ function is_nullish(node, compressor) {
13819
14150
  def_has_side_effects(AST_Object, function(compressor) {
13820
14151
  return any(this.properties, compressor);
13821
14152
  });
13822
- def_has_side_effects(AST_ObjectProperty, function(compressor) {
14153
+ def_has_side_effects(AST_ObjectKeyVal, function(compressor) {
13823
14154
  return (
13824
14155
  this.computed_key() && this.key.has_side_effects(compressor)
13825
14156
  || this.value && this.value.has_side_effects(compressor)
13826
14157
  );
13827
14158
  });
13828
- def_has_side_effects(AST_ClassProperty, function(compressor) {
14159
+ def_has_side_effects([
14160
+ AST_ClassProperty,
14161
+ AST_ClassPrivateProperty,
14162
+ ], function(compressor) {
13829
14163
  return (
13830
14164
  this.computed_key() && this.key.has_side_effects(compressor)
13831
14165
  || this.static && this.value && this.value.has_side_effects(compressor)
13832
14166
  );
13833
14167
  });
13834
- def_has_side_effects(AST_ConciseMethod, function(compressor) {
13835
- return this.computed_key() && this.key.has_side_effects(compressor);
13836
- });
13837
- def_has_side_effects(AST_ObjectGetter, function(compressor) {
13838
- return this.computed_key() && this.key.has_side_effects(compressor);
13839
- });
13840
- def_has_side_effects(AST_ObjectSetter, function(compressor) {
14168
+ def_has_side_effects([
14169
+ AST_PrivateMethod,
14170
+ AST_PrivateGetter,
14171
+ AST_PrivateSetter,
14172
+ AST_ConciseMethod,
14173
+ AST_ObjectGetter,
14174
+ AST_ObjectSetter,
14175
+ ], function(compressor) {
13841
14176
  return this.computed_key() && this.key.has_side_effects(compressor);
13842
14177
  });
13843
14178
  def_has_side_effects(AST_Array, function(compressor) {
@@ -13882,8 +14217,10 @@ function is_nullish(node, compressor) {
13882
14217
  def_has_side_effects(AST_TemplateString, function(compressor) {
13883
14218
  return any(this.segments, compressor);
13884
14219
  });
13885
- })(function(node, func) {
13886
- node.DEFMETHOD("has_side_effects", func);
14220
+ })(function(node_or_nodes, func) {
14221
+ for (const node of [].concat(node_or_nodes)) {
14222
+ node.DEFMETHOD("has_side_effects", func);
14223
+ }
13887
14224
  });
13888
14225
 
13889
14226
  // determine if expression may throw
@@ -13962,25 +14299,33 @@ function is_nullish(node, compressor) {
13962
14299
  def_may_throw(AST_Object, function(compressor) {
13963
14300
  return any(this.properties, compressor);
13964
14301
  });
13965
- def_may_throw(AST_ObjectProperty, function(compressor) {
13966
- // TODO key may throw too
13967
- return this.value ? this.value.may_throw(compressor) : false;
14302
+ def_may_throw(AST_ObjectKeyVal, function(compressor) {
14303
+ return (
14304
+ this.computed_key() && this.key.may_throw(compressor)
14305
+ || this.value ? this.value.may_throw(compressor) : false
14306
+ );
13968
14307
  });
13969
- def_may_throw(AST_ClassProperty, function(compressor) {
14308
+ def_may_throw([
14309
+ AST_ClassProperty,
14310
+ AST_ClassPrivateProperty,
14311
+ ], function(compressor) {
13970
14312
  return (
13971
14313
  this.computed_key() && this.key.may_throw(compressor)
13972
14314
  || this.static && this.value && this.value.may_throw(compressor)
13973
14315
  );
13974
14316
  });
13975
- def_may_throw(AST_ConciseMethod, function(compressor) {
13976
- return this.computed_key() && this.key.may_throw(compressor);
13977
- });
13978
- def_may_throw(AST_ObjectGetter, function(compressor) {
13979
- return this.computed_key() && this.key.may_throw(compressor);
13980
- });
13981
- def_may_throw(AST_ObjectSetter, function(compressor) {
14317
+ def_may_throw([
14318
+ AST_ConciseMethod,
14319
+ AST_ObjectGetter,
14320
+ AST_ObjectSetter,
14321
+ ], function(compressor) {
13982
14322
  return this.computed_key() && this.key.may_throw(compressor);
13983
14323
  });
14324
+ def_may_throw([
14325
+ AST_PrivateMethod,
14326
+ AST_PrivateGetter,
14327
+ AST_PrivateSetter,
14328
+ ], return_false);
13984
14329
  def_may_throw(AST_Return, function(compressor) {
13985
14330
  return this.value && this.value.may_throw(compressor);
13986
14331
  });
@@ -14025,8 +14370,10 @@ function is_nullish(node, compressor) {
14025
14370
  if (!this.value) return false;
14026
14371
  return this.value.may_throw(compressor);
14027
14372
  });
14028
- })(function(node, func) {
14029
- node.DEFMETHOD("may_throw", func);
14373
+ })(function(node_or_nodes, func) {
14374
+ for (const node of [].concat(node_or_nodes)) {
14375
+ node.DEFMETHOD("may_throw", func);
14376
+ }
14030
14377
  });
14031
14378
 
14032
14379
  // determine if expression is constant
@@ -14279,30 +14626,36 @@ function is_lhs(node, parent) {
14279
14626
  });
14280
14627
 
14281
14628
  (function (def_bitwise_negate) {
14282
- function basic_negation(exp) {
14629
+ function basic_bitwise_negation(exp) {
14283
14630
  return make_node(AST_UnaryPrefix, exp, {
14284
14631
  operator: "~",
14285
14632
  expression: exp
14286
14633
  });
14287
14634
  }
14288
14635
 
14289
- def_bitwise_negate(AST_Node, function() {
14290
- return basic_negation(this);
14636
+ def_bitwise_negate(AST_Node, function(_compressor) {
14637
+ return basic_bitwise_negation(this);
14291
14638
  });
14292
14639
 
14293
- def_bitwise_negate(AST_Number, function() {
14640
+ def_bitwise_negate(AST_Number, function(_compressor) {
14294
14641
  const neg = ~this.value;
14295
14642
  if (neg.toString().length > this.value.toString().length) {
14296
- return basic_negation(this);
14643
+ return basic_bitwise_negation(this);
14297
14644
  }
14298
14645
  return make_node(AST_Number, this, { value: neg });
14299
14646
  });
14300
14647
 
14301
- def_bitwise_negate(AST_UnaryPrefix, function(in_32_bit_context) {
14302
- if (this.operator == "~" && (in_32_bit_context || this.expression.is_32_bit_integer())) {
14648
+ def_bitwise_negate(AST_UnaryPrefix, function(compressor, in_32_bit_context) {
14649
+ if (
14650
+ this.operator == "~"
14651
+ && (
14652
+ this.expression.is_32_bit_integer(compressor) ||
14653
+ (in_32_bit_context != null ? in_32_bit_context : compressor.in_32_bit_context())
14654
+ )
14655
+ ) {
14303
14656
  return this.expression;
14304
14657
  } else {
14305
- return basic_negation(this);
14658
+ return basic_bitwise_negation(this);
14306
14659
  }
14307
14660
  });
14308
14661
  })(function (node, func) {
@@ -14566,8 +14919,13 @@ AST_Node.DEFMETHOD("is_constant", function () {
14566
14919
  return !(this instanceof AST_RegExp);
14567
14920
  } else {
14568
14921
  return this instanceof AST_UnaryPrefix
14569
- && this.expression instanceof AST_Constant
14570
- && unaryPrefix.has(this.operator);
14922
+ && unaryPrefix.has(this.operator)
14923
+ && (
14924
+ // `this.expression` may be an `AST_RegExp`,
14925
+ // so not only `.is_constant()`.
14926
+ this.expression instanceof AST_Constant
14927
+ || this.expression.is_constant()
14928
+ );
14571
14929
  }
14572
14930
  });
14573
14931
 
@@ -15016,8 +15374,10 @@ def_eval(AST_New, return_this);
15016
15374
  // 10 -> (nothing)
15017
15375
  // knownPureFunc(foo++) -> foo++
15018
15376
 
15019
- function def_drop_side_effect_free(node, func) {
15020
- node.DEFMETHOD("drop_side_effect_free", func);
15377
+ function def_drop_side_effect_free(node_or_nodes, func) {
15378
+ for (const node of [].concat(node_or_nodes)) {
15379
+ node.DEFMETHOD("drop_side_effect_free", func);
15380
+ }
15021
15381
  }
15022
15382
 
15023
15383
  // Drop side-effect-free elements from an array of expressions.
@@ -15108,7 +15468,10 @@ def_drop_side_effect_free(AST_Class, function (compressor) {
15108
15468
  }
15109
15469
  });
15110
15470
 
15111
- def_drop_side_effect_free(AST_ClassProperty, function (compressor) {
15471
+ def_drop_side_effect_free([
15472
+ AST_ClassProperty,
15473
+ AST_ClassPrivateProperty,
15474
+ ], function (compressor) {
15112
15475
  const key = this.computed_key() && this.key.drop_side_effect_free(compressor);
15113
15476
 
15114
15477
  const value = this.static && this.value
@@ -15212,26 +15575,30 @@ def_drop_side_effect_free(AST_Object, function (compressor, first_in_statement)
15212
15575
  return values && make_sequence(this, values);
15213
15576
  });
15214
15577
 
15215
- def_drop_side_effect_free(AST_ObjectProperty, function (compressor, first_in_statement) {
15216
- const computed_key = this instanceof AST_ObjectKeyVal && this.key instanceof AST_Node;
15578
+ def_drop_side_effect_free(AST_ObjectKeyVal, function (compressor, first_in_statement) {
15579
+ const computed_key = this.key instanceof AST_Node;
15217
15580
  const key = computed_key && this.key.drop_side_effect_free(compressor, first_in_statement);
15218
- const value = this.value && this.value.drop_side_effect_free(compressor, first_in_statement);
15581
+ const value = this.value.drop_side_effect_free(compressor, first_in_statement);
15219
15582
  if (key && value) {
15220
15583
  return make_sequence(this, [key, value]);
15221
15584
  }
15222
15585
  return key || value;
15223
15586
  });
15224
15587
 
15225
- def_drop_side_effect_free(AST_ConciseMethod, function () {
15226
- return this.computed_key() ? this.key : null;
15227
- });
15228
-
15229
- def_drop_side_effect_free(AST_ObjectGetter, function () {
15588
+ def_drop_side_effect_free([
15589
+ AST_ConciseMethod,
15590
+ AST_ObjectGetter,
15591
+ AST_ObjectSetter,
15592
+ ], function () {
15230
15593
  return this.computed_key() ? this.key : null;
15231
15594
  });
15232
15595
 
15233
- def_drop_side_effect_free(AST_ObjectSetter, function () {
15234
- return this.computed_key() ? this.key : null;
15596
+ def_drop_side_effect_free([
15597
+ AST_PrivateMethod,
15598
+ AST_PrivateGetter,
15599
+ AST_PrivateSetter,
15600
+ ], function () {
15601
+ return null;
15235
15602
  });
15236
15603
 
15237
15604
  def_drop_side_effect_free(AST_Array, function (compressor, first_in_statement) {
@@ -17463,7 +17830,7 @@ function tighten_body(statements, compressor) {
17463
17830
  stat = stat.clone();
17464
17831
  stat.condition = stat.condition.negate(compressor);
17465
17832
  stat.body = make_node(AST_BlockStatement, stat, {
17466
- body: as_statement_array(stat.alternative).concat(extract_functions())
17833
+ body: as_statement_array(stat.alternative).concat(extract_defuns())
17467
17834
  });
17468
17835
  stat.alternative = make_node(AST_BlockStatement, stat, {
17469
17836
  body: new_else
@@ -17483,7 +17850,7 @@ function tighten_body(statements, compressor) {
17483
17850
  CHANGED = true;
17484
17851
  stat = stat.clone();
17485
17852
  stat.body = make_node(AST_BlockStatement, stat.body, {
17486
- body: as_statement_array(stat.body).concat(extract_functions())
17853
+ body: as_statement_array(stat.body).concat(extract_defuns())
17487
17854
  });
17488
17855
  stat.alternative = make_node(AST_BlockStatement, stat.alternative, {
17489
17856
  body: new_else
@@ -17588,7 +17955,7 @@ function tighten_body(statements, compressor) {
17588
17955
  || ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct;
17589
17956
  }
17590
17957
 
17591
- function extract_functions() {
17958
+ function extract_defuns() {
17592
17959
  var tail = statements.slice(i + 1);
17593
17960
  statements.length = i + 1;
17594
17961
  return tail.filter(function (stat) {
@@ -17606,6 +17973,9 @@ function tighten_body(statements, compressor) {
17606
17973
  return undefined;
17607
17974
  }
17608
17975
  body = body.slice(0, -1);
17976
+ if (!body.every(stat => can_be_evicted_from_block(stat))) {
17977
+ return undefined;
17978
+ }
17609
17979
  if (ab.value) {
17610
17980
  body.push(make_node(AST_SimpleStatement, ab.value, {
17611
17981
  body: ab.value.expression
@@ -18064,6 +18434,8 @@ function inline_into_symbolref(self, compressor) {
18064
18434
  return self;
18065
18435
  }
18066
18436
 
18437
+ if (dont_inline_lambda_in_loop(compressor, fixed)) return self;
18438
+
18067
18439
  let single_use = def.single_use
18068
18440
  && !(parent instanceof AST_Call
18069
18441
  && (parent.is_callee_pure(compressor))
@@ -18217,6 +18589,11 @@ function inline_into_call(self, compressor) {
18217
18589
  fn = fixed;
18218
18590
  }
18219
18591
 
18592
+ if (
18593
+ dont_inline_lambda_in_loop(compressor, fn)
18594
+ && !has_annotation(self, _INLINE)
18595
+ ) return self;
18596
+
18220
18597
  var is_func = fn instanceof AST_Lambda;
18221
18598
 
18222
18599
  var stat = is_func && fn.body[0];
@@ -18545,6 +18922,14 @@ function inline_into_call(self, compressor) {
18545
18922
  }
18546
18923
  }
18547
18924
 
18925
+ /** prevent inlining functions into loops, for performance reasons */
18926
+ function dont_inline_lambda_in_loop(compressor, maybe_lambda) {
18927
+ return (
18928
+ (maybe_lambda instanceof AST_Lambda || maybe_lambda instanceof AST_Class)
18929
+ && !!compressor.is_within_loop()
18930
+ );
18931
+ }
18932
+
18548
18933
  (function(def_find_defs) {
18549
18934
  function to_node(value, orig) {
18550
18935
  if (value instanceof AST_Node) {
@@ -18825,12 +19210,16 @@ class Compressor extends TreeWalker {
18825
19210
  }
18826
19211
  }
18827
19212
 
18828
- in_32_bit_context() {
19213
+ in_32_bit_context(other_operand_must_be_number) {
18829
19214
  if (!this.option("evaluate")) return false;
18830
19215
  var self = this.self();
18831
19216
  for (var i = 0, p; p = this.parent(i); i++) {
18832
19217
  if (p instanceof AST_Binary && bitwise_binop.has(p.operator)) {
18833
- return true;
19218
+ if (other_operand_must_be_number) {
19219
+ return (self === p.left ? p.right : p.left).is_number(this);
19220
+ } else {
19221
+ return true;
19222
+ }
18834
19223
  }
18835
19224
  if (p instanceof AST_UnaryPrefix) {
18836
19225
  return p.operator === "~";
@@ -18945,6 +19334,7 @@ class Compressor extends TreeWalker {
18945
19334
  }
18946
19335
  }
18947
19336
 
19337
+
18948
19338
  function def_optimize(node, optimizer) {
18949
19339
  node.DEFMETHOD("optimize", function(compressor) {
18950
19340
  var self = this;
@@ -18973,17 +19363,19 @@ AST_Toplevel.DEFMETHOD("drop_console", function(options) {
18973
19363
  return;
18974
19364
  }
18975
19365
 
18976
- if (isArray && !options.includes(exp.property)) {
18977
- return;
18978
- }
18979
-
18980
19366
  var name = exp.expression;
19367
+ var property = exp.property;
18981
19368
  var depth = 2;
18982
19369
  while (name.expression) {
19370
+ property = name.property;
18983
19371
  name = name.expression;
18984
19372
  depth++;
18985
19373
  }
18986
19374
 
19375
+ if (isArray && !options.includes(property)) {
19376
+ return;
19377
+ }
19378
+
18987
19379
  if (is_undeclared_ref(name) && name.name == "console") {
18988
19380
  if (
18989
19381
  depth === 3
@@ -20167,6 +20559,23 @@ def_optimize(AST_Call, function(self, compressor) {
20167
20559
  self.args.length = last;
20168
20560
  }
20169
20561
 
20562
+ if (
20563
+ exp instanceof AST_Dot
20564
+ && exp.expression instanceof AST_SymbolRef
20565
+ && exp.expression.name === "console"
20566
+ && exp.expression.definition().undeclared
20567
+ && exp.property === "assert"
20568
+ ) {
20569
+ const condition = self.args[0];
20570
+ if (condition) {
20571
+ const value = condition.evaluate(compressor);
20572
+
20573
+ if (value === 1 || value === true) {
20574
+ return make_node(AST_Undefined, self);
20575
+ }
20576
+ }
20577
+ }
20578
+
20170
20579
  if (compressor.option("unsafe") && !exp.contains_optional()) {
20171
20580
  if (exp instanceof AST_Dot && exp.start.value === "Array" && exp.property === "from" && self.args.length === 1) {
20172
20581
  const [argument] = self.args;
@@ -20581,7 +20990,7 @@ def_optimize(AST_UnaryPrefix, function(self, compressor) {
20581
20990
  self.operator === "~"
20582
20991
  && self.expression instanceof AST_UnaryPrefix
20583
20992
  && self.expression.operator === "~"
20584
- && (compressor.in_32_bit_context() || self.expression.expression.is_32_bit_integer())
20993
+ && (compressor.in_32_bit_context(false) || self.expression.expression.is_32_bit_integer(compressor))
20585
20994
  ) {
20586
20995
  return self.expression.expression;
20587
20996
  }
@@ -20594,9 +21003,9 @@ def_optimize(AST_UnaryPrefix, function(self, compressor) {
20594
21003
  ) {
20595
21004
  if (e.left instanceof AST_UnaryPrefix && e.left.operator === "~") {
20596
21005
  // ~(~x ^ y) => x ^ y
20597
- e.left = e.left.bitwise_negate(true);
21006
+ e.left = e.left.bitwise_negate(compressor, true);
20598
21007
  } else {
20599
- e.right = e.right.bitwise_negate(true);
21008
+ e.right = e.right.bitwise_negate(compressor, true);
20600
21009
  }
20601
21010
  return e;
20602
21011
  }
@@ -20691,10 +21100,13 @@ def_optimize(AST_Binary, function(self, compressor) {
20691
21100
  case "===":
20692
21101
  case "!==":
20693
21102
  var is_strict_comparison = true;
20694
- if ((self.left.is_string(compressor) && self.right.is_string(compressor)) ||
21103
+ if (
21104
+ (self.left.is_string(compressor) && self.right.is_string(compressor)) ||
20695
21105
  (self.left.is_number(compressor) && self.right.is_number(compressor)) ||
21106
+ (self.left.is_bigint(compressor) && self.right.is_bigint(compressor)) ||
20696
21107
  (self.left.is_boolean() && self.right.is_boolean()) ||
20697
- self.left.equivalent_to(self.right)) {
21108
+ self.left.equivalent_to(self.right)
21109
+ ) {
20698
21110
  self.operator = self.operator.substr(0, 2);
20699
21111
  }
20700
21112
 
@@ -20739,7 +21151,7 @@ def_optimize(AST_Binary, function(self, compressor) {
20739
21151
  && self.left.definition() === self.right.definition()
20740
21152
  && is_object(self.left.fixed_value())) {
20741
21153
  return make_node(self.operator[0] == "=" ? AST_True : AST_False, self);
20742
- } else if (self.left.is_32_bit_integer() && self.right.is_32_bit_integer()) {
21154
+ } else if (self.left.is_32_bit_integer(compressor) && self.right.is_32_bit_integer(compressor)) {
20743
21155
  const not = node => make_node(AST_UnaryPrefix, node, {
20744
21156
  operator: "!",
20745
21157
  expression: node
@@ -20772,7 +21184,7 @@ def_optimize(AST_Binary, function(self, compressor) {
20772
21184
  && (mask = and_op === self.left ? self.right : self.left)
20773
21185
  && and_op.operator === "&"
20774
21186
  && mask instanceof AST_Number
20775
- && mask.is_32_bit_integer()
21187
+ && mask.is_32_bit_integer(compressor)
20776
21188
  && (x =
20777
21189
  and_op.left.equivalent_to(mask) ? and_op.right
20778
21190
  : and_op.right.equivalent_to(mask) ? and_op.left : null)
@@ -21015,7 +21427,7 @@ def_optimize(AST_Binary, function(self, compressor) {
21015
21427
  // a + -b => a - b
21016
21428
  if (self.right instanceof AST_UnaryPrefix
21017
21429
  && self.right.operator == "-"
21018
- && self.left.is_number(compressor)) {
21430
+ && self.left.is_number_or_bigint(compressor)) {
21019
21431
  self = make_node(AST_Binary, self, {
21020
21432
  operator: "-",
21021
21433
  left: self.left,
@@ -21027,7 +21439,7 @@ def_optimize(AST_Binary, function(self, compressor) {
21027
21439
  if (self.left instanceof AST_UnaryPrefix
21028
21440
  && self.left.operator == "-"
21029
21441
  && reversible()
21030
- && self.right.is_number(compressor)) {
21442
+ && self.right.is_number_or_bigint(compressor)) {
21031
21443
  self = make_node(AST_Binary, self, {
21032
21444
  operator: "-",
21033
21445
  left: self.right,
@@ -21071,8 +21483,9 @@ def_optimize(AST_Binary, function(self, compressor) {
21071
21483
  case "|":
21072
21484
  case "^":
21073
21485
  // a + +b => +b + a
21074
- if (self.left.is_number(compressor)
21075
- && self.right.is_number(compressor)
21486
+ if (
21487
+ self.left.is_number_or_bigint(compressor)
21488
+ && self.right.is_number_or_bigint(compressor)
21076
21489
  && reversible()
21077
21490
  && !(self.left instanceof AST_Binary
21078
21491
  && self.left.operator != self.operator
@@ -21089,7 +21502,7 @@ def_optimize(AST_Binary, function(self, compressor) {
21089
21502
  self = best_of(compressor, self, reversed);
21090
21503
  }
21091
21504
  }
21092
- if (associative && self.is_number(compressor)) {
21505
+ if (associative && self.is_number_or_bigint(compressor)) {
21093
21506
  // a + (b + c) => (a + b) + c
21094
21507
  if (self.right instanceof AST_Binary
21095
21508
  && self.right.operator == self.operator) {
@@ -21208,18 +21621,31 @@ def_optimize(AST_Binary, function(self, compressor) {
21208
21621
  }
21209
21622
  }
21210
21623
 
21211
- // x ^ x => 0
21212
21624
  // x | x => 0 | x
21213
21625
  // x & x => 0 | x
21214
- const same_operands = self.left.equivalent_to(self.right) && !self.left.has_side_effects(compressor);
21215
- if (same_operands) {
21216
- if (self.operator === "^") {
21217
- return make_node(AST_Number, self, { value: 0 });
21218
- }
21219
- if (self.operator === "|" || self.operator === "&") {
21220
- self.left = make_node(AST_Number, self, { value: 0 });
21221
- self.operator = "|";
21222
- }
21626
+ if (
21627
+ (self.operator === "|" || self.operator === "&")
21628
+ && self.left.equivalent_to(self.right)
21629
+ && !self.left.has_side_effects(compressor)
21630
+ && compressor.in_32_bit_context(true)
21631
+ ) {
21632
+ self.left = make_node(AST_Number, self, { value: 0 });
21633
+ self.operator = "|";
21634
+ }
21635
+
21636
+ // ~x ^ ~y => x ^ y
21637
+ if (
21638
+ self.operator === "^"
21639
+ && self.left instanceof AST_UnaryPrefix
21640
+ && self.left.operator === "~"
21641
+ && self.right instanceof AST_UnaryPrefix
21642
+ && self.right.operator === "~"
21643
+ ) {
21644
+ self = make_node(AST_Binary, self, {
21645
+ operator: "^",
21646
+ left: self.left.expression,
21647
+ right: self.right.expression
21648
+ });
21223
21649
  }
21224
21650
 
21225
21651
 
@@ -21243,7 +21669,7 @@ def_optimize(AST_Binary, function(self, compressor) {
21243
21669
  if (
21244
21670
  zero_side
21245
21671
  && (self.operator === "|" || self.operator === "^")
21246
- && (non_zero_side.is_32_bit_integer() || compressor.in_32_bit_context())
21672
+ && (non_zero_side.is_32_bit_integer(compressor) || compressor.in_32_bit_context(true))
21247
21673
  ) {
21248
21674
  return non_zero_side;
21249
21675
  }
@@ -21253,65 +21679,48 @@ def_optimize(AST_Binary, function(self, compressor) {
21253
21679
  zero_side
21254
21680
  && self.operator === "&"
21255
21681
  && !non_zero_side.has_side_effects(compressor)
21682
+ && non_zero_side.is_32_bit_integer(compressor)
21256
21683
  ) {
21257
21684
  return zero_side;
21258
21685
  }
21259
21686
 
21687
+ // ~0 is all ones, as well as -1.
21688
+ // We can ellide some operations with it.
21260
21689
  const is_full_mask = (node) =>
21261
21690
  node instanceof AST_Number && node.value === -1
21262
21691
  ||
21263
- node instanceof AST_UnaryPrefix && (
21264
- node.operator === "-"
21265
- && node.expression instanceof AST_Number
21266
- && node.expression.value === 1
21267
- || node.operator === "~"
21268
- && node.expression instanceof AST_Number
21269
- && node.expression.value === 0);
21692
+ node instanceof AST_UnaryPrefix
21693
+ && node.operator === "-"
21694
+ && node.expression instanceof AST_Number
21695
+ && node.expression.value === 1;
21270
21696
 
21271
21697
  const full_mask = is_full_mask(self.right) ? self.right
21272
21698
  : is_full_mask(self.left) ? self.left
21273
21699
  : null;
21274
- const non_full_mask_side = full_mask && (full_mask === self.right ? self.left : self.right);
21700
+ const other_side = (full_mask === self.right ? self.left : self.right);
21275
21701
 
21276
- switch (self.operator) {
21277
- case "|":
21278
- // {anything} | -1 => -1
21279
- if (full_mask && !non_full_mask_side.has_side_effects(compressor)) {
21280
- return full_mask;
21281
- }
21282
-
21283
- break;
21284
- case "&":
21285
- // {32 bit integer} & -1 => {32 bit integer}
21286
- if (
21287
- full_mask
21288
- && (non_full_mask_side.is_32_bit_integer() || compressor.in_32_bit_context())
21289
- ) {
21290
- return non_full_mask_side;
21291
- }
21292
-
21293
- break;
21294
- case "^":
21295
- // {anything} ^ -1 => ~{anything}
21296
- if (full_mask) {
21297
- return non_full_mask_side.bitwise_negate(compressor.in_32_bit_context());
21298
- }
21299
-
21300
- // ~x ^ ~y => x ^ y
21301
- if (
21302
- self.left instanceof AST_UnaryPrefix
21303
- && self.left.operator === "~"
21304
- && self.right instanceof AST_UnaryPrefix
21305
- && self.right.operator === "~"
21306
- ) {
21307
- self = make_node(AST_Binary, self, {
21308
- operator: "^",
21309
- left: self.left.expression,
21310
- right: self.right.expression
21311
- });
21312
- }
21702
+ // {32 bit integer} & -1 => {32 bit integer}
21703
+ if (
21704
+ full_mask
21705
+ && self.operator === "&"
21706
+ && (
21707
+ other_side.is_32_bit_integer(compressor)
21708
+ || compressor.in_32_bit_context(true)
21709
+ )
21710
+ ) {
21711
+ return other_side;
21712
+ }
21313
21713
 
21314
- break;
21714
+ // {anything} ^ -1 => ~{anything}
21715
+ if (
21716
+ full_mask
21717
+ && self.operator === "^"
21718
+ && (
21719
+ other_side.is_32_bit_integer(compressor)
21720
+ || compressor.in_32_bit_context(true)
21721
+ )
21722
+ ) {
21723
+ return other_side.bitwise_negate(compressor);
21315
21724
  }
21316
21725
  }
21317
21726
  }
@@ -21934,6 +22343,7 @@ function safe_to_flatten(value, compressor) {
21934
22343
  AST_PropAccess.DEFMETHOD("flatten_object", function(key, compressor) {
21935
22344
  if (!compressor.option("properties")) return;
21936
22345
  if (key === "__proto__") return;
22346
+ if (this instanceof AST_DotHash) return;
21937
22347
 
21938
22348
  var arrows = compressor.option("unsafe_arrows") && compressor.option("ecma") >= 2015;
21939
22349
  var expr = this.expression;
@@ -21946,7 +22356,7 @@ AST_PropAccess.DEFMETHOD("flatten_object", function(key, compressor) {
21946
22356
  if ("" + (prop instanceof AST_ConciseMethod ? prop.key.name : prop.key) == key) {
21947
22357
  const all_props_flattenable = props.every((p) =>
21948
22358
  (p instanceof AST_ObjectKeyVal
21949
- || arrows && p instanceof AST_ConciseMethod && !p.is_generator
22359
+ || arrows && p instanceof AST_ConciseMethod && !p.value.is_generator
21950
22360
  )
21951
22361
  && !p.computed_key()
21952
22362
  );
@@ -22121,7 +22531,15 @@ def_optimize(AST_Chain, function (self, compressor) {
22121
22531
  }
22122
22532
  return make_node(AST_Undefined, self);
22123
22533
  }
22124
- return self;
22534
+ if (
22535
+ self.expression instanceof AST_PropAccess
22536
+ || self.expression instanceof AST_Call
22537
+ ) {
22538
+ return self;
22539
+ } else {
22540
+ // Keep the AST valid, in case the child swapped itself
22541
+ return self.expression;
22542
+ }
22125
22543
  });
22126
22544
 
22127
22545
  def_optimize(AST_Dot, function(self, compressor) {
@@ -22353,7 +22771,7 @@ def_optimize(AST_TemplateString, function(self, compressor) {
22353
22771
  && segments[1] instanceof AST_Node
22354
22772
  && (
22355
22773
  segments[1].is_string(compressor)
22356
- || segments[1].is_number(compressor)
22774
+ || segments[1].is_number_or_bigint(compressor)
22357
22775
  || is_nullish(segments[1], compressor)
22358
22776
  || compressor.option("unsafe")
22359
22777
  )
@@ -22424,7 +22842,7 @@ def_optimize(AST_ConciseMethod, function(self, compressor) {
22424
22842
  // p(){return x;} ---> p:()=>x
22425
22843
  if (compressor.option("arrows")
22426
22844
  && compressor.parent() instanceof AST_Object
22427
- && !self.is_generator
22845
+ && !self.value.is_generator
22428
22846
  && !self.value.uses_arguments
22429
22847
  && !self.value.pinned()
22430
22848
  && self.value.body.length == 1
@@ -22432,8 +22850,8 @@ def_optimize(AST_ConciseMethod, function(self, compressor) {
22432
22850
  && self.value.body[0].value
22433
22851
  && !self.value.contains_this()) {
22434
22852
  var arrow = make_node(AST_Arrow, self.value, self.value);
22435
- arrow.async = self.async;
22436
- arrow.is_generator = self.is_generator;
22853
+ arrow.async = self.value.async;
22854
+ arrow.is_generator = self.value.is_generator;
22437
22855
  return make_node(AST_ObjectKeyVal, self, {
22438
22856
  key: self.key instanceof AST_SymbolMethod ? self.key.name : self.key,
22439
22857
  value: arrow,
@@ -22461,8 +22879,6 @@ def_optimize(AST_ObjectKeyVal, function(self, compressor) {
22461
22879
  && !value.contains_this();
22462
22880
  if ((is_arrow_with_block || value instanceof AST_Function) && !value.name) {
22463
22881
  return make_node(AST_ConciseMethod, self, {
22464
- async: value.async,
22465
- is_generator: value.is_generator,
22466
22882
  key: key instanceof AST_Node ? key : make_node(AST_SymbolMethod, self, {
22467
22883
  name: key,
22468
22884
  }),
@@ -22782,6 +23198,7 @@ var domprops = [
22782
23198
  "-webkit-flex-grow",
22783
23199
  "-webkit-flex-shrink",
22784
23200
  "-webkit-flex-wrap",
23201
+ "-webkit-font-feature-settings",
22785
23202
  "-webkit-justify-content",
22786
23203
  "-webkit-line-clamp",
22787
23204
  "-webkit-mask",
@@ -22812,27 +23229,6 @@ var domprops = [
22812
23229
  "-webkit-transition-property",
22813
23230
  "-webkit-transition-timing-function",
22814
23231
  "-webkit-user-select",
22815
- "0",
22816
- "1",
22817
- "10",
22818
- "11",
22819
- "12",
22820
- "13",
22821
- "14",
22822
- "15",
22823
- "16",
22824
- "17",
22825
- "18",
22826
- "19",
22827
- "2",
22828
- "20",
22829
- "3",
22830
- "4",
22831
- "5",
22832
- "6",
22833
- "7",
22834
- "8",
22835
- "9",
22836
23232
  "@@iterator",
22837
23233
  "ABORT_ERR",
22838
23234
  "ACTIVE",
@@ -22875,6 +23271,7 @@ var domprops = [
22875
23271
  "AnimationTimeline",
22876
23272
  "AnonXMLHttpRequest",
22877
23273
  "Any",
23274
+ "AnyPermissions",
22878
23275
  "ApplicationCache",
22879
23276
  "ApplicationCacheErrorEvent",
22880
23277
  "Array",
@@ -22960,6 +23357,7 @@ var domprops = [
22960
23357
  "Boolean",
22961
23358
  "BroadcastChannel",
22962
23359
  "BrowserCaptureMediaStreamTrack",
23360
+ "BrowserInfo",
22963
23361
  "ByteLengthQueuingStrategy",
22964
23362
  "CAPTURING_PHASE",
22965
23363
  "CCW",
@@ -23035,6 +23433,7 @@ var domprops = [
23035
23433
  "CSSKeywordValue",
23036
23434
  "CSSLayerBlockRule",
23037
23435
  "CSSLayerStatementRule",
23436
+ "CSSMarginRule",
23038
23437
  "CSSMathClamp",
23039
23438
  "CSSMathInvert",
23040
23439
  "CSSMathMax",
@@ -23048,10 +23447,14 @@ var domprops = [
23048
23447
  "CSSMozDocumentRule",
23049
23448
  "CSSNameSpaceRule",
23050
23449
  "CSSNamespaceRule",
23450
+ "CSSNestedDeclarations",
23051
23451
  "CSSNumericArray",
23052
23452
  "CSSNumericValue",
23453
+ "CSSPageDescriptors",
23053
23454
  "CSSPageRule",
23054
23455
  "CSSPerspective",
23456
+ "CSSPositionTryDescriptors",
23457
+ "CSSPositionTryRule",
23055
23458
  "CSSPositionValue",
23056
23459
  "CSSPrimitiveValue",
23057
23460
  "CSSPropertyRule",
@@ -23081,6 +23484,7 @@ var domprops = [
23081
23484
  "CSSVariableReferenceValue",
23082
23485
  "CSSVariablesDeclaration",
23083
23486
  "CSSVariablesRule",
23487
+ "CSSViewTransitionRule",
23084
23488
  "CSSViewportRule",
23085
23489
  "CSS_ATTR",
23086
23490
  "CSS_CM",
@@ -23167,6 +23571,7 @@ var domprops = [
23167
23571
  "CaretPosition",
23168
23572
  "ChannelMergerNode",
23169
23573
  "ChannelSplitterNode",
23574
+ "ChapterInformation",
23170
23575
  "CharacterBoundsUpdateEvent",
23171
23576
  "CharacterData",
23172
23577
  "ClientRect",
@@ -23175,7 +23580,10 @@ var domprops = [
23175
23580
  "ClipboardEvent",
23176
23581
  "ClipboardItem",
23177
23582
  "CloseEvent",
23583
+ "CloseWatcher",
23178
23584
  "Collator",
23585
+ "ColorArray",
23586
+ "ColorValue",
23179
23587
  "CommandEvent",
23180
23588
  "Comment",
23181
23589
  "CompileError",
@@ -23184,6 +23592,8 @@ var domprops = [
23184
23592
  "Console",
23185
23593
  "ConstantSourceNode",
23186
23594
  "ContentVisibilityAutoStateChangeEvent",
23595
+ "ContextFilter",
23596
+ "ContextType",
23187
23597
  "Controllers",
23188
23598
  "ConvolverNode",
23189
23599
  "CookieChangeEvent",
@@ -23191,6 +23601,7 @@ var domprops = [
23191
23601
  "CookieStoreManager",
23192
23602
  "CountQueuingStrategy",
23193
23603
  "Counter",
23604
+ "CreateType",
23194
23605
  "Credential",
23195
23606
  "CredentialsContainer",
23196
23607
  "CropTarget",
@@ -23693,6 +24104,7 @@ var domprops = [
23693
24104
  "DeprecationReportBody",
23694
24105
  "DesktopNotification",
23695
24106
  "DesktopNotificationCenter",
24107
+ "Details",
23696
24108
  "DeviceLightEvent",
23697
24109
  "DeviceMotionEvent",
23698
24110
  "DeviceMotionEventAcceleration",
@@ -23710,6 +24122,7 @@ var domprops = [
23710
24122
  "DocumentTimeline",
23711
24123
  "DocumentType",
23712
24124
  "DragEvent",
24125
+ "DurationFormat",
23713
24126
  "DynamicsCompressorNode",
23714
24127
  "E",
23715
24128
  "ELEMENT_ARRAY_BUFFER",
@@ -23745,6 +24158,11 @@ var domprops = [
23745
24158
  "EventSource",
23746
24159
  "EventTarget",
23747
24160
  "Exception",
24161
+ "ExtensionContext",
24162
+ "ExtensionDisabledReason",
24163
+ "ExtensionInfo",
24164
+ "ExtensionInstallType",
24165
+ "ExtensionType",
23748
24166
  "External",
23749
24167
  "EyeDropper",
23750
24168
  "FASTEST",
@@ -23826,6 +24244,7 @@ var domprops = [
23826
24244
  "FileSystemWritableFileStream",
23827
24245
  "FinalizationRegistry",
23828
24246
  "FindInPage",
24247
+ "Float16Array",
23829
24248
  "Float32Array",
23830
24249
  "Float64Array",
23831
24250
  "FocusEvent",
@@ -23895,6 +24314,7 @@ var domprops = [
23895
24314
  "GeolocationPosition",
23896
24315
  "GeolocationPositionError",
23897
24316
  "GestureEvent",
24317
+ "GetInfo",
23898
24318
  "Global",
23899
24319
  "GravitySensor",
23900
24320
  "Gyroscope",
@@ -24068,6 +24488,7 @@ var domprops = [
24068
24488
  "INVERSE_DISTANCE",
24069
24489
  "INVERT",
24070
24490
  "IceCandidate",
24491
+ "IconInfo",
24071
24492
  "IdentityCredential",
24072
24493
  "IdentityCredentialError",
24073
24494
  "IdentityProvider",
@@ -24078,6 +24499,7 @@ var domprops = [
24078
24499
  "ImageBitmapRenderingContext",
24079
24500
  "ImageCapture",
24080
24501
  "ImageData",
24502
+ "ImageDataType",
24081
24503
  "ImageDecoder",
24082
24504
  "ImageTrack",
24083
24505
  "ImageTrackList",
@@ -24142,9 +24564,11 @@ var domprops = [
24142
24564
  "LSParserFilter",
24143
24565
  "LUMINANCE",
24144
24566
  "LUMINANCE_ALPHA",
24567
+ "LanguageCode",
24145
24568
  "LargestContentfulPaint",
24146
24569
  "LaunchParams",
24147
24570
  "LaunchQueue",
24571
+ "LaunchType",
24148
24572
  "LayoutShift",
24149
24573
  "LayoutShiftAttribution",
24150
24574
  "LinearAccelerationSensor",
@@ -24157,9 +24581,11 @@ var domprops = [
24157
24581
  "LockManager",
24158
24582
  "MAP_READ",
24159
24583
  "MAP_WRITE",
24584
+ "MARGIN_RULE",
24160
24585
  "MAX",
24161
24586
  "MAX_3D_TEXTURE_SIZE",
24162
24587
  "MAX_ARRAY_TEXTURE_LAYERS",
24588
+ "MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND",
24163
24589
  "MAX_CLIENT_WAIT_TIMEOUT_WEBGL",
24164
24590
  "MAX_COLOR_ATTACHMENTS",
24165
24591
  "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",
@@ -24311,6 +24737,7 @@ var domprops = [
24311
24737
  "MediaStreamEvent",
24312
24738
  "MediaStreamTrack",
24313
24739
  "MediaStreamTrackAudioSourceNode",
24740
+ "MediaStreamTrackAudioStats",
24314
24741
  "MediaStreamTrackEvent",
24315
24742
  "MediaStreamTrackGenerator",
24316
24743
  "MediaStreamTrackProcessor",
@@ -24319,6 +24746,7 @@ var domprops = [
24319
24746
  "MessageChannel",
24320
24747
  "MessageEvent",
24321
24748
  "MessagePort",
24749
+ "MessageSender",
24322
24750
  "Methods",
24323
24751
  "MimeType",
24324
24752
  "MimeTypeArray",
@@ -24420,6 +24848,8 @@ var domprops = [
24420
24848
  "MutationEvent",
24421
24849
  "MutationObserver",
24422
24850
  "MutationRecord",
24851
+ "MutedInfo",
24852
+ "MutedInfoReason",
24423
24853
  "NAMESPACE_ERR",
24424
24854
  "NAMESPACE_RULE",
24425
24855
  "NEAREST",
@@ -24507,6 +24937,11 @@ var domprops = [
24507
24937
  "OfflineResourceList",
24508
24938
  "OffscreenCanvas",
24509
24939
  "OffscreenCanvasRenderingContext2D",
24940
+ "OnClickData",
24941
+ "OnInstalledReason",
24942
+ "OnPerformanceWarningCategory",
24943
+ "OnPerformanceWarningSeverity",
24944
+ "OnRestartRequiredReason",
24510
24945
  "Option",
24511
24946
  "OrientationSensor",
24512
24947
  "OscillatorNode",
@@ -24559,6 +24994,7 @@ var domprops = [
24559
24994
  "PROCESSING_INSTRUCTION_NODE",
24560
24995
  "PageChangeEvent",
24561
24996
  "PageRevealEvent",
24997
+ "PageSettings",
24562
24998
  "PageSwapEvent",
24563
24999
  "PageTransitionEvent",
24564
25000
  "PaintRequest",
@@ -24597,12 +25033,17 @@ var domprops = [
24597
25033
  "PhotoCapabilities",
24598
25034
  "PictureInPictureEvent",
24599
25035
  "PictureInPictureWindow",
25036
+ "PlatformArch",
25037
+ "PlatformInfo",
25038
+ "PlatformNaclArch",
25039
+ "PlatformOs",
24600
25040
  "Plugin",
24601
25041
  "PluginArray",
24602
25042
  "PluralRules",
24603
25043
  "PointerEvent",
24604
25044
  "PopStateEvent",
24605
25045
  "PopupBlockedEvent",
25046
+ "Port",
24606
25047
  "Presentation",
24607
25048
  "PresentationAvailability",
24608
25049
  "PresentationConnection",
@@ -24611,12 +25052,15 @@ var domprops = [
24611
25052
  "PresentationConnectionList",
24612
25053
  "PresentationReceiver",
24613
25054
  "PresentationRequest",
25055
+ "PressureObserver",
25056
+ "PressureRecord",
24614
25057
  "ProcessingInstruction",
24615
25058
  "Profiler",
24616
25059
  "ProgressEvent",
24617
25060
  "Promise",
24618
25061
  "PromiseRejectionEvent",
24619
25062
  "PropertyNodeList",
25063
+ "ProtectedAudience",
24620
25064
  "Proxy",
24621
25065
  "PublicKeyCredential",
24622
25066
  "PushManager",
@@ -24764,6 +25208,7 @@ var domprops = [
24764
25208
  "ReportBody",
24765
25209
  "ReportingObserver",
24766
25210
  "Request",
25211
+ "RequestUpdateCheckStatus",
24767
25212
  "ResizeObserver",
24768
25213
  "ResizeObserverEntry",
24769
25214
  "ResizeObserverSize",
@@ -25176,7 +25621,9 @@ var domprops = [
25176
25621
  "SharedStorage",
25177
25622
  "SharedStorageWorklet",
25178
25623
  "SharedWorker",
25624
+ "SharingState",
25179
25625
  "SimpleGestureEvent",
25626
+ "SnapEvent",
25180
25627
  "SourceBuffer",
25181
25628
  "SourceBufferList",
25182
25629
  "SpeechSynthesis",
@@ -25203,6 +25650,8 @@ var domprops = [
25203
25650
  "Symbol",
25204
25651
  "SyncManager",
25205
25652
  "SyntaxError",
25653
+ "TAB_ID_NONE",
25654
+ "TAB_INDEX_NONE",
25206
25655
  "TEMPORARY",
25207
25656
  "TEXTPATH_METHODTYPE_ALIGN",
25208
25657
  "TEXTPATH_METHODTYPE_STRETCH",
@@ -25300,6 +25749,8 @@ var domprops = [
25300
25749
  "TYPE_NAVIGATE",
25301
25750
  "TYPE_RELOAD",
25302
25751
  "TYPE_RESERVED",
25752
+ "Tab",
25753
+ "TabStatus",
25303
25754
  "Table",
25304
25755
  "Tag",
25305
25756
  "TaskAttributionTiming",
@@ -25422,6 +25873,8 @@ var domprops = [
25422
25873
  "Uint32Array",
25423
25874
  "Uint8Array",
25424
25875
  "Uint8ClampedArray",
25876
+ "UpdateFilter",
25877
+ "UpdatePropertyName",
25425
25878
  "UserActivation",
25426
25879
  "UserMessageHandler",
25427
25880
  "UserMessageHandlersNamespace",
@@ -25470,6 +25923,8 @@ var domprops = [
25470
25923
  "VideoStreamTrack",
25471
25924
  "ViewTimeline",
25472
25925
  "ViewTransition",
25926
+ "ViewTransitionTypeSet",
25927
+ "ViewType",
25473
25928
  "VirtualKeyboard",
25474
25929
  "VirtualKeyboardGeometryChangeEvent",
25475
25930
  "VisibilityStateEntry",
@@ -25480,6 +25935,8 @@ var domprops = [
25480
25935
  "WEBKIT_KEYFRAME_RULE",
25481
25936
  "WEBKIT_REGION_RULE",
25482
25937
  "WGSLLanguageFeatures",
25938
+ "WINDOW_ID_CURRENT",
25939
+ "WINDOW_ID_NONE",
25483
25940
  "WRITE",
25484
25941
  "WRONG_DOCUMENT_ERR",
25485
25942
  "WakeLock",
@@ -25495,6 +25952,7 @@ var domprops = [
25495
25952
  "WebGLBuffer",
25496
25953
  "WebGLContextEvent",
25497
25954
  "WebGLFramebuffer",
25955
+ "WebGLObject",
25498
25956
  "WebGLProgram",
25499
25957
  "WebGLQuery",
25500
25958
  "WebGLRenderbuffer",
@@ -25581,6 +26039,7 @@ var domprops = [
25581
26039
  "WebkitFlexGrow",
25582
26040
  "WebkitFlexShrink",
25583
26041
  "WebkitFlexWrap",
26042
+ "WebkitFontFeatureSettings",
25584
26043
  "WebkitJustifyContent",
25585
26044
  "WebkitLineClamp",
25586
26045
  "WebkitMask",
@@ -25615,6 +26074,8 @@ var domprops = [
25615
26074
  "Window",
25616
26075
  "WindowControlsOverlay",
25617
26076
  "WindowControlsOverlayGeometryChangeEvent",
26077
+ "WindowState",
26078
+ "WindowType",
25618
26079
  "Worker",
25619
26080
  "Worklet",
25620
26081
  "WritableStream",
@@ -25641,12 +26102,15 @@ var domprops = [
25641
26102
  "XRDOMOverlayState",
25642
26103
  "XRDepthInformation",
25643
26104
  "XRFrame",
26105
+ "XRHand",
25644
26106
  "XRHitTestResult",
25645
26107
  "XRHitTestSource",
25646
26108
  "XRInputSource",
25647
26109
  "XRInputSourceArray",
25648
26110
  "XRInputSourceEvent",
25649
26111
  "XRInputSourcesChangeEvent",
26112
+ "XRJointPose",
26113
+ "XRJointSpace",
25650
26114
  "XRLayer",
25651
26115
  "XRLightEstimate",
25652
26116
  "XRLightProbe",
@@ -25670,6 +26134,9 @@ var domprops = [
25670
26134
  "XRWebGLLayer",
25671
26135
  "XSLTProcessor",
25672
26136
  "ZERO",
26137
+ "ZoomSettings",
26138
+ "ZoomSettingsMode",
26139
+ "ZoomSettingsScope",
25673
26140
  "_XD0M_",
25674
26141
  "_YD0M_",
25675
26142
  "__REACT_DEVTOOLS_GLOBAL_HOOK__",
@@ -25686,6 +26153,7 @@ var domprops = [
25686
26153
  "abbr",
25687
26154
  "abort",
25688
26155
  "aborted",
26156
+ "aboutConfigPrefs",
25689
26157
  "abs",
25690
26158
  "absolute",
25691
26159
  "acceleration",
@@ -25715,6 +26183,7 @@ var domprops = [
25715
26183
  "activeSourceCount",
25716
26184
  "activeTexture",
25717
26185
  "activeVRDisplays",
26186
+ "activityLog",
25718
26187
  "actualBoundingBoxAscent",
25719
26188
  "actualBoundingBoxDescent",
25720
26189
  "actualBoundingBoxLeft",
@@ -25766,6 +26235,7 @@ var domprops = [
25766
26235
  "adr",
25767
26236
  "advance",
25768
26237
  "after",
26238
+ "alarms",
25769
26239
  "album",
25770
26240
  "alert",
25771
26241
  "algorithm",
@@ -25872,6 +26342,7 @@ var domprops = [
25872
26342
  "applyElement",
25873
26343
  "arc",
25874
26344
  "arcTo",
26345
+ "arch",
25875
26346
  "architecture",
25876
26347
  "archive",
25877
26348
  "areas",
@@ -25939,6 +26410,7 @@ var domprops = [
25939
26410
  "assignedNodes",
25940
26411
  "assignedSlot",
25941
26412
  "async",
26413
+ "asyncDispose",
25942
26414
  "asyncIterator",
25943
26415
  "at",
25944
26416
  "atEnd",
@@ -25986,6 +26458,7 @@ var domprops = [
25986
26458
  "availWidth",
25987
26459
  "availability",
25988
26460
  "available",
26461
+ "averageLatency",
25989
26462
  "aversion",
25990
26463
  "ax",
25991
26464
  "axes",
@@ -26254,7 +26727,10 @@ var domprops = [
26254
26727
  "breakBefore",
26255
26728
  "breakInside",
26256
26729
  "broadcast",
26730
+ "browser",
26257
26731
  "browserLanguage",
26732
+ "browserSettings",
26733
+ "browsingData",
26258
26734
  "browsingTopics",
26259
26735
  "btoa",
26260
26736
  "bubbles",
@@ -26275,6 +26751,7 @@ var domprops = [
26275
26751
  "byobRequest",
26276
26752
  "byteLength",
26277
26753
  "byteOffset",
26754
+ "bytes",
26278
26755
  "bytesPerRow",
26279
26756
  "bytesWritten",
26280
26757
  "c",
@@ -26319,10 +26796,13 @@ var domprops = [
26319
26796
  "caption",
26320
26797
  "caption-side",
26321
26798
  "captionSide",
26799
+ "captivePortal",
26322
26800
  "capture",
26323
26801
  "captureEvents",
26324
26802
  "captureStackTrace",
26325
26803
  "captureStream",
26804
+ "captureTab",
26805
+ "captureVisibleTab",
26326
26806
  "caret-color",
26327
26807
  "caretBidiLevel",
26328
26808
  "caretColor",
@@ -26349,6 +26829,7 @@ var domprops = [
26349
26829
  "channelCount",
26350
26830
  "channelCountMode",
26351
26831
  "channelInterpretation",
26832
+ "chapterInfo",
26352
26833
  "char",
26353
26834
  "charAt",
26354
26835
  "charCode",
@@ -26503,7 +26984,9 @@ var domprops = [
26503
26984
  "columnWidth",
26504
26985
  "columns",
26505
26986
  "command",
26987
+ "commands",
26506
26988
  "commit",
26989
+ "commitLoadTime",
26507
26990
  "commitPreferences",
26508
26991
  "commitStyles",
26509
26992
  "commonAncestorContainer",
@@ -26554,11 +27037,13 @@ var domprops = [
26554
27037
  "congestionControl",
26555
27038
  "connect",
26556
27039
  "connectEnd",
27040
+ "connectNative",
26557
27041
  "connectShark",
26558
27042
  "connectStart",
26559
27043
  "connected",
26560
27044
  "connectedCallback",
26561
27045
  "connection",
27046
+ "connectionInfo",
26562
27047
  "connectionList",
26563
27048
  "connectionSpeed",
26564
27049
  "connectionState",
@@ -26606,8 +27091,14 @@ var domprops = [
26606
27091
  "contentVisibility",
26607
27092
  "contentWindow",
26608
27093
  "context",
27094
+ "contextId",
27095
+ "contextIds",
26609
27096
  "contextMenu",
27097
+ "contextMenus",
27098
+ "contextType",
27099
+ "contextTypes",
26610
27100
  "contextmenu",
27101
+ "contextualIdentities",
26611
27102
  "continue",
26612
27103
  "continuePrimaryKey",
26613
27104
  "continuous",
@@ -26799,6 +27290,7 @@ var domprops = [
26799
27290
  "createVertexArray",
26800
27291
  "createView",
26801
27292
  "createWaveShaper",
27293
+ "createWorklet",
26802
27294
  "createWritable",
26803
27295
  "creationTime",
26804
27296
  "credentialless",
@@ -26819,6 +27311,7 @@ var domprops = [
26819
27311
  "cues",
26820
27312
  "cullFace",
26821
27313
  "cullMode",
27314
+ "currentCSSZoom",
26822
27315
  "currentDirection",
26823
27316
  "currentEntry",
26824
27317
  "currentLocalDescription",
@@ -26859,6 +27352,7 @@ var domprops = [
26859
27352
  "db",
26860
27353
  "debug",
26861
27354
  "debuggerEnabled",
27355
+ "declarativeNetRequest",
26862
27356
  "declare",
26863
27357
  "decode",
26864
27358
  "decodeAudioData",
@@ -26923,6 +27417,7 @@ var domprops = [
26923
27417
  "deleted",
26924
27418
  "deliverChangeRecords",
26925
27419
  "deliveredFrames",
27420
+ "deliveredFramesDuration",
26926
27421
  "delivery",
26927
27422
  "deliveryInfo",
26928
27423
  "deliveryStatus",
@@ -26976,6 +27471,7 @@ var domprops = [
26976
27471
  "detail",
26977
27472
  "details",
26978
27473
  "detect",
27474
+ "detectLanguage",
26979
27475
  "detune",
26980
27476
  "device",
26981
27477
  "deviceClass",
@@ -26990,6 +27486,8 @@ var domprops = [
26990
27486
  "deviceVersionSubminor",
26991
27487
  "deviceXDPI",
26992
27488
  "deviceYDPI",
27489
+ "devtools",
27490
+ "devtools_panels",
26993
27491
  "didTimeout",
26994
27492
  "difference",
26995
27493
  "diffuseConstant",
@@ -27005,6 +27503,7 @@ var domprops = [
27005
27503
  "disableRemotePlayback",
27006
27504
  "disableVertexAttribArray",
27007
27505
  "disabled",
27506
+ "discard",
27008
27507
  "discardedFrames",
27009
27508
  "dischargingTime",
27010
27509
  "disconnect",
@@ -27018,25 +27517,35 @@ var domprops = [
27018
27517
  "displayId",
27019
27518
  "displayName",
27020
27519
  "displayWidth",
27520
+ "dispose",
27021
27521
  "disposition",
27022
27522
  "distanceModel",
27023
27523
  "div",
27024
27524
  "divisor",
27025
27525
  "djsapi",
27026
27526
  "djsproxy",
27527
+ "dns",
27027
27528
  "doImport",
27028
27529
  "doNotTrack",
27029
27530
  "doScroll",
27030
27531
  "doctype",
27031
27532
  "document",
27032
27533
  "documentElement",
27534
+ "documentId",
27535
+ "documentIds",
27536
+ "documentLifecycle",
27033
27537
  "documentMode",
27538
+ "documentOrigin",
27539
+ "documentOrigins",
27034
27540
  "documentPictureInPicture",
27035
27541
  "documentURI",
27542
+ "documentUrl",
27543
+ "documentUrls",
27036
27544
  "dolphin",
27037
27545
  "dolphinGameCenter",
27038
27546
  "dolphininfo",
27039
27547
  "dolphinmeta",
27548
+ "dom",
27040
27549
  "domComplete",
27041
27550
  "domContentLoadedEventEnd",
27042
27551
  "domContentLoadedEventStart",
@@ -27057,6 +27566,7 @@ var domprops = [
27057
27566
  "downloadRequest",
27058
27567
  "downloadTotal",
27059
27568
  "downloaded",
27569
+ "downloads",
27060
27570
  "dpcm",
27061
27571
  "dpi",
27062
27572
  "dppx",
@@ -27092,6 +27602,7 @@ var domprops = [
27092
27602
  "dtmf",
27093
27603
  "dump",
27094
27604
  "dumpProfile",
27605
+ "duplex",
27095
27606
  "duplicate",
27096
27607
  "durability",
27097
27608
  "duration",
@@ -27105,6 +27616,7 @@ var domprops = [
27105
27616
  "dvw",
27106
27617
  "dx",
27107
27618
  "dy",
27619
+ "dynamicId",
27108
27620
  "dynsrc",
27109
27621
  "e",
27110
27622
  "edgeMode",
@@ -27113,6 +27625,7 @@ var domprops = [
27113
27625
  "effectAllowed",
27114
27626
  "effectiveDirective",
27115
27627
  "effectiveType",
27628
+ "effects",
27116
27629
  "elapsedTime",
27117
27630
  "element",
27118
27631
  "elementFromPoint",
@@ -27192,6 +27705,7 @@ var domprops = [
27192
27705
  "event",
27193
27706
  "eventCounts",
27194
27707
  "eventPhase",
27708
+ "events",
27195
27709
  "every",
27196
27710
  "ex",
27197
27711
  "exception",
@@ -27212,6 +27726,7 @@ var domprops = [
27212
27726
  "expando",
27213
27727
  "expansion",
27214
27728
  "expectedImprovement",
27729
+ "experiments",
27215
27730
  "expiration",
27216
27731
  "expirationTime",
27217
27732
  "expires",
@@ -27223,6 +27738,8 @@ var domprops = [
27223
27738
  "exportKey",
27224
27739
  "exports",
27225
27740
  "extend",
27741
+ "extension",
27742
+ "extensionTypes",
27226
27743
  "extensions",
27227
27744
  "extentNode",
27228
27745
  "extentOffset",
@@ -27233,6 +27750,7 @@ var domprops = [
27233
27750
  "extractable",
27234
27751
  "eye",
27235
27752
  "f",
27753
+ "f16round",
27236
27754
  "face",
27237
27755
  "factoryReset",
27238
27756
  "failOp",
@@ -27268,8 +27786,10 @@ var domprops = [
27268
27786
  "fill",
27269
27787
  "fill-opacity",
27270
27788
  "fill-rule",
27789
+ "fillJointRadii",
27271
27790
  "fillLightMode",
27272
27791
  "fillOpacity",
27792
+ "fillPoses",
27273
27793
  "fillRect",
27274
27794
  "fillRule",
27275
27795
  "fillStyle",
@@ -27287,6 +27807,8 @@ var domprops = [
27287
27807
  "findRule",
27288
27808
  "findText",
27289
27809
  "finish",
27810
+ "finishDocumentLoadTime",
27811
+ "finishLoadTime",
27290
27812
  "finished",
27291
27813
  "fireEvent",
27292
27814
  "firesTouchEvents",
@@ -27294,6 +27816,8 @@ var domprops = [
27294
27816
  "firstElementChild",
27295
27817
  "firstInterimResponseStart",
27296
27818
  "firstPage",
27819
+ "firstPaintAfterLoadTime",
27820
+ "firstPaintTime",
27297
27821
  "firstUIEventTimestamp",
27298
27822
  "fixed",
27299
27823
  "flags",
@@ -27413,6 +27937,8 @@ var domprops = [
27413
27937
  "frameBorder",
27414
27938
  "frameCount",
27415
27939
  "frameElement",
27940
+ "frameId",
27941
+ "frameIds",
27416
27942
  "frameSpacing",
27417
27943
  "framebuffer",
27418
27944
  "framebufferHeight",
@@ -27427,12 +27953,14 @@ var domprops = [
27427
27953
  "frequencyBinCount",
27428
27954
  "from",
27429
27955
  "fromAsync",
27956
+ "fromBase64",
27430
27957
  "fromCharCode",
27431
27958
  "fromCodePoint",
27432
27959
  "fromElement",
27433
27960
  "fromEntries",
27434
27961
  "fromFloat32Array",
27435
27962
  "fromFloat64Array",
27963
+ "fromHex",
27436
27964
  "fromMatrix",
27437
27965
  "fromPoint",
27438
27966
  "fromQuad",
@@ -27456,6 +27984,7 @@ var domprops = [
27456
27984
  "gap",
27457
27985
  "gatheringState",
27458
27986
  "gatt",
27987
+ "geckoProfiler",
27459
27988
  "genderIdentity",
27460
27989
  "generateCertificate",
27461
27990
  "generateKey",
@@ -27464,6 +27993,7 @@ var domprops = [
27464
27993
  "geolocation",
27465
27994
  "gestureObject",
27466
27995
  "get",
27996
+ "getAcceptLanguages",
27467
27997
  "getActiveAttrib",
27468
27998
  "getActiveUniform",
27469
27999
  "getActiveUniformBlockName",
@@ -27491,6 +28021,10 @@ var domprops = [
27491
28021
  "getAutoplayPolicy",
27492
28022
  "getAvailability",
27493
28023
  "getBBox",
28024
+ "getBackgroundPage",
28025
+ "getBadgeBackgroundColor",
28026
+ "getBadgeText",
28027
+ "getBadgeTextColor",
27494
28028
  "getBattery",
27495
28029
  "getBigInt64",
27496
28030
  "getBigUint64",
@@ -27500,6 +28034,7 @@ var domprops = [
27500
28034
  "getBoundingClientRect",
27501
28035
  "getBounds",
27502
28036
  "getBoxQuads",
28037
+ "getBrowserInfo",
27503
28038
  "getBufferParameter",
27504
28039
  "getBufferSubData",
27505
28040
  "getByteFrequencyData",
@@ -27528,10 +28063,12 @@ var domprops = [
27528
28063
  "getConstraints",
27529
28064
  "getContext",
27530
28065
  "getContextAttributes",
28066
+ "getContexts",
27531
28067
  "getContributingSources",
27532
28068
  "getCounterValue",
27533
28069
  "getCueAsHTML",
27534
28070
  "getCueById",
28071
+ "getCurrent",
27535
28072
  "getCurrentPosition",
27536
28073
  "getCurrentTexture",
27537
28074
  "getCurrentTime",
@@ -27572,6 +28109,7 @@ var domprops = [
27572
28109
  "getFiles",
27573
28110
  "getFilesAndDirectories",
27574
28111
  "getFingerprints",
28112
+ "getFloat16",
27575
28113
  "getFloat32",
27576
28114
  "getFloat64",
27577
28115
  "getFloatFrequencyData",
@@ -27579,10 +28117,12 @@ var domprops = [
27579
28117
  "getFloatValue",
27580
28118
  "getFragDataLocation",
27581
28119
  "getFrameData",
28120
+ "getFrameId",
27582
28121
  "getFramebufferAttachmentParameter",
27583
28122
  "getFrequencyResponse",
27584
28123
  "getFullYear",
27585
28124
  "getGamepads",
28125
+ "getHTML",
27586
28126
  "getHeaderExtensionsToNegotiate",
27587
28127
  "getHighEntropyValues",
27588
28128
  "getHitTestResults",
@@ -27598,13 +28138,16 @@ var domprops = [
27598
28138
  "getInt16",
27599
28139
  "getInt32",
27600
28140
  "getInt8",
28141
+ "getInterestGroupAdAuctionData",
27601
28142
  "getInternalModuleRanges",
27602
28143
  "getInternalformatParameter",
27603
28144
  "getIntersectionList",
27604
28145
  "getItem",
27605
28146
  "getItems",
28147
+ "getJointPose",
27606
28148
  "getKey",
27607
28149
  "getKeyframes",
28150
+ "getLastFocused",
27608
28151
  "getLayers",
27609
28152
  "getLayoutMap",
27610
28153
  "getLightEstimate",
@@ -27613,11 +28156,13 @@ var domprops = [
27613
28156
  "getLocalParameters",
27614
28157
  "getLocalStreams",
27615
28158
  "getManagedConfiguration",
28159
+ "getManifest",
27616
28160
  "getMappedRange",
27617
28161
  "getMarks",
27618
28162
  "getMatchedCSSRules",
27619
28163
  "getMaxGCPauseSinceClear",
27620
28164
  "getMeasures",
28165
+ "getMessage",
27621
28166
  "getMetadata",
27622
28167
  "getMilliseconds",
27623
28168
  "getMinutes",
@@ -27640,13 +28185,17 @@ var domprops = [
27640
28185
  "getOwnPropertyDescriptors",
27641
28186
  "getOwnPropertyNames",
27642
28187
  "getOwnPropertySymbols",
28188
+ "getPackageDirectoryEntry",
27643
28189
  "getParameter",
27644
28190
  "getParameters",
27645
28191
  "getParent",
27646
28192
  "getPathSegAtLength",
28193
+ "getPermissionWarningsByManifest",
27647
28194
  "getPhotoCapabilities",
27648
28195
  "getPhotoSettings",
28196
+ "getPlatformInfo",
27649
28197
  "getPointAtLength",
28198
+ "getPopup",
27650
28199
  "getPorts",
27651
28200
  "getPose",
27652
28201
  "getPredictedEvents",
@@ -27694,6 +28243,7 @@ var domprops = [
27694
28243
  "getSeconds",
27695
28244
  "getSelectedCandidatePair",
27696
28245
  "getSelection",
28246
+ "getSelf",
27697
28247
  "getSenders",
27698
28248
  "getService",
27699
28249
  "getSetCookie",
@@ -27730,6 +28280,7 @@ var domprops = [
27730
28280
  "getTime",
27731
28281
  "getTimezoneOffset",
27732
28282
  "getTiming",
28283
+ "getTitle",
27733
28284
  "getTitlebarAreaRect",
27734
28285
  "getTotalLength",
27735
28286
  "getTrackById",
@@ -27741,6 +28292,8 @@ var domprops = [
27741
28292
  "getTransports",
27742
28293
  "getType",
27743
28294
  "getTypeMapping",
28295
+ "getUILanguage",
28296
+ "getURL",
27744
28297
  "getUTCDate",
27745
28298
  "getUTCDay",
27746
28299
  "getUTCFullYear",
@@ -27758,6 +28311,7 @@ var domprops = [
27758
28311
  "getUniformLocation",
27759
28312
  "getUserInfo",
27760
28313
  "getUserMedia",
28314
+ "getUserSettings",
27761
28315
  "getVRDisplays",
27762
28316
  "getValues",
27763
28317
  "getVarDate",
@@ -27768,10 +28322,13 @@ var domprops = [
27768
28322
  "getVideoTracks",
27769
28323
  "getViewerPose",
27770
28324
  "getViewport",
28325
+ "getViews",
27771
28326
  "getVoices",
27772
28327
  "getWakeLockState",
27773
28328
  "getWriter",
27774
28329
  "getYear",
28330
+ "getZoom",
28331
+ "getZoomSettings",
27775
28332
  "givenName",
27776
28333
  "global",
27777
28334
  "globalAlpha",
@@ -27782,6 +28339,8 @@ var domprops = [
27782
28339
  "glyphOrientationVertical",
27783
28340
  "glyphRef",
27784
28341
  "go",
28342
+ "goBack",
28343
+ "goForward",
27785
28344
  "gpu",
27786
28345
  "grabFrame",
27787
28346
  "grad",
@@ -27831,6 +28390,10 @@ var domprops = [
27831
28390
  "groupEnd",
27832
28391
  "groupId",
27833
28392
  "groups",
28393
+ "grow",
28394
+ "growable",
28395
+ "guestProcessId",
28396
+ "guestRenderFrameRoutingId",
27834
28397
  "hadRecentInput",
27835
28398
  "hand",
27836
28399
  "handedness",
@@ -27864,6 +28427,7 @@ var domprops = [
27864
28427
  "hasRegExpGroups",
27865
28428
  "hasStorageAccess",
27866
28429
  "hasUAVisualTransition",
28430
+ "hasUnpartitionedCookieAccess",
27867
28431
  "hash",
27868
28432
  "hashChange",
27869
28433
  "head",
@@ -27877,6 +28441,7 @@ var domprops = [
27877
28441
  "hidePopover",
27878
28442
  "high",
27879
28443
  "highWaterMark",
28444
+ "highlight",
27880
28445
  "highlights",
27881
28446
  "hint",
27882
28447
  "hints",
@@ -27901,6 +28466,7 @@ var domprops = [
27901
28466
  "hyphenateCharacter",
27902
28467
  "hyphens",
27903
28468
  "hypot",
28469
+ "i18n",
27904
28470
  "ic",
27905
28471
  "iccId",
27906
28472
  "iceConnectionState",
@@ -27912,6 +28478,7 @@ var domprops = [
27912
28478
  "identifier",
27913
28479
  "identity",
27914
28480
  "ideographicBaseline",
28481
+ "idle",
27915
28482
  "idpLoginUrl",
27916
28483
  "ignoreBOM",
27917
28484
  "ignoreCase",
@@ -27942,8 +28509,10 @@ var domprops = [
27942
28509
  "in1",
27943
28510
  "in2",
27944
28511
  "inBandMetadataTrackDispatchType",
28512
+ "inIncognitoContext",
27945
28513
  "inRange",
27946
28514
  "includes",
28515
+ "incognito",
27947
28516
  "incomingBidirectionalStreams",
27948
28517
  "incomingHighWaterMark",
27949
28518
  "incomingMaxAge",
@@ -28054,6 +28623,7 @@ var domprops = [
28054
28623
  "insetInline",
28055
28624
  "insetInlineEnd",
28056
28625
  "insetInlineStart",
28626
+ "install",
28057
28627
  "installing",
28058
28628
  "instanceRoot",
28059
28629
  "instantiate",
@@ -28090,6 +28660,8 @@ var domprops = [
28090
28660
  "is",
28091
28661
  "is2D",
28092
28662
  "isActive",
28663
+ "isAllowedFileSchemeAccess",
28664
+ "isAllowedIncognitoAccess",
28093
28665
  "isAlternate",
28094
28666
  "isArray",
28095
28667
  "isAutoSelected",
@@ -28195,6 +28767,7 @@ var domprops = [
28195
28767
  "jobTitle",
28196
28768
  "join",
28197
28769
  "joinAdInterestGroup",
28770
+ "jointName",
28198
28771
  "json",
28199
28772
  "justify-content",
28200
28773
  "justify-items",
@@ -28228,6 +28801,7 @@ var domprops = [
28228
28801
  "keytype",
28229
28802
  "kind",
28230
28803
  "knee",
28804
+ "knownSources",
28231
28805
  "label",
28232
28806
  "labels",
28233
28807
  "lang",
@@ -28236,6 +28810,7 @@ var domprops = [
28236
28810
  "largeArcFlag",
28237
28811
  "lastChild",
28238
28812
  "lastElementChild",
28813
+ "lastError",
28239
28814
  "lastEventId",
28240
28815
  "lastIndex",
28241
28816
  "lastIndexOf",
@@ -28249,6 +28824,7 @@ var domprops = [
28249
28824
  "lastParen",
28250
28825
  "lastState",
28251
28826
  "lastStyleSheetSet",
28827
+ "latency",
28252
28828
  "latitude",
28253
28829
  "launchQueue",
28254
28830
  "layerName",
@@ -28384,6 +28960,7 @@ var domprops = [
28384
28960
  "magFilter",
28385
28961
  "makeXRCompatible",
28386
28962
  "managed",
28963
+ "management",
28387
28964
  "manifest",
28388
28965
  "manufacturer",
28389
28966
  "manufacturerName",
@@ -28458,6 +29035,7 @@ var domprops = [
28458
29035
  "matchAll",
28459
29036
  "matchMedia",
28460
29037
  "matchMedium",
29038
+ "matchPatterns",
28461
29039
  "matches",
28462
29040
  "math-depth",
28463
29041
  "math-style",
@@ -28522,6 +29100,7 @@ var domprops = [
28522
29100
  "maxVertexBufferArrayStride",
28523
29101
  "maxVertexBuffers",
28524
29102
  "maxWidth",
29103
+ "maximumLatency",
28525
29104
  "measure",
28526
29105
  "measureText",
28527
29106
  "media",
@@ -28536,6 +29115,9 @@ var domprops = [
28536
29115
  "meetOrSlice",
28537
29116
  "memory",
28538
29117
  "menubar",
29118
+ "menus",
29119
+ "menusChild",
29120
+ "menusInternal",
28539
29121
  "mergeAttributes",
28540
29122
  "message",
28541
29123
  "messageClass",
@@ -28566,6 +29148,7 @@ var domprops = [
28566
29148
  "minUniformBufferOffsetAlignment",
28567
29149
  "minValue",
28568
29150
  "minWidth",
29151
+ "minimumLatency",
28569
29152
  "mipLevel",
28570
29153
  "mipLevelCount",
28571
29154
  "mipmapFilter",
@@ -28587,6 +29170,7 @@ var domprops = [
28587
29170
  "moveFocusLeft",
28588
29171
  "moveFocusRight",
28589
29172
  "moveFocusUp",
29173
+ "moveInSuccession",
28590
29174
  "moveNext",
28591
29175
  "moveRow",
28592
29176
  "moveStart",
@@ -28833,6 +29417,7 @@ var domprops = [
28833
29417
  "mutableFile",
28834
29418
  "muted",
28835
29419
  "n",
29420
+ "nacl_arch",
28836
29421
  "name",
28837
29422
  "nameList",
28838
29423
  "nameProp",
@@ -28841,6 +29426,7 @@ var domprops = [
28841
29426
  "names",
28842
29427
  "namespaceURI",
28843
29428
  "namespaces",
29429
+ "nativeApplication",
28844
29430
  "nativeMap",
28845
29431
  "nativeObjectCreate",
28846
29432
  "nativeSet",
@@ -28860,6 +29446,7 @@ var domprops = [
28860
29446
  "negotiated",
28861
29447
  "netscape",
28862
29448
  "networkState",
29449
+ "networkStatus",
28863
29450
  "newScale",
28864
29451
  "newState",
28865
29452
  "newTranslate",
@@ -28889,6 +29476,7 @@ var domprops = [
28889
29476
  "normDepthBufferFromNormView",
28890
29477
  "normalize",
28891
29478
  "normalizedPathSegList",
29479
+ "normandyAddonStudy",
28892
29480
  "notRestoredReasons",
28893
29481
  "notationName",
28894
29482
  "notations",
@@ -28896,8 +29484,10 @@ var domprops = [
28896
29484
  "noteGrainOn",
28897
29485
  "noteOff",
28898
29486
  "noteOn",
29487
+ "notifications",
28899
29488
  "notify",
28900
29489
  "now",
29490
+ "npnNegotiatedProtocol",
28901
29491
  "numOctaves",
28902
29492
  "number",
28903
29493
  "numberOfChannels",
@@ -28945,12 +29535,46 @@ var domprops = [
28945
29535
  "oldValue",
28946
29536
  "oldVersion",
28947
29537
  "olderShadowRoot",
29538
+ "omnibox",
28948
29539
  "on",
29540
+ "onActivated",
29541
+ "onAdded",
29542
+ "onAttached",
29543
+ "onBoundsChanged",
29544
+ "onBrowserUpdateAvailable",
29545
+ "onClicked",
28949
29546
  "onCommitFiberRoot",
28950
29547
  "onCommitFiberUnmount",
29548
+ "onConnect",
29549
+ "onConnectExternal",
29550
+ "onConnectNative",
29551
+ "onCreated",
29552
+ "onDetached",
29553
+ "onDisabled",
29554
+ "onEnabled",
29555
+ "onFocusChanged",
29556
+ "onHighlighted",
29557
+ "onInstalled",
28951
29558
  "onLine",
29559
+ "onMessage",
29560
+ "onMessageExternal",
29561
+ "onMoved",
29562
+ "onPerformanceWarning",
28952
29563
  "onPostCommitFiberRoot",
29564
+ "onRemoved",
29565
+ "onReplaced",
29566
+ "onRestartRequired",
29567
+ "onStartup",
28953
29568
  "onSubmittedWorkDone",
29569
+ "onSuspend",
29570
+ "onSuspendCanceled",
29571
+ "onUninstalled",
29572
+ "onUpdateAvailable",
29573
+ "onUpdated",
29574
+ "onUserScriptConnect",
29575
+ "onUserScriptMessage",
29576
+ "onUserSettingsChanged",
29577
+ "onZoomChange",
28954
29578
  "onabort",
28955
29579
  "onabsolutedeviceorientation",
28956
29580
  "onactivate",
@@ -29106,6 +29730,7 @@ var domprops = [
29106
29730
  "onleavepictureinpicture",
29107
29731
  "onlevelchange",
29108
29732
  "onload",
29733
+ "onloadT",
29109
29734
  "onloadeddata",
29110
29735
  "onloadedmetadata",
29111
29736
  "onloadend",
@@ -29229,6 +29854,8 @@ var domprops = [
29229
29854
  "onscreenschange",
29230
29855
  "onscroll",
29231
29856
  "onscrollend",
29857
+ "onscrollsnapchange",
29858
+ "onscrollsnapchanging",
29232
29859
  "onsearch",
29233
29860
  "onsecuritypolicyviolation",
29234
29861
  "onseeked",
@@ -29327,6 +29954,9 @@ var domprops = [
29327
29954
  "openCursor",
29328
29955
  "openDatabase",
29329
29956
  "openKeyCursor",
29957
+ "openOptionsPage",
29958
+ "openOrClosedShadowRoot",
29959
+ "openPopup",
29330
29960
  "opened",
29331
29961
  "opener",
29332
29962
  "opera",
@@ -29355,6 +29985,7 @@ var domprops = [
29355
29985
  "originalPolicy",
29356
29986
  "originalTarget",
29357
29987
  "orphans",
29988
+ "os",
29358
29989
  "oscpu",
29359
29990
  "outerHTML",
29360
29991
  "outerHeight",
@@ -29445,11 +30076,15 @@ var domprops = [
29445
30076
  "page-break-after",
29446
30077
  "page-break-before",
29447
30078
  "page-break-inside",
30079
+ "page-orientation",
30080
+ "pageAction",
29448
30081
  "pageBreakAfter",
29449
30082
  "pageBreakBefore",
29450
30083
  "pageBreakInside",
29451
30084
  "pageCount",
29452
30085
  "pageLeft",
30086
+ "pageOrientation",
30087
+ "pageT",
29453
30088
  "pageTop",
29454
30089
  "pageX",
29455
30090
  "pageXOffset",
@@ -29523,6 +30158,7 @@ var domprops = [
29523
30158
  "permissions",
29524
30159
  "persist",
29525
30160
  "persisted",
30161
+ "persistentDeviceId",
29526
30162
  "personalbar",
29527
30163
  "perspective",
29528
30164
  "perspective-origin",
@@ -29531,6 +30167,7 @@ var domprops = [
29531
30167
  "phoneticFamilyName",
29532
30168
  "phoneticGivenName",
29533
30169
  "photo",
30170
+ "pictureInPictureChild",
29534
30171
  "pictureInPictureElement",
29535
30172
  "pictureInPictureEnabled",
29536
30173
  "pictureInPictureWindow",
@@ -29548,6 +30185,7 @@ var domprops = [
29548
30185
  "pixelUnitToMillimeterX",
29549
30186
  "pixelUnitToMillimeterY",
29550
30187
  "pixelWidth",
30188
+ "pkcs11",
29551
30189
  "place-content",
29552
30190
  "place-items",
29553
30191
  "place-self",
@@ -29604,7 +30242,11 @@ var domprops = [
29604
30242
  "posWidth",
29605
30243
  "pose",
29606
30244
  "position",
30245
+ "position-anchor",
30246
+ "position-area",
29607
30247
  "positionAlign",
30248
+ "positionAnchor",
30249
+ "positionArea",
29608
30250
  "positionX",
29609
30251
  "positionY",
29610
30252
  "positionZ",
@@ -29630,6 +30272,7 @@ var domprops = [
29630
30272
  "prerendering",
29631
30273
  "presentation",
29632
30274
  "presentationArea",
30275
+ "presentationStyle",
29633
30276
  "preserveAlpha",
29634
30277
  "preserveAspectRatio",
29635
30278
  "preserveAspectRatioString",
@@ -29659,7 +30302,9 @@ var domprops = [
29659
30302
  "print",
29660
30303
  "print-color-adjust",
29661
30304
  "printColorAdjust",
30305
+ "printPreview",
29662
30306
  "priority",
30307
+ "privacy",
29663
30308
  "privateKey",
29664
30309
  "privateToken",
29665
30310
  "probablySupportsContext",
@@ -29682,10 +30327,12 @@ var domprops = [
29682
30327
  "properties",
29683
30328
  "propertyIsEnumerable",
29684
30329
  "propertyName",
30330
+ "protectedAudience",
29685
30331
  "protocol",
29686
30332
  "protocolLong",
29687
30333
  "prototype",
29688
30334
  "provider",
30335
+ "proxy",
29689
30336
  "pseudoClass",
29690
30337
  "pseudoElement",
29691
30338
  "pt",
@@ -29712,6 +30359,7 @@ var domprops = [
29712
30359
  "queryCommandSupported",
29713
30360
  "queryCommandText",
29714
30361
  "queryCommandValue",
30362
+ "queryFeatureSupport",
29715
30363
  "queryLocalFonts",
29716
30364
  "queryPermission",
29717
30365
  "querySelector",
@@ -29727,6 +30375,7 @@ var domprops = [
29727
30375
  "race",
29728
30376
  "rad",
29729
30377
  "radiogroup",
30378
+ "radius",
29730
30379
  "radiusX",
29731
30380
  "radiusY",
29732
30381
  "random",
@@ -29902,6 +30551,7 @@ var domprops = [
29902
30551
  "requestAdapterInfo",
29903
30552
  "requestAnimationFrame",
29904
30553
  "requestAutocomplete",
30554
+ "requestClose",
29905
30555
  "requestData",
29906
30556
  "requestDevice",
29907
30557
  "requestFrame",
@@ -29925,6 +30575,8 @@ var domprops = [
29925
30575
  "requestStorageAccess",
29926
30576
  "requestStorageAccessFor",
29927
30577
  "requestSubmit",
30578
+ "requestTime",
30579
+ "requestUpdateCheck",
29928
30580
  "requestVideoFrameCallback",
29929
30581
  "requestViewportScale",
29930
30582
  "requestWindow",
@@ -29935,6 +30587,7 @@ var domprops = [
29935
30587
  "requiredFeatures",
29936
30588
  "requiredLimits",
29937
30589
  "reset",
30590
+ "resetLatency",
29938
30591
  "resetPose",
29939
30592
  "resetTransform",
29940
30593
  "resizable",
@@ -29957,6 +30610,8 @@ var domprops = [
29957
30610
  "responseType",
29958
30611
  "responseURL",
29959
30612
  "responseXML",
30613
+ "restart",
30614
+ "restartAfterDelay",
29960
30615
  "restartIce",
29961
30616
  "restore",
29962
30617
  "result",
@@ -30034,6 +30689,7 @@ var domprops = [
30034
30689
  "samplerParameteri",
30035
30690
  "sandbox",
30036
30691
  "save",
30692
+ "saveAsPDF",
30037
30693
  "saveData",
30038
30694
  "scale",
30039
30695
  "scale3d",
@@ -30060,6 +30716,7 @@ var domprops = [
30060
30716
  "screenY",
30061
30717
  "screens",
30062
30718
  "scriptURL",
30719
+ "scripting",
30063
30720
  "scripts",
30064
30721
  "scroll",
30065
30722
  "scroll-behavior",
@@ -30197,6 +30854,8 @@ var domprops = [
30197
30854
  "sendAsBinary",
30198
30855
  "sendBeacon",
30199
30856
  "sendFeatureReport",
30857
+ "sendMessage",
30858
+ "sendNativeMessage",
30200
30859
  "sendOrder",
30201
30860
  "sendReport",
30202
30861
  "sender",
@@ -30205,6 +30864,7 @@ var domprops = [
30205
30864
  "separator",
30206
30865
  "serial",
30207
30866
  "serialNumber",
30867
+ "serializable",
30208
30868
  "serializeToString",
30209
30869
  "serverTiming",
30210
30870
  "service",
@@ -30212,6 +30872,7 @@ var domprops = [
30212
30872
  "session",
30213
30873
  "sessionId",
30214
30874
  "sessionStorage",
30875
+ "sessions",
30215
30876
  "set",
30216
30877
  "setActionHandler",
30217
30878
  "setActive",
@@ -30222,6 +30883,9 @@ var domprops = [
30222
30883
  "setAttributeNode",
30223
30884
  "setAttributeNodeNS",
30224
30885
  "setAttributionReporting",
30886
+ "setBadgeBackgroundColor",
30887
+ "setBadgeText",
30888
+ "setBadgeTextColor",
30225
30889
  "setBaseAndExtent",
30226
30890
  "setBigInt64",
30227
30891
  "setBigUint64",
@@ -30241,6 +30905,7 @@ var domprops = [
30241
30905
  "setData",
30242
30906
  "setDate",
30243
30907
  "setDragImage",
30908
+ "setEnabled",
30244
30909
  "setEnd",
30245
30910
  "setEndAfter",
30246
30911
  "setEndBefore",
@@ -30248,16 +30913,20 @@ var domprops = [
30248
30913
  "setExpires",
30249
30914
  "setFillColor",
30250
30915
  "setFilterRes",
30916
+ "setFloat16",
30251
30917
  "setFloat32",
30252
30918
  "setFloat64",
30253
30919
  "setFloatValue",
30254
30920
  "setFocusBehavior",
30255
30921
  "setFormValue",
30922
+ "setFromBase64",
30923
+ "setFromHex",
30256
30924
  "setFullYear",
30257
30925
  "setHTMLUnsafe",
30258
30926
  "setHeaderExtensionsToNegotiate",
30259
30927
  "setHeaderValue",
30260
30928
  "setHours",
30929
+ "setIcon",
30261
30930
  "setIdentityProvider",
30262
30931
  "setImmediate",
30263
30932
  "setIndexBuffer",
@@ -30294,6 +30963,7 @@ var domprops = [
30294
30963
  "setPeriodicWave",
30295
30964
  "setPipeline",
30296
30965
  "setPointerCapture",
30966
+ "setPopup",
30297
30967
  "setPosition",
30298
30968
  "setPositionState",
30299
30969
  "setPreference",
@@ -30337,6 +31007,7 @@ var domprops = [
30337
31007
  "setTargetValueAtTime",
30338
31008
  "setTime",
30339
31009
  "setTimeout",
31010
+ "setTitle",
30340
31011
  "setTransform",
30341
31012
  "setTranslate",
30342
31013
  "setUTCDate",
@@ -30349,6 +31020,8 @@ var domprops = [
30349
31020
  "setUint16",
30350
31021
  "setUint32",
30351
31022
  "setUint8",
31023
+ "setUninstallURL",
31024
+ "setUpdateUrlData",
30352
31025
  "setUri",
30353
31026
  "setValidity",
30354
31027
  "setValueAtTime",
@@ -30359,6 +31032,8 @@ var domprops = [
30359
31032
  "setVertexBuffer",
30360
31033
  "setViewport",
30361
31034
  "setYear",
31035
+ "setZoom",
31036
+ "setZoomSettings",
30362
31037
  "settingName",
30363
31038
  "settingValue",
30364
31039
  "sex",
@@ -30372,6 +31047,7 @@ var domprops = [
30372
31047
  "shadowRootClonable",
30373
31048
  "shadowRootDelegatesFocus",
30374
31049
  "shadowRootMode",
31050
+ "shadowRootSerializable",
30375
31051
  "shape",
30376
31052
  "shape-image-threshold",
30377
31053
  "shape-margin",
@@ -30403,6 +31079,7 @@ var domprops = [
30403
31079
  "showPopover",
30404
31080
  "showSaveFilePicker",
30405
31081
  "sidebar",
31082
+ "sidebarAction",
30406
31083
  "sign",
30407
31084
  "signal",
30408
31085
  "signalingState",
@@ -30433,6 +31110,8 @@ var domprops = [
30433
31110
  "smil",
30434
31111
  "smooth",
30435
31112
  "smoothingTimeConstant",
31113
+ "snapTargetBlock",
31114
+ "snapTargetInline",
30436
31115
  "snapToLines",
30437
31116
  "snapshotItem",
30438
31117
  "snapshotLength",
@@ -30486,7 +31165,9 @@ var domprops = [
30486
31165
  "standby",
30487
31166
  "start",
30488
31167
  "startContainer",
31168
+ "startE",
30489
31169
  "startIce",
31170
+ "startLoadTime",
30490
31171
  "startMessages",
30491
31172
  "startNotifications",
30492
31173
  "startOffset",
@@ -30636,13 +31317,17 @@ var domprops = [
30636
31317
  "tBodies",
30637
31318
  "tFoot",
30638
31319
  "tHead",
31320
+ "tab",
30639
31321
  "tab-size",
31322
+ "tabId",
31323
+ "tabIds",
30640
31324
  "tabIndex",
30641
31325
  "tabSize",
30642
31326
  "table",
30643
31327
  "table-layout",
30644
31328
  "tableLayout",
30645
31329
  "tableValues",
31330
+ "tabs",
30646
31331
  "tag",
30647
31332
  "tagName",
30648
31333
  "tagUrn",
@@ -30667,6 +31352,7 @@ var domprops = [
30667
31352
  "tcpType",
30668
31353
  "tee",
30669
31354
  "tel",
31355
+ "telemetry",
30670
31356
  "terminate",
30671
31357
  "test",
30672
31358
  "texImage2D",
@@ -30744,6 +31430,7 @@ var domprops = [
30744
31430
  "textWrapMode",
30745
31431
  "textWrapStyle",
30746
31432
  "texture",
31433
+ "theme",
30747
31434
  "then",
30748
31435
  "threadId",
30749
31436
  "threshold",
@@ -30767,8 +31454,10 @@ var domprops = [
30767
31454
  "timing",
30768
31455
  "title",
30769
31456
  "titlebarAreaRect",
31457
+ "tlsChannelId",
30770
31458
  "to",
30771
31459
  "toArray",
31460
+ "toBase64",
30772
31461
  "toBlob",
30773
31462
  "toDataURL",
30774
31463
  "toDateString",
@@ -30778,6 +31467,7 @@ var domprops = [
30778
31467
  "toFloat32Array",
30779
31468
  "toFloat64Array",
30780
31469
  "toGMTString",
31470
+ "toHex",
30781
31471
  "toISOString",
30782
31472
  "toJSON",
30783
31473
  "toLocaleDateString",
@@ -30808,6 +31498,7 @@ var domprops = [
30808
31498
  "toggleAttribute",
30809
31499
  "toggleLongPressEnabled",
30810
31500
  "togglePopover",
31501
+ "toggleReaderMode",
30811
31502
  "token",
30812
31503
  "tone",
30813
31504
  "toneBuffer",
@@ -30816,10 +31507,12 @@ var domprops = [
30816
31507
  "toolbar",
30817
31508
  "top",
30818
31509
  "topMargin",
31510
+ "topSites",
30819
31511
  "topology",
30820
31512
  "total",
30821
31513
  "totalFrameDelay",
30822
31514
  "totalFrames",
31515
+ "totalFramesDuration",
30823
31516
  "totalVideoFrames",
30824
31517
  "touch-action",
30825
31518
  "touchAction",
@@ -30830,6 +31523,7 @@ var domprops = [
30830
31523
  "trackVisibility",
30831
31524
  "trackedAnchors",
30832
31525
  "tracks",
31526
+ "tran",
30833
31527
  "transaction",
30834
31528
  "transactions",
30835
31529
  "transceiver",
@@ -30855,10 +31549,12 @@ var domprops = [
30855
31549
  "transformToDocument",
30856
31550
  "transformToFragment",
30857
31551
  "transition",
31552
+ "transition-behavior",
30858
31553
  "transition-delay",
30859
31554
  "transition-duration",
30860
31555
  "transition-property",
30861
31556
  "transition-timing-function",
31557
+ "transitionBehavior",
30862
31558
  "transitionDelay",
30863
31559
  "transitionDuration",
30864
31560
  "transitionProperty",
@@ -30878,6 +31574,7 @@ var domprops = [
30878
31574
  "trunc",
30879
31575
  "truncate",
30880
31576
  "trustedTypes",
31577
+ "try",
30881
31578
  "turn",
30882
31579
  "twist",
30883
31580
  "type",
@@ -30899,6 +31596,7 @@ var domprops = [
30899
31596
  "underlineThickness",
30900
31597
  "unescape",
30901
31598
  "uneval",
31599
+ "ungroup",
30902
31600
  "unicode",
30903
31601
  "unicode-bidi",
30904
31602
  "unicodeBidi",
@@ -30938,6 +31636,7 @@ var domprops = [
30938
31636
  "uniformMatrix4fv",
30939
31637
  "uniformMatrix4x2fv",
30940
31638
  "uniformMatrix4x3fv",
31639
+ "uninstallSelf",
30941
31640
  "union",
30942
31641
  "unique",
30943
31642
  "uniqueID",
@@ -31099,6 +31798,7 @@ var domprops = [
31099
31798
  "viewFormats",
31100
31799
  "viewTarget",
31101
31800
  "viewTargetString",
31801
+ "viewTransition",
31102
31802
  "viewport",
31103
31803
  "viewportAnchorX",
31104
31804
  "viewportAnchorY",
@@ -31129,12 +31829,18 @@ var domprops = [
31129
31829
  "wake",
31130
31830
  "wakeLock",
31131
31831
  "wand",
31832
+ "warmup",
31132
31833
  "warn",
31834
+ "wasAlternateProtocolAvailable",
31133
31835
  "wasClean",
31134
31836
  "wasDiscarded",
31837
+ "wasFetchedViaSpdy",
31838
+ "wasNpnNegotiated",
31135
31839
  "watch",
31136
31840
  "watchAvailability",
31137
31841
  "watchPosition",
31842
+ "webNavigation",
31843
+ "webRequest",
31138
31844
  "webdriver",
31139
31845
  "webkitAddKey",
31140
31846
  "webkitAlignContent",
@@ -31215,6 +31921,7 @@ var domprops = [
31215
31921
  "webkitFlexGrow",
31216
31922
  "webkitFlexShrink",
31217
31923
  "webkitFlexWrap",
31924
+ "webkitFontFeatureSettings",
31218
31925
  "webkitFullScreenKeyboardInputAllowed",
31219
31926
  "webkitFullscreenElement",
31220
31927
  "webkitFullscreenEnabled",
@@ -31341,6 +32048,9 @@ var domprops = [
31341
32048
  "window",
31342
32049
  "windowAttribution",
31343
32050
  "windowControlsOverlay",
32051
+ "windowId",
32052
+ "windowIds",
32053
+ "windows",
31344
32054
  "with",
31345
32055
  "withCredentials",
31346
32056
  "withResolvers",
@@ -31388,6 +32098,7 @@ var domprops = [
31388
32098
  "y2",
31389
32099
  "yChannelSelector",
31390
32100
  "yandex",
32101
+ "yield",
31391
32102
  "z",
31392
32103
  "z-index",
31393
32104
  "zIndex",
@@ -32350,7 +33061,7 @@ async function run_cli({ program, packageJson, fs, path }) {
32350
33061
  if (program.parse.acorn) {
32351
33062
  files = convert_ast(function(toplevel, name) {
32352
33063
  return require("acorn").parse(files[name], {
32353
- ecmaVersion: 2018,
33064
+ ecmaVersion: 2024,
32354
33065
  locations: true,
32355
33066
  program: toplevel,
32356
33067
  sourceFile: name,
@@ -32455,6 +33166,7 @@ async function run_cli({ program, packageJson, fs, path }) {
32455
33166
  return;
32456
33167
  }
32457
33168
  } else if (program.output) {
33169
+ fs.mkdirSync(path.dirname(program.output), { recursive: true });
32458
33170
  fs.writeFileSync(program.output, result.code);
32459
33171
  if (options.sourceMap && options.sourceMap.url !== "inline" && result.map) {
32460
33172
  fs.writeFileSync(program.output + ".map", result.map);