terser 5.42.0 → 5.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v5.43.0
4
+
5
+ - Do not wrap callbacks in parentheses (`wrap_func_args` format option is now false by default)
6
+ - Do not inline functions into for loops (for performance reasons)
7
+
3
8
  ## v5.42.0
4
9
 
5
10
  - Improved performance in the parse step by adding a fast path for simple identifiers.
package/README.md CHANGED
@@ -1070,7 +1070,7 @@ as "output options".
1070
1070
  function expressions. See
1071
1071
  [#640](https://github.com/mishoo/UglifyJS2/issues/640) for more details.
1072
1072
 
1073
- - `wrap_func_args` (default `true`) -- pass `false` if you do not want to wrap
1073
+ - `wrap_func_args` (default `false`) -- pass `true` in order to wrap
1074
1074
  function expressions that are passed as arguments, in parenthesis. See
1075
1075
  [OptimizeJS](https://github.com/nolanlawson/optimize-js) for more details.
1076
1076
 
@@ -1711,10 +1711,10 @@ function parse($TEXT, options) {
1711
1711
  });
1712
1712
  };
1713
1713
 
1714
- var function_ = function(ctor, is_generator_property, is_async, is_export_default) {
1714
+ var function_ = function(ctor, is_generator, is_async, is_export_default) {
1715
1715
  var in_statement = ctor === AST_Defun;
1716
- var is_generator = is("operator", "*");
1717
- if (is_generator) {
1716
+ if (is("operator", "*")) {
1717
+ is_generator = true;
1718
1718
  next();
1719
1719
  }
1720
1720
 
@@ -1731,11 +1731,11 @@ function parse($TEXT, options) {
1731
1731
  unexpected(prev());
1732
1732
 
1733
1733
  var args = [];
1734
- 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);
1735
1735
  return new ctor({
1736
1736
  start : args.start,
1737
1737
  end : body.end,
1738
- is_generator: is_generator || is_generator_property,
1738
+ is_generator: is_generator,
1739
1739
  async : is_async,
1740
1740
  name : name,
1741
1741
  argnames: args,
@@ -2811,8 +2811,6 @@ function parse($TEXT, options) {
2811
2811
  var node = new AST_MethodVariant({
2812
2812
  start : start,
2813
2813
  static : is_static,
2814
- is_generator: is_generator,
2815
- async : is_async,
2816
2814
  key : name,
2817
2815
  quote : name instanceof AST_SymbolMethod ?
2818
2816
  property_token.quote : undefined,
@@ -5792,12 +5790,10 @@ var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", function AST_Obje
5792
5790
  }
5793
5791
  }, AST_ObjectProperty);
5794
5792
 
5795
- var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static is_generator async", function AST_ConciseMethod(props) {
5793
+ var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static", function AST_ConciseMethod(props) {
5796
5794
  if (props) {
5797
5795
  this.quote = props.quote;
5798
5796
  this.static = props.static;
5799
- this.is_generator = props.is_generator;
5800
- this.async = props.async;
5801
5797
  this.key = props.key;
5802
5798
  this.value = props.value;
5803
5799
  this.start = props.start;
@@ -5810,8 +5806,6 @@ var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static is_generator asyn
5810
5806
  $propdoc: {
5811
5807
  quote: "[string|undefined] the original quote character, if any",
5812
5808
  static: "[boolean] is this method static (classes only)",
5813
- is_generator: "[boolean] is this a generator method",
5814
- async: "[boolean] is this method async",
5815
5809
  },
5816
5810
  $documentation: "An ES6 concise method inside an object or class",
5817
5811
  computed_key() {
@@ -5819,11 +5813,9 @@ var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static is_generator asyn
5819
5813
  }
5820
5814
  }, AST_ObjectProperty);
5821
5815
 
5822
- var AST_PrivateMethod = DEFNODE("PrivateMethod", "", function AST_PrivateMethod(props) {
5816
+ var AST_PrivateMethod = DEFNODE("PrivateMethod", "static", function AST_PrivateMethod(props) {
5823
5817
  if (props) {
5824
5818
  this.static = props.static;
5825
- this.is_generator = props.is_generator;
5826
- this.async = props.async;
5827
5819
  this.key = props.key;
5828
5820
  this.value = props.value;
5829
5821
  this.start = props.start;
@@ -5833,6 +5825,9 @@ var AST_PrivateMethod = DEFNODE("PrivateMethod", "", function AST_PrivateMethod(
5833
5825
  this.flags = 0;
5834
5826
  }, {
5835
5827
  $documentation: "A private class method inside a class",
5828
+ $propdoc: {
5829
+ static: "[boolean] is this a static private method",
5830
+ },
5836
5831
  computed_key() {
5837
5832
  return false;
5838
5833
  },
@@ -6823,6 +6818,28 @@ class TreeWalker {
6823
6818
  }
6824
6819
  }
6825
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
+
6826
6843
  find_scope() {
6827
6844
  var stack = this.stack;
6828
6845
  for (var i = stack.length; --i >= 0;) {
@@ -7392,8 +7409,6 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7392
7409
  ? from_moz(M.key)
7393
7410
  : from_moz_symbol(AST_SymbolMethod, M.key),
7394
7411
  quote : from_moz_quote(M.key, M.computed),
7395
- is_generator: value.is_generator,
7396
- async : value.async,
7397
7412
  static : false, // always an object
7398
7413
  value,
7399
7414
  };
@@ -7422,8 +7437,6 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
7422
7437
  if (M.kind == "set") {
7423
7438
  return new (is_private ? AST_PrivateSetter : AST_ObjectSetter)(args);
7424
7439
  }
7425
- args.is_generator = M.value.generator;
7426
- args.async = M.value.async;
7427
7440
  return new (is_private ? AST_PrivateMethod : AST_ConciseMethod)(args);
7428
7441
  },
7429
7442
 
@@ -8284,15 +8297,12 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
8284
8297
  };
8285
8298
  });
8286
8299
 
8287
- def_to_moz(AST_Function, function To_Moz_FunctionExpression(M, parent) {
8288
- var is_generator = parent.is_generator !== undefined
8289
- ? parent.is_generator
8290
- : M.is_generator;
8300
+ def_to_moz(AST_Function, function To_Moz_FunctionExpression(M) {
8291
8301
  return {
8292
8302
  type: "FunctionExpression",
8293
8303
  id: to_moz(M.name),
8294
8304
  params: M.argnames.map(to_moz_pattern),
8295
- generator: is_generator || false,
8305
+ generator: M.is_generator || false,
8296
8306
  async: M.async || false,
8297
8307
  body: to_moz_scope("BlockStatement", M)
8298
8308
  };
@@ -9316,7 +9326,7 @@ function OutputStream(options) {
9316
9326
  webkit : false,
9317
9327
  width : 80,
9318
9328
  wrap_iife : false,
9319
- wrap_func_args : true,
9329
+ wrap_func_args : false,
9320
9330
 
9321
9331
  _destroy_ast : false
9322
9332
  }, true);
@@ -11327,22 +11337,22 @@ function OutputStream(options) {
11327
11337
  });
11328
11338
  DEFPRINT(AST_ConciseMethod, function(self, output) {
11329
11339
  var type;
11330
- if (self.is_generator && self.async) {
11340
+ if (self.value.is_generator && self.value.async) {
11331
11341
  type = "async*";
11332
- } else if (self.is_generator) {
11342
+ } else if (self.value.is_generator) {
11333
11343
  type = "*";
11334
- } else if (self.async) {
11344
+ } else if (self.value.async) {
11335
11345
  type = "async";
11336
11346
  }
11337
11347
  self._print_getter_setter(type, false, output);
11338
11348
  });
11339
11349
  DEFPRINT(AST_PrivateMethod, function(self, output) {
11340
11350
  var type;
11341
- if (self.is_generator && self.async) {
11351
+ if (self.value.is_generator && self.value.async) {
11342
11352
  type = "async*";
11343
- } else if (self.is_generator) {
11353
+ } else if (self.value.is_generator) {
11344
11354
  type = "*";
11345
- } else if (self.async) {
11355
+ } else if (self.value.async) {
11346
11356
  type = "async";
11347
11357
  }
11348
11358
  self._print_getter_setter(type, true, output);
@@ -11738,11 +11748,11 @@ AST_ObjectGetter.prototype.shallow_cmp = function(other) {
11738
11748
  };
11739
11749
 
11740
11750
  AST_ConciseMethod.prototype.shallow_cmp = function(other) {
11741
- return this.static === other.static && this.is_generator === other.is_generator && this.async === other.async;
11751
+ return this.static === other.static;
11742
11752
  };
11743
11753
 
11744
11754
  AST_PrivateMethod.prototype.shallow_cmp = function(other) {
11745
- return this.static === other.static && this.is_generator === other.is_generator && this.async === other.async;
11755
+ return this.static === other.static;
11746
11756
  };
11747
11757
 
11748
11758
  AST_Class.prototype.shallow_cmp = function(other) {
@@ -13078,7 +13088,7 @@ AST_ObjectSetter.prototype._size = function () {
13078
13088
  };
13079
13089
 
13080
13090
  AST_ConciseMethod.prototype._size = function () {
13081
- return static_size(this.static) + key_size(this.key) + lambda_modifiers(this);
13091
+ return static_size(this.static) + key_size(this.key);
13082
13092
  };
13083
13093
 
13084
13094
  AST_PrivateMethod.prototype._size = function () {
@@ -18421,6 +18431,8 @@ function inline_into_symbolref(self, compressor) {
18421
18431
  return self;
18422
18432
  }
18423
18433
 
18434
+ if (dont_inline_lambda_in_loop(compressor, fixed)) return self;
18435
+
18424
18436
  let single_use = def.single_use
18425
18437
  && !(parent instanceof AST_Call
18426
18438
  && (parent.is_callee_pure(compressor))
@@ -18574,6 +18586,11 @@ function inline_into_call(self, compressor) {
18574
18586
  fn = fixed;
18575
18587
  }
18576
18588
 
18589
+ if (
18590
+ dont_inline_lambda_in_loop(compressor, fn)
18591
+ && !has_annotation(self, _INLINE)
18592
+ ) return self;
18593
+
18577
18594
  var is_func = fn instanceof AST_Lambda;
18578
18595
 
18579
18596
  var stat = is_func && fn.body[0];
@@ -18902,6 +18919,14 @@ function inline_into_call(self, compressor) {
18902
18919
  }
18903
18920
  }
18904
18921
 
18922
+ /** prevent inlining functions into loops, for performance reasons */
18923
+ function dont_inline_lambda_in_loop(compressor, maybe_lambda) {
18924
+ return (
18925
+ (maybe_lambda instanceof AST_Lambda || maybe_lambda instanceof AST_Class)
18926
+ && !!compressor.is_within_loop()
18927
+ );
18928
+ }
18929
+
18905
18930
  (function(def_find_defs) {
18906
18931
  function to_node(value, orig) {
18907
18932
  if (value instanceof AST_Node) {
@@ -22328,7 +22353,7 @@ AST_PropAccess.DEFMETHOD("flatten_object", function(key, compressor) {
22328
22353
  if ("" + (prop instanceof AST_ConciseMethod ? prop.key.name : prop.key) == key) {
22329
22354
  const all_props_flattenable = props.every((p) =>
22330
22355
  (p instanceof AST_ObjectKeyVal
22331
- || arrows && p instanceof AST_ConciseMethod && !p.is_generator
22356
+ || arrows && p instanceof AST_ConciseMethod && !p.value.is_generator
22332
22357
  )
22333
22358
  && !p.computed_key()
22334
22359
  );
@@ -22814,7 +22839,7 @@ def_optimize(AST_ConciseMethod, function(self, compressor) {
22814
22839
  // p(){return x;} ---> p:()=>x
22815
22840
  if (compressor.option("arrows")
22816
22841
  && compressor.parent() instanceof AST_Object
22817
- && !self.is_generator
22842
+ && !self.value.is_generator
22818
22843
  && !self.value.uses_arguments
22819
22844
  && !self.value.pinned()
22820
22845
  && self.value.body.length == 1
@@ -22822,8 +22847,8 @@ def_optimize(AST_ConciseMethod, function(self, compressor) {
22822
22847
  && self.value.body[0].value
22823
22848
  && !self.value.contains_this()) {
22824
22849
  var arrow = make_node(AST_Arrow, self.value, self.value);
22825
- arrow.async = self.async;
22826
- arrow.is_generator = self.is_generator;
22850
+ arrow.async = self.value.async;
22851
+ arrow.is_generator = self.value.is_generator;
22827
22852
  return make_node(AST_ObjectKeyVal, self, {
22828
22853
  key: self.key instanceof AST_SymbolMethod ? self.key.name : self.key,
22829
22854
  value: arrow,
@@ -22851,8 +22876,6 @@ def_optimize(AST_ObjectKeyVal, function(self, compressor) {
22851
22876
  && !value.contains_this();
22852
22877
  if ((is_arrow_with_block || value instanceof AST_Function) && !value.name) {
22853
22878
  return make_node(AST_ConciseMethod, self, {
22854
- async: value.async,
22855
- is_generator: value.is_generator,
22856
22879
  key: key instanceof AST_Node ? key : make_node(AST_SymbolMethod, self, {
22857
22880
  name: key,
22858
22881
  }),
package/lib/ast.js CHANGED
@@ -2150,12 +2150,10 @@ var AST_ObjectGetter = DEFNODE("ObjectGetter", "quote static", function AST_Obje
2150
2150
  }
2151
2151
  }, AST_ObjectProperty);
2152
2152
 
2153
- var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static is_generator async", function AST_ConciseMethod(props) {
2153
+ var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static", function AST_ConciseMethod(props) {
2154
2154
  if (props) {
2155
2155
  this.quote = props.quote;
2156
2156
  this.static = props.static;
2157
- this.is_generator = props.is_generator;
2158
- this.async = props.async;
2159
2157
  this.key = props.key;
2160
2158
  this.value = props.value;
2161
2159
  this.start = props.start;
@@ -2168,8 +2166,6 @@ var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static is_generator asyn
2168
2166
  $propdoc: {
2169
2167
  quote: "[string|undefined] the original quote character, if any",
2170
2168
  static: "[boolean] is this method static (classes only)",
2171
- is_generator: "[boolean] is this a generator method",
2172
- async: "[boolean] is this method async",
2173
2169
  },
2174
2170
  $documentation: "An ES6 concise method inside an object or class",
2175
2171
  computed_key() {
@@ -2177,11 +2173,9 @@ var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static is_generator asyn
2177
2173
  }
2178
2174
  }, AST_ObjectProperty);
2179
2175
 
2180
- var AST_PrivateMethod = DEFNODE("PrivateMethod", "", function AST_PrivateMethod(props) {
2176
+ var AST_PrivateMethod = DEFNODE("PrivateMethod", "static", function AST_PrivateMethod(props) {
2181
2177
  if (props) {
2182
2178
  this.static = props.static;
2183
- this.is_generator = props.is_generator;
2184
- this.async = props.async;
2185
2179
  this.key = props.key;
2186
2180
  this.value = props.value;
2187
2181
  this.start = props.start;
@@ -2191,6 +2185,9 @@ var AST_PrivateMethod = DEFNODE("PrivateMethod", "", function AST_PrivateMethod(
2191
2185
  this.flags = 0;
2192
2186
  }, {
2193
2187
  $documentation: "A private class method inside a class",
2188
+ $propdoc: {
2189
+ static: "[boolean] is this a static private method",
2190
+ },
2194
2191
  computed_key() {
2195
2192
  return false;
2196
2193
  },
@@ -3181,6 +3178,28 @@ class TreeWalker {
3181
3178
  }
3182
3179
  }
3183
3180
 
3181
+ is_within_loop() {
3182
+ let i = this.stack.length - 1;
3183
+ let child = this.stack[i];
3184
+ while (i--) {
3185
+ const node = this.stack[i];
3186
+
3187
+ if (node instanceof AST_Lambda) return false;
3188
+ if (
3189
+ node instanceof AST_IterationStatement
3190
+ // exclude for-loop bits that only run once
3191
+ && !((node instanceof AST_For) && child === node.init)
3192
+ && !((node instanceof AST_ForIn || node instanceof AST_ForOf) && child === node.object)
3193
+ ) {
3194
+ return true;
3195
+ }
3196
+
3197
+ child = node;
3198
+ }
3199
+
3200
+ return false;
3201
+ }
3202
+
3184
3203
  find_scope() {
3185
3204
  var stack = this.stack;
3186
3205
  for (var i = stack.length; --i >= 0;) {
@@ -3522,7 +3522,7 @@ AST_PropAccess.DEFMETHOD("flatten_object", function(key, compressor) {
3522
3522
  if ("" + (prop instanceof AST_ConciseMethod ? prop.key.name : prop.key) == key) {
3523
3523
  const all_props_flattenable = props.every((p) =>
3524
3524
  (p instanceof AST_ObjectKeyVal
3525
- || arrows && p instanceof AST_ConciseMethod && !p.is_generator
3525
+ || arrows && p instanceof AST_ConciseMethod && !p.value.is_generator
3526
3526
  )
3527
3527
  && !p.computed_key()
3528
3528
  );
@@ -4008,7 +4008,7 @@ def_optimize(AST_ConciseMethod, function(self, compressor) {
4008
4008
  // p(){return x;} ---> p:()=>x
4009
4009
  if (compressor.option("arrows")
4010
4010
  && compressor.parent() instanceof AST_Object
4011
- && !self.is_generator
4011
+ && !self.value.is_generator
4012
4012
  && !self.value.uses_arguments
4013
4013
  && !self.value.pinned()
4014
4014
  && self.value.body.length == 1
@@ -4016,8 +4016,8 @@ def_optimize(AST_ConciseMethod, function(self, compressor) {
4016
4016
  && self.value.body[0].value
4017
4017
  && !self.value.contains_this()) {
4018
4018
  var arrow = make_node(AST_Arrow, self.value, self.value);
4019
- arrow.async = self.async;
4020
- arrow.is_generator = self.is_generator;
4019
+ arrow.async = self.value.async;
4020
+ arrow.is_generator = self.value.is_generator;
4021
4021
  return make_node(AST_ObjectKeyVal, self, {
4022
4022
  key: self.key instanceof AST_SymbolMethod ? self.key.name : self.key,
4023
4023
  value: arrow,
@@ -4045,8 +4045,6 @@ def_optimize(AST_ObjectKeyVal, function(self, compressor) {
4045
4045
  && !value.contains_this();
4046
4046
  if ((is_arrow_with_block || value instanceof AST_Function) && !value.name) {
4047
4047
  return make_node(AST_ConciseMethod, self, {
4048
- async: value.async,
4049
- is_generator: value.is_generator,
4050
4048
  key: key instanceof AST_Node ? key : make_node(AST_SymbolMethod, self, {
4051
4049
  name: key,
4052
4050
  }),
@@ -187,6 +187,8 @@ export function inline_into_symbolref(self, compressor) {
187
187
  return self;
188
188
  }
189
189
 
190
+ if (dont_inline_lambda_in_loop(compressor, fixed)) return self;
191
+
190
192
  let single_use = def.single_use
191
193
  && !(parent instanceof AST_Call
192
194
  && (parent.is_callee_pure(compressor))
@@ -340,6 +342,11 @@ export function inline_into_call(self, compressor) {
340
342
  fn = fixed;
341
343
  }
342
344
 
345
+ if (
346
+ dont_inline_lambda_in_loop(compressor, fn)
347
+ && !has_annotation(self, _INLINE)
348
+ ) return self;
349
+
343
350
  var is_func = fn instanceof AST_Lambda;
344
351
 
345
352
  var stat = is_func && fn.body[0];
@@ -667,3 +674,11 @@ export function inline_into_call(self, compressor) {
667
674
  return expressions.map(exp => exp.clone(true));
668
675
  }
669
676
  }
677
+
678
+ /** prevent inlining functions into loops, for performance reasons */
679
+ function dont_inline_lambda_in_loop(compressor, maybe_lambda) {
680
+ return (
681
+ (maybe_lambda instanceof AST_Lambda || maybe_lambda instanceof AST_Class)
682
+ && !!compressor.is_within_loop()
683
+ );
684
+ }
@@ -249,11 +249,11 @@ AST_ObjectGetter.prototype.shallow_cmp = function(other) {
249
249
  };
250
250
 
251
251
  AST_ConciseMethod.prototype.shallow_cmp = function(other) {
252
- return this.static === other.static && this.is_generator === other.is_generator && this.async === other.async;
252
+ return this.static === other.static;
253
253
  };
254
254
 
255
255
  AST_PrivateMethod.prototype.shallow_cmp = function(other) {
256
- return this.static === other.static && this.is_generator === other.is_generator && this.async === other.async;
256
+ return this.static === other.static;
257
257
  };
258
258
 
259
259
  AST_Class.prototype.shallow_cmp = function(other) {
@@ -365,8 +365,6 @@ import { is_basic_identifier_string } from "./parse.js";
365
365
  ? from_moz(M.key)
366
366
  : from_moz_symbol(AST_SymbolMethod, M.key),
367
367
  quote : from_moz_quote(M.key, M.computed),
368
- is_generator: value.is_generator,
369
- async : value.async,
370
368
  static : false, // always an object
371
369
  value,
372
370
  };
@@ -395,8 +393,6 @@ import { is_basic_identifier_string } from "./parse.js";
395
393
  if (M.kind == "set") {
396
394
  return new (is_private ? AST_PrivateSetter : AST_ObjectSetter)(args);
397
395
  }
398
- args.is_generator = M.value.generator;
399
- args.async = M.value.async;
400
396
  return new (is_private ? AST_PrivateMethod : AST_ConciseMethod)(args);
401
397
  },
402
398
 
@@ -1257,15 +1253,12 @@ import { is_basic_identifier_string } from "./parse.js";
1257
1253
  };
1258
1254
  });
1259
1255
 
1260
- def_to_moz(AST_Function, function To_Moz_FunctionExpression(M, parent) {
1261
- var is_generator = parent.is_generator !== undefined
1262
- ? parent.is_generator
1263
- : M.is_generator;
1256
+ def_to_moz(AST_Function, function To_Moz_FunctionExpression(M) {
1264
1257
  return {
1265
1258
  type: "FunctionExpression",
1266
1259
  id: to_moz(M.name),
1267
1260
  params: M.argnames.map(to_moz_pattern),
1268
- generator: is_generator || false,
1261
+ generator: M.is_generator || false,
1269
1262
  async: M.async || false,
1270
1263
  body: to_moz_scope("BlockStatement", M)
1271
1264
  };
package/lib/output.js CHANGED
@@ -287,7 +287,7 @@ function OutputStream(options) {
287
287
  webkit : false,
288
288
  width : 80,
289
289
  wrap_iife : false,
290
- wrap_func_args : true,
290
+ wrap_func_args : false,
291
291
 
292
292
  _destroy_ast : false
293
293
  }, true);
@@ -2298,22 +2298,22 @@ function OutputStream(options) {
2298
2298
  });
2299
2299
  DEFPRINT(AST_ConciseMethod, function(self, output) {
2300
2300
  var type;
2301
- if (self.is_generator && self.async) {
2301
+ if (self.value.is_generator && self.value.async) {
2302
2302
  type = "async*";
2303
- } else if (self.is_generator) {
2303
+ } else if (self.value.is_generator) {
2304
2304
  type = "*";
2305
- } else if (self.async) {
2305
+ } else if (self.value.async) {
2306
2306
  type = "async";
2307
2307
  }
2308
2308
  self._print_getter_setter(type, false, output);
2309
2309
  });
2310
2310
  DEFPRINT(AST_PrivateMethod, function(self, output) {
2311
2311
  var type;
2312
- if (self.is_generator && self.async) {
2312
+ if (self.value.is_generator && self.value.async) {
2313
2313
  type = "async*";
2314
- } else if (self.is_generator) {
2314
+ } else if (self.value.is_generator) {
2315
2315
  type = "*";
2316
- } else if (self.async) {
2316
+ } else if (self.value.async) {
2317
2317
  type = "async";
2318
2318
  }
2319
2319
  self._print_getter_setter(type, true, output);
package/lib/parse.js CHANGED
@@ -1565,10 +1565,10 @@ function parse($TEXT, options) {
1565
1565
  });
1566
1566
  };
1567
1567
 
1568
- var function_ = function(ctor, is_generator_property, is_async, is_export_default) {
1568
+ var function_ = function(ctor, is_generator, is_async, is_export_default) {
1569
1569
  var in_statement = ctor === AST_Defun;
1570
- var is_generator = is("operator", "*");
1571
- if (is_generator) {
1570
+ if (is("operator", "*")) {
1571
+ is_generator = true;
1572
1572
  next();
1573
1573
  }
1574
1574
 
@@ -1585,11 +1585,11 @@ function parse($TEXT, options) {
1585
1585
  unexpected(prev());
1586
1586
 
1587
1587
  var args = [];
1588
- var body = _function_body(true, is_generator || is_generator_property, is_async, name, args);
1588
+ var body = _function_body(true, is_generator, is_async, name, args);
1589
1589
  return new ctor({
1590
1590
  start : args.start,
1591
1591
  end : body.end,
1592
- is_generator: is_generator || is_generator_property,
1592
+ is_generator: is_generator,
1593
1593
  async : is_async,
1594
1594
  name : name,
1595
1595
  argnames: args,
@@ -2665,8 +2665,6 @@ function parse($TEXT, options) {
2665
2665
  var node = new AST_MethodVariant({
2666
2666
  start : start,
2667
2667
  static : is_static,
2668
- is_generator: is_generator,
2669
- async : is_async,
2670
2668
  key : name,
2671
2669
  quote : name instanceof AST_SymbolMethod ?
2672
2670
  property_token.quote : undefined,
package/lib/size.js CHANGED
@@ -383,7 +383,7 @@ AST_ObjectSetter.prototype._size = function () {
383
383
  };
384
384
 
385
385
  AST_ConciseMethod.prototype._size = function () {
386
- return static_size(this.static) + key_size(this.key) + lambda_modifiers(this);
386
+ return static_size(this.static) + key_size(this.key);
387
387
  };
388
388
 
389
389
  AST_PrivateMethod.prototype._size = function () {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "homepage": "https://terser.org",
5
5
  "author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
6
6
  "license": "BSD-2-Clause",
7
- "version": "5.42.0",
7
+ "version": "5.43.0",
8
8
  "engines": {
9
9
  "node": ">=10"
10
10
  },