terser 5.5.0 → 5.6.1

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/lib/ast.js CHANGED
@@ -522,6 +522,9 @@ var AST_Lambda = DEFNODE("Lambda", "name argnames uses_arguments is_generator as
522
522
 
523
523
  if (this.name) push(this.name);
524
524
  },
525
+ is_braceless() {
526
+ return this.body[0] instanceof AST_Return && this.body[0].value;
527
+ }
525
528
  }, AST_Scope);
526
529
 
527
530
  var AST_Accessor = DEFNODE("Accessor", null, {
@@ -1007,7 +1010,7 @@ var AST_PropAccess = DEFNODE("PropAccess", "expression property optional", {
1007
1010
  $documentation: "Base class for property access expressions, i.e. `a.foo` or `a[\"foo\"]`",
1008
1011
  $propdoc: {
1009
1012
  expression: "[AST_Node] the “container” expression",
1010
- property: "[AST_Node|string] the property to access. For AST_Dot this is always a plain string, while for AST_Sub it's an arbitrary AST_Node",
1013
+ property: "[AST_Node|string] the property to access. For AST_Dot & AST_DotHash this is always a plain string, while for AST_Sub it's an arbitrary AST_Node",
1011
1014
 
1012
1015
  optional: "[boolean] whether this is an optional property access (IE ?.)"
1013
1016
  }
@@ -1028,6 +1031,18 @@ var AST_Dot = DEFNODE("Dot", "quote", {
1028
1031
  },
1029
1032
  }, AST_PropAccess);
1030
1033
 
1034
+ var AST_DotHash = DEFNODE("DotHash", "", {
1035
+ $documentation: "A dotted property access to a private property",
1036
+ _walk: function(visitor) {
1037
+ return visitor._visit(this, function() {
1038
+ this.expression._walk(visitor);
1039
+ });
1040
+ },
1041
+ _children_backwards(push) {
1042
+ push(this.expression);
1043
+ },
1044
+ }, AST_PropAccess);
1045
+
1031
1046
  var AST_Sub = DEFNODE("Sub", null, {
1032
1047
  $documentation: "Index-style property access, i.e. `a[\"foo\"]`",
1033
1048
  _walk: function(visitor) {
@@ -1045,7 +1060,7 @@ var AST_Sub = DEFNODE("Sub", null, {
1045
1060
  var AST_Chain = DEFNODE("Chain", "expression", {
1046
1061
  $documentation: "A chain expression like a?.b?.(c)?.[d]",
1047
1062
  $propdoc: {
1048
- expression: "[AST_Call|AST_Dot|AST_Sub] chain element."
1063
+ expression: "[AST_Call|AST_Dot|AST_DotHash|AST_Sub] chain element."
1049
1064
  },
1050
1065
  _walk: function (visitor) {
1051
1066
  return visitor._visit(this, function() {
@@ -1201,6 +1216,26 @@ var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", {
1201
1216
  }
1202
1217
  }, AST_ObjectProperty);
1203
1218
 
1219
+ var AST_PrivateSetter = DEFNODE("PrivateSetter", "static", {
1220
+ $propdoc: {
1221
+ static: "[boolean] whether this is a static private setter"
1222
+ },
1223
+ $documentation: "A private setter property",
1224
+ computed_key() {
1225
+ return false;
1226
+ }
1227
+ }, AST_ObjectProperty);
1228
+
1229
+ var AST_PrivateGetter = DEFNODE("PrivateGetter", "static", {
1230
+ $propdoc: {
1231
+ static: "[boolean] whether this is a static private getter"
1232
+ },
1233
+ $documentation: "A private getter property",
1234
+ computed_key() {
1235
+ return false;
1236
+ }
1237
+ }, AST_ObjectProperty);
1238
+
1204
1239
  var AST_ObjectSetter = DEFNODE("ObjectSetter", "quote static", {
1205
1240
  $propdoc: {
1206
1241
  quote: "[string|undefined] the original quote character, if any",
@@ -1236,6 +1271,10 @@ var AST_ConciseMethod = DEFNODE("ConciseMethod", "quote static is_generator asyn
1236
1271
  }
1237
1272
  }, AST_ObjectProperty);
1238
1273
 
1274
+ var AST_PrivateMethod = DEFNODE("PrivateMethod", "", {
1275
+ $documentation: "A private class method inside a class",
1276
+ }, AST_ConciseMethod);
1277
+
1239
1278
  var AST_Class = DEFNODE("Class", "name extends properties", {
1240
1279
  $propdoc: {
1241
1280
  name: "[AST_SymbolClass|AST_SymbolDefClass?] optional class name.",
@@ -1285,6 +1324,10 @@ var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", {
1285
1324
  }
1286
1325
  }, AST_ObjectProperty);
1287
1326
 
1327
+ var AST_ClassPrivateProperty = DEFNODE("ClassProperty", "", {
1328
+ $documentation: "A class property for a private property",
1329
+ }, AST_ClassProperty);
1330
+
1288
1331
  var AST_DefClass = DEFNODE("DefClass", null, {
1289
1332
  $documentation: "A class definition",
1290
1333
  }, AST_Class);
@@ -1684,6 +1727,7 @@ export {
1684
1727
  AST_Chain,
1685
1728
  AST_Class,
1686
1729
  AST_ClassExpression,
1730
+ AST_ClassPrivateProperty,
1687
1731
  AST_ClassProperty,
1688
1732
  AST_ConciseMethod,
1689
1733
  AST_Conditional,
@@ -1700,6 +1744,7 @@ export {
1700
1744
  AST_Directive,
1701
1745
  AST_Do,
1702
1746
  AST_Dot,
1747
+ AST_DotHash,
1703
1748
  AST_DWLoop,
1704
1749
  AST_EmptyStatement,
1705
1750
  AST_Exit,
@@ -1737,6 +1782,9 @@ export {
1737
1782
  AST_ObjectProperty,
1738
1783
  AST_ObjectSetter,
1739
1784
  AST_PrefixedTemplateString,
1785
+ AST_PrivateGetter,
1786
+ AST_PrivateMethod,
1787
+ AST_PrivateSetter,
1740
1788
  AST_PropAccess,
1741
1789
  AST_RegExp,
1742
1790
  AST_Return,
package/lib/cli.js CHANGED
@@ -42,7 +42,7 @@ export async function run_cli({ program, packageJson, fs, path }) {
42
42
  program.option("-m, --mangle [options]", "Mangle names/specify mangler options.", parse_js());
43
43
  program.option("--mangle-props [options]", "Mangle properties/specify mangler options.", parse_js());
44
44
  program.option("-f, --format [options]", "Format options.", parse_js());
45
- program.option("-b, --beautify [options]", "Alias for --format beautify=true.", parse_js());
45
+ program.option("-b, --beautify [options]", "Alias for --format.", parse_js());
46
46
  program.option("-o, --output <file>", "Output file (default STDOUT).");
47
47
  program.option("--comments [filter]", "Preserve copyright comments in the output.");
48
48
  program.option("--config-file <file>", "Read minify() options from JSON file.");
@@ -93,19 +93,9 @@ export async function run_cli({ program, packageJson, fs, path }) {
93
93
  else
94
94
  options.ecma = ecma;
95
95
  }
96
- if (program.beautify || program.format) {
97
- if (program.beautify && program.format) {
98
- fatal("Please only specify one of --beautify or --format");
99
- }
100
- if (program.beautify) {
101
- options.format = typeof program.beautify == "object" ? program.beautify : {};
102
- if (!("beautify" in options.format)) {
103
- options.format.beautify = true;
104
- }
105
- }
106
- if (program.format) {
107
- options.format = typeof program.format == "object" ? program.format : {};
108
- }
96
+ if (program.format || program.beautify) {
97
+ const chosenOption = program.format || program.beautify;
98
+ options.format = typeof chosenOption === "object" ? chosenOption : {};
109
99
  }
110
100
  if (program.comments) {
111
101
  if (typeof options.format != "object") options.format = {};
@@ -1416,8 +1416,11 @@ function tighten_body(statements, compressor) {
1416
1416
  || node instanceof AST_Debugger
1417
1417
  || node instanceof AST_Destructuring
1418
1418
  || node instanceof AST_Expansion
1419
- && node.expression instanceof AST_Symbol
1420
- && node.expression.definition().references.length > 1
1419
+ && node.expression instanceof AST_Symbol
1420
+ && (
1421
+ node.expression instanceof AST_This
1422
+ || node.expression.definition().references.length > 1
1423
+ )
1421
1424
  || node instanceof AST_IterationStatement && !(node instanceof AST_For)
1422
1425
  || node instanceof AST_LoopControl
1423
1426
  || node instanceof AST_Try
@@ -2586,7 +2589,13 @@ function is_undefined(node, compressor) {
2586
2589
  });
2587
2590
  def_may_throw_on_access(AST_Dot, function(compressor) {
2588
2591
  if (!is_strict(compressor)) return false;
2589
- if (this.expression instanceof AST_Function && this.property == "prototype") return false;
2592
+
2593
+ if (this.property == "prototype") {
2594
+ return !(
2595
+ this.expression instanceof AST_Function
2596
+ || this.expression instanceof AST_Class
2597
+ );
2598
+ }
2590
2599
  return true;
2591
2600
  });
2592
2601
  def_may_throw_on_access(AST_Chain, function(compressor) {
@@ -3433,7 +3442,7 @@ const pure_prop_access_globals = new Set([
3433
3442
  def_has_side_effects(AST_ObjectProperty, function(compressor) {
3434
3443
  return (
3435
3444
  this.computed_key() && this.key.has_side_effects(compressor)
3436
- || this.value.has_side_effects(compressor)
3445
+ || this.value && this.value.has_side_effects(compressor)
3437
3446
  );
3438
3447
  });
3439
3448
  def_has_side_effects(AST_ClassProperty, function(compressor) {
@@ -3561,7 +3570,7 @@ const pure_prop_access_globals = new Set([
3561
3570
  });
3562
3571
  def_may_throw(AST_ObjectProperty, function(compressor) {
3563
3572
  // TODO key may throw too
3564
- return this.value.may_throw(compressor);
3573
+ return this.value ? this.value.may_throw(compressor) : false;
3565
3574
  });
3566
3575
  def_may_throw(AST_ClassProperty, function(compressor) {
3567
3576
  return (
@@ -3695,7 +3704,7 @@ const pure_prop_access_globals = new Set([
3695
3704
  return this.properties.every((l) => l.is_constant_expression());
3696
3705
  });
3697
3706
  def_is_constant_expression(AST_ObjectProperty, function() {
3698
- return !(this.key instanceof AST_Node) && this.value.is_constant_expression();
3707
+ return !!(!(this.key instanceof AST_Node) && this.value && this.value.is_constant_expression());
3699
3708
  });
3700
3709
  })(function(node, func) {
3701
3710
  node.DEFMETHOD("is_constant_expression", func);
@@ -4522,7 +4531,7 @@ AST_Scope.DEFMETHOD("hoist_properties", function(compressor) {
4522
4531
  def_drop_side_effect_free(AST_ObjectProperty, function(compressor, first_in_statement) {
4523
4532
  const computed_key = this instanceof AST_ObjectKeyVal && this.key instanceof AST_Node;
4524
4533
  const key = computed_key && this.key.drop_side_effect_free(compressor, first_in_statement);
4525
- const value = this.value.drop_side_effect_free(compressor, first_in_statement);
4534
+ const value = this.value && this.value.drop_side_effect_free(compressor, first_in_statement);
4526
4535
  if (key && value) {
4527
4536
  return make_sequence(this, [key, value]);
4528
4537
  }
@@ -63,6 +63,7 @@ import {
63
63
  AST_Class,
64
64
  AST_ClassExpression,
65
65
  AST_ClassProperty,
66
+ AST_ClassPrivateProperty,
66
67
  AST_ConciseMethod,
67
68
  AST_Conditional,
68
69
  AST_Const,
@@ -78,6 +79,7 @@ import {
78
79
  AST_Directive,
79
80
  AST_Do,
80
81
  AST_Dot,
82
+ AST_DotHash,
81
83
  AST_EmptyStatement,
82
84
  AST_Expansion,
83
85
  AST_Export,
@@ -108,6 +110,9 @@ import {
108
110
  AST_ObjectProperty,
109
111
  AST_ObjectSetter,
110
112
  AST_PrefixedTemplateString,
113
+ AST_PrivateGetter,
114
+ AST_PrivateMethod,
115
+ AST_PrivateSetter,
111
116
  AST_PropAccess,
112
117
  AST_RegExp,
113
118
  AST_Return,
@@ -386,6 +391,23 @@ import {
386
391
  static : M.static,
387
392
  });
388
393
  },
394
+ PropertyDefinition: function(M) {
395
+ let key;
396
+ if (M.computed) {
397
+ key = from_moz(M.key);
398
+ } else {
399
+ if (M.key.type !== "Identifier") throw new Error("Non-Identifier key in PropertyDefinition");
400
+ key = from_moz(M.key);
401
+ }
402
+
403
+ return new AST_ClassProperty({
404
+ start : my_start_token(M),
405
+ end : my_end_token(M),
406
+ key,
407
+ value : from_moz(M.value),
408
+ static : M.static,
409
+ });
410
+ },
389
411
  ArrayExpression: function(M) {
390
412
  return new AST_Array({
391
413
  start : my_start_token(M),
@@ -574,7 +596,7 @@ import {
574
596
  : p.type == "ArrowFunctionExpression" ? (p.params.includes(M)) ? AST_SymbolFunarg : AST_SymbolRef
575
597
  : p.type == "ClassExpression" ? (p.id === M ? AST_SymbolClass : AST_SymbolRef)
576
598
  : p.type == "Property" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolMethod)
577
- : p.type == "FieldDefinition" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolClassProperty)
599
+ : p.type == "PropertyDefinition" || p.type === "FieldDefinition" ? (p.key === M && p.computed || p.value === M ? AST_SymbolRef : AST_SymbolClassProperty)
578
600
  : p.type == "ClassDeclaration" ? (p.id === M ? AST_SymbolDefClass : AST_SymbolRef)
579
601
  : p.type == "MethodDefinition" ? (p.computed ? AST_SymbolRef : AST_SymbolMethod)
580
602
  : p.type == "CatchClause" ? AST_SymbolCatch
@@ -873,6 +895,19 @@ import {
873
895
  };
874
896
  });
875
897
 
898
+ def_to_moz(AST_DotHash, function To_Moz_PrivateMemberExpression(M) {
899
+ return {
900
+ type: "MemberExpression",
901
+ object: to_moz(M.expression),
902
+ computed: false,
903
+ property: {
904
+ type: "PrivateIdentifier",
905
+ name: M.property
906
+ },
907
+ optional: M.optional
908
+ };
909
+ });
910
+
876
911
  def_to_moz(AST_PropAccess, function To_Moz_MemberExpression(M) {
877
912
  var isComputed = M instanceof AST_Sub;
878
913
  return {
@@ -965,12 +1000,38 @@ import {
965
1000
  if (M instanceof AST_ObjectSetter) {
966
1001
  kind = "set";
967
1002
  }
1003
+ if (M instanceof AST_PrivateGetter || M instanceof AST_PrivateSetter) {
1004
+ const kind = M instanceof AST_PrivateGetter ? "get" : "set";
1005
+ return {
1006
+ type: "MethodDefinition",
1007
+ computed: false,
1008
+ kind: kind,
1009
+ static: M.static,
1010
+ key: {
1011
+ type: "PrivateIdentifier",
1012
+ name: M.key.name
1013
+ },
1014
+ value: to_moz(M.value)
1015
+ };
1016
+ }
1017
+ if (M instanceof AST_ClassPrivateProperty) {
1018
+ return {
1019
+ type: "PropertyDefinition",
1020
+ key: {
1021
+ type: "PrivateIdentifier",
1022
+ name: M.key.name
1023
+ },
1024
+ value: to_moz(M.value),
1025
+ computed: false,
1026
+ static: M.static
1027
+ };
1028
+ }
968
1029
  if (M instanceof AST_ClassProperty) {
969
1030
  return {
970
- type: "FieldDefinition",
971
- computed,
1031
+ type: "PropertyDefinition",
972
1032
  key,
973
1033
  value: to_moz(M.value),
1034
+ computed,
974
1035
  static: M.static
975
1036
  };
976
1037
  }
@@ -1005,13 +1066,21 @@ import {
1005
1066
  value: to_moz(M.value)
1006
1067
  };
1007
1068
  }
1069
+
1070
+ const key = M instanceof AST_PrivateMethod
1071
+ ? {
1072
+ type: "PrivateIdentifier",
1073
+ name: M.key.name
1074
+ }
1075
+ : to_moz(M.key);
1076
+
1008
1077
  return {
1009
1078
  type: "MethodDefinition",
1010
- computed: !(M.key instanceof AST_Symbol) || M.key instanceof AST_SymbolRef,
1011
1079
  kind: M.key === "constructor" ? "constructor" : "method",
1080
+ key,
1081
+ value: to_moz(M.value),
1082
+ computed: !(M.key instanceof AST_Symbol) || M.key instanceof AST_SymbolRef,
1012
1083
  static: M.static,
1013
- key: to_moz(M.key),
1014
- value: to_moz(M.value)
1015
1084
  };
1016
1085
  });
1017
1086
 
package/lib/output.js CHANGED
@@ -68,8 +68,12 @@ import {
68
68
  AST_Chain,
69
69
  AST_Class,
70
70
  AST_ClassExpression,
71
+ AST_ClassPrivateProperty,
71
72
  AST_ClassProperty,
72
73
  AST_ConciseMethod,
74
+ AST_PrivateGetter,
75
+ AST_PrivateMethod,
76
+ AST_PrivateSetter,
73
77
  AST_Conditional,
74
78
  AST_Const,
75
79
  AST_Constant,
@@ -83,6 +87,7 @@ import {
83
87
  AST_Directive,
84
88
  AST_Do,
85
89
  AST_Dot,
90
+ AST_DotHash,
86
91
  AST_EmptyStatement,
87
92
  AST_Exit,
88
93
  AST_Expansion,
@@ -239,7 +244,7 @@ function OutputStream(options) {
239
244
  let printed_comments = new Set();
240
245
 
241
246
  var to_utf8 = options.ascii_only ? function(str, identifier) {
242
- if (options.ecma >= 2015) {
247
+ if (options.ecma >= 2015 && !options.safari10) {
243
248
  str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch) {
244
249
  var code = get_full_char_code(ch, 0).toString(16);
245
250
  return "\\u{" + code + "}";
@@ -928,6 +933,7 @@ function OutputStream(options) {
928
933
  var p = output.parent();
929
934
  return p instanceof AST_PropAccess && p.expression === this
930
935
  || p instanceof AST_Call && p.expression === this
936
+ || p instanceof AST_Binary && p.operator === "**" && p.left === this
931
937
  || output.option("safari10") && p instanceof AST_UnaryPrefix;
932
938
  });
933
939
 
@@ -1779,7 +1785,10 @@ function OutputStream(options) {
1779
1785
  var prop = self.property;
1780
1786
  var print_computed = RESERVED_WORDS.has(prop)
1781
1787
  ? output.option("ie8")
1782
- : !is_identifier_string(prop, output.option("ecma") >= 2015);
1788
+ : !is_identifier_string(
1789
+ prop,
1790
+ output.option("ecma") >= 2015 || output.option("safari10")
1791
+ );
1783
1792
 
1784
1793
  if (self.optional) output.print("?.");
1785
1794
 
@@ -1800,6 +1809,15 @@ function OutputStream(options) {
1800
1809
  output.print_name(prop);
1801
1810
  }
1802
1811
  });
1812
+ DEFPRINT(AST_DotHash, function(self, output) {
1813
+ var expr = self.expression;
1814
+ expr.print(output);
1815
+ var prop = self.property;
1816
+
1817
+ if (self.optional) output.print("?");
1818
+ output.print(".#");
1819
+ output.print_name(prop);
1820
+ });
1803
1821
  DEFPRINT(AST_Sub, function(self, output) {
1804
1822
  self.expression.print(output);
1805
1823
  if (self.optional) output.print("?.");
@@ -1949,7 +1967,7 @@ function OutputStream(options) {
1949
1967
  var print_string = RESERVED_WORDS.has(key)
1950
1968
  ? output.option("ie8")
1951
1969
  : (
1952
- output.option("ecma") < 2015
1970
+ output.option("ecma") < 2015 || output.option("safari10")
1953
1971
  ? !is_basic_identifier_string(key)
1954
1972
  : !is_identifier_string(key, true)
1955
1973
  );
@@ -1968,7 +1986,10 @@ function OutputStream(options) {
1968
1986
  var allowShortHand = output.option("shorthand");
1969
1987
  if (allowShortHand &&
1970
1988
  self.value instanceof AST_Symbol &&
1971
- is_identifier_string(self.key, output.option("ecma") >= 2015) &&
1989
+ is_identifier_string(
1990
+ self.key,
1991
+ output.option("ecma") >= 2015 || output.option("safari10")
1992
+ ) &&
1972
1993
  get_name(self.value) === self.key &&
1973
1994
  !RESERVED_WORDS.has(self.key)
1974
1995
  ) {
@@ -1977,7 +1998,10 @@ function OutputStream(options) {
1977
1998
  } else if (allowShortHand &&
1978
1999
  self.value instanceof AST_DefaultAssign &&
1979
2000
  self.value.left instanceof AST_Symbol &&
1980
- is_identifier_string(self.key, output.option("ecma") >= 2015) &&
2001
+ is_identifier_string(
2002
+ self.key,
2003
+ output.option("ecma") >= 2015 || output.option("safari10")
2004
+ ) &&
1981
2005
  get_name(self.value.left) === self.key
1982
2006
  ) {
1983
2007
  print_property_name(self.key, self.quote, output);
@@ -1997,6 +2021,23 @@ function OutputStream(options) {
1997
2021
  self.value.print(output);
1998
2022
  }
1999
2023
  });
2024
+ DEFPRINT(AST_ClassPrivateProperty, (self, output) => {
2025
+ if (self.static) {
2026
+ output.print("static");
2027
+ output.space();
2028
+ }
2029
+
2030
+ output.print("#");
2031
+
2032
+ print_property_name(self.key.name, self.quote, output);
2033
+
2034
+ if (self.value) {
2035
+ output.print("=");
2036
+ self.value.print(output);
2037
+ }
2038
+
2039
+ output.semicolon();
2040
+ });
2000
2041
  DEFPRINT(AST_ClassProperty, (self, output) => {
2001
2042
  if (self.static) {
2002
2043
  output.print("static");
@@ -2018,7 +2059,7 @@ function OutputStream(options) {
2018
2059
 
2019
2060
  output.semicolon();
2020
2061
  });
2021
- AST_ObjectProperty.DEFMETHOD("_print_getter_setter", function(type, output) {
2062
+ AST_ObjectProperty.DEFMETHOD("_print_getter_setter", function(type, is_private, output) {
2022
2063
  var self = this;
2023
2064
  if (self.static) {
2024
2065
  output.print("static");
@@ -2029,6 +2070,7 @@ function OutputStream(options) {
2029
2070
  output.space();
2030
2071
  }
2031
2072
  if (self.key instanceof AST_SymbolMethod) {
2073
+ if (is_private) output.print("#");
2032
2074
  print_property_name(self.key.name, self.quote, output);
2033
2075
  } else {
2034
2076
  output.with_square(function() {
@@ -2038,10 +2080,27 @@ function OutputStream(options) {
2038
2080
  self.value._do_print(output, true);
2039
2081
  });
2040
2082
  DEFPRINT(AST_ObjectSetter, function(self, output) {
2041
- self._print_getter_setter("set", output);
2083
+ self._print_getter_setter("set", false, output);
2042
2084
  });
2043
2085
  DEFPRINT(AST_ObjectGetter, function(self, output) {
2044
- self._print_getter_setter("get", output);
2086
+ self._print_getter_setter("get", false, output);
2087
+ });
2088
+ DEFPRINT(AST_PrivateSetter, function(self, output) {
2089
+ self._print_getter_setter("set", true, output);
2090
+ });
2091
+ DEFPRINT(AST_PrivateGetter, function(self, output) {
2092
+ self._print_getter_setter("get", true, output);
2093
+ });
2094
+ DEFPRINT(AST_PrivateMethod, function(self, output) {
2095
+ var type;
2096
+ if (self.is_generator && self.async) {
2097
+ type = "async*";
2098
+ } else if (self.is_generator) {
2099
+ type = "*";
2100
+ } else if (self.async) {
2101
+ type = "async";
2102
+ }
2103
+ self._print_getter_setter(type, true, output);
2045
2104
  });
2046
2105
  DEFPRINT(AST_ConciseMethod, function(self, output) {
2047
2106
  var type;
@@ -2052,7 +2111,7 @@ function OutputStream(options) {
2052
2111
  } else if (self.async) {
2053
2112
  type = "async";
2054
2113
  }
2055
- self._print_getter_setter(type, output);
2114
+ self._print_getter_setter(type, false, output);
2056
2115
  });
2057
2116
  AST_Symbol.DEFMETHOD("_do_print", function(output) {
2058
2117
  var def = this.definition();
@@ -2092,7 +2151,9 @@ function OutputStream(options) {
2092
2151
  source = regexp_source_fix(source);
2093
2152
  flags = flags ? sort_regexp_flags(flags) : "";
2094
2153
  source = source.replace(r_slash_script, slash_script_replace);
2154
+
2095
2155
  output.print(output.to_utf8(`/${source}/${flags}`));
2156
+
2096
2157
  const parent = output.parent();
2097
2158
  if (
2098
2159
  parent instanceof AST_Binary