rapydscript-ns 0.9.1 → 0.9.3

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/PYTHON_GAPS.md +420 -0
  3. package/README.md +154 -30
  4. package/TODO.md +22 -7
  5. package/language-service/index.js +241 -12
  6. package/language-service/language-service.d.ts +1 -1
  7. package/memory/project_string_impl.md +43 -0
  8. package/package.json +6 -2
  9. package/release/baselib-plain-pretty.js +248 -38
  10. package/release/baselib-plain-ugly.js +8 -8
  11. package/release/compiler.js +821 -305
  12. package/release/signatures.json +15 -15
  13. package/src/ast.pyj +4 -1
  14. package/src/baselib-builtins.pyj +56 -2
  15. package/src/baselib-containers.pyj +2 -0
  16. package/src/baselib-errors.pyj +7 -3
  17. package/src/baselib-internal.pyj +51 -6
  18. package/src/baselib-str.pyj +5 -3
  19. package/src/lib/asyncio.pyj +534 -0
  20. package/src/lib/base64.pyj +399 -0
  21. package/src/lib/bisect.pyj +73 -0
  22. package/src/lib/collections.pyj +1 -1
  23. package/src/lib/csv.pyj +494 -0
  24. package/src/lib/heapq.pyj +98 -0
  25. package/src/lib/html.pyj +382 -0
  26. package/src/lib/http/__init__.pyj +98 -0
  27. package/src/lib/http/client.pyj +304 -0
  28. package/src/lib/http/cookies.pyj +236 -0
  29. package/src/lib/logging.pyj +672 -0
  30. package/src/lib/pythonize.pyj +1 -1
  31. package/src/lib/string.pyj +357 -0
  32. package/src/lib/textwrap.pyj +329 -0
  33. package/src/lib/urllib/__init__.pyj +14 -0
  34. package/src/lib/urllib/error.pyj +66 -0
  35. package/src/lib/urllib/parse.pyj +475 -0
  36. package/src/lib/urllib/request.pyj +86 -0
  37. package/src/monaco-language-service/analyzer.js +5 -2
  38. package/src/monaco-language-service/completions.js +26 -0
  39. package/src/monaco-language-service/diagnostics.js +204 -5
  40. package/src/monaco-language-service/index.js +2 -2
  41. package/src/monaco-language-service/scope.js +1 -0
  42. package/src/output/functions.pyj +152 -6
  43. package/src/output/loops.pyj +26 -2
  44. package/src/output/modules.pyj +1 -1
  45. package/src/output/operators.pyj +15 -0
  46. package/src/output/stream.pyj +0 -1
  47. package/src/parse.pyj +80 -17
  48. package/src/tokenizer.pyj +1 -1
  49. package/test/async_generators.pyj +144 -0
  50. package/test/asyncio.pyj +307 -0
  51. package/test/base64.pyj +202 -0
  52. package/test/bisect.pyj +178 -0
  53. package/test/csv.pyj +405 -0
  54. package/test/float_special.pyj +64 -0
  55. package/test/heapq.pyj +174 -0
  56. package/test/html.pyj +212 -0
  57. package/test/http.pyj +259 -0
  58. package/test/imports.pyj +7 -0
  59. package/test/logging.pyj +356 -0
  60. package/test/long.pyj +130 -0
  61. package/test/parenthesized_with.pyj +141 -0
  62. package/test/python_compat.pyj +3 -5
  63. package/test/python_modulo.pyj +76 -0
  64. package/test/python_modulo_off.pyj +21 -0
  65. package/test/str.pyj +14 -0
  66. package/test/string.pyj +245 -0
  67. package/test/textwrap.pyj +172 -0
  68. package/test/type_display.pyj +48 -0
  69. package/test/type_enforcement.pyj +164 -0
  70. package/test/unit/index.js +80 -6
  71. package/test/unit/language-service-completions.js +119 -0
  72. package/test/unit/language-service-scope.js +32 -0
  73. package/test/unit/language-service.js +128 -4
  74. package/test/unit/run-language-service.js +17 -3
  75. package/test/unit/web-repl.js +2094 -29
  76. package/test/urllib.pyj +193 -0
  77. package/tools/compile.js +1 -1
  78. package/tools/compiler.d.ts +367 -0
  79. package/tools/embedded_compiler.js +7 -7
  80. package/web-repl/main.js +1 -1
  81. package/web-repl/rapydscript.js +3 -3
  82. package/test/omit_function_metadata.pyj +0 -20
@@ -4,7 +4,7 @@
4
4
  var ρσ_kwargs_symbol = (typeof Symbol === "function") ? Symbol("kwargs-object") : "kwargs-object-Symbol-5d0927e5554349048cf0e3762a228256";
5
5
  var ρσ_cond_temp, ρσ_expr_temp, ρσ_last_exception;
6
6
  var ρσ_object_counter = 0;
7
- let ρσ_len;
7
+ let ρσ_len, ρσ_NoneType, ρσ_js_builtin_names;
8
8
  function ρσ_bool(val) {
9
9
  if (val === null || val === undefined) return false;
10
10
  var ρσ_bool_t = typeof val;
@@ -71,13 +71,25 @@ if (!ρσ_int.__argnames__) Object.defineProperties(ρσ_int, {
71
71
 
72
72
  ρσ_int.__name__ = "int";
73
73
  function ρσ_float(val) {
74
- var ans;
74
+ var ans, s;
75
75
  if (typeof val === "number") {
76
76
  ans = val;
77
77
  } else {
78
78
  ans = parseFloat(val);
79
79
  }
80
80
  if (isNaN(ans)) {
81
+ if (typeof val === "string") {
82
+ s = val.trim().toLowerCase();
83
+ if (s === "inf" || s === "+inf" || s === "infinity" || s === "+infinity") {
84
+ return Infinity;
85
+ }
86
+ if (s === "-inf" || s === "-infinity") {
87
+ return -Infinity;
88
+ }
89
+ if (s === "nan" || s === "+nan" || s === "-nan") {
90
+ return NaN;
91
+ }
92
+ }
81
93
  throw new ValueError(ρσ_list_add("Could not convert string to float: ", arguments[0]));
82
94
  }
83
95
  return ans;
@@ -88,6 +100,58 @@ if (!ρσ_float.__argnames__) Object.defineProperties(ρσ_float, {
88
100
  });
89
101
 
90
102
  ρσ_float.__name__ = "float";
103
+ function ρσ_long(val, base) {
104
+ var t, b;
105
+ t = typeof val;
106
+ if (t === "bigint") {
107
+ return val;
108
+ }
109
+ if (t === "boolean") {
110
+ return BigInt(val ? 1 : 0);
111
+ }
112
+ if (t === "number") {
113
+ if (!Number.isInteger(val)) {
114
+ throw new TypeError("long() can't convert non-integer float to long");
115
+ }
116
+ try { return BigInt(val); } catch(e) { throw new ValueError("long() argument out of range: " + val); };
117
+ }
118
+ if (t === "string") {
119
+ b = (base !== null && base !== undefined) ? base : 10;
120
+ var ρσ_ls = val.trim();
121
+ try {
122
+ if (b === 16) {
123
+ if (ρσ_ls.slice(0, 2).toLowerCase() !== "0x") {
124
+ ρσ_ls = "0x" + ρσ_ls;
125
+ }
126
+ return BigInt(ρσ_ls);
127
+ } else if (b === 2) {
128
+ if (ρσ_ls.slice(0, 2).toLowerCase() !== "0b") {
129
+ ρσ_ls = "0b" + ρσ_ls;
130
+ }
131
+ return BigInt(ρσ_ls);
132
+ } else if (b === 8) {
133
+ if (ρσ_ls.slice(0, 2).toLowerCase() !== "0o") {
134
+ ρσ_ls = "0o" + ρσ_ls;
135
+ }
136
+ return BigInt(ρσ_ls);
137
+ } else {
138
+ return BigInt(ρσ_ls);
139
+ }
140
+ } catch (ρσ_Exception) {
141
+ ρσ_last_exception = ρσ_Exception;
142
+ {
143
+ throw new ValueError(ρσ_list_add(ρσ_list_add(ρσ_list_add("Invalid literal for long() with base ", b), ": "), val));
144
+ }
145
+ }
146
+ }
147
+ throw new TypeError(ρσ_list_add(ρσ_list_add("long() argument must be a string, a number, or a boolean, not '", t), "'"));
148
+ };
149
+ if (!ρσ_long.__argnames__) Object.defineProperties(ρσ_long, {
150
+ __argnames__ : {value: ["val", "base"]},
151
+ __module__ : {value: "__main__"}
152
+ });
153
+
154
+ ρσ_long.__name__ = "long";
91
155
  function ρσ_arraylike_creator() {
92
156
  var names;
93
157
  names = "Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" ");
@@ -220,7 +284,7 @@ if (!ρσ_round.__argnames__) Object.defineProperties(ρσ_round, {
220
284
 
221
285
  function ρσ_bin(x) {
222
286
  var ans;
223
- if (typeof x !== "number" || x % 1 !== 0) {
287
+ if (typeof x !== "number" || ρσ_op_mod_ns(x, 1) !== 0) {
224
288
  throw new TypeError("integer required");
225
289
  }
226
290
  ans = x.toString(2);
@@ -238,7 +302,7 @@ if (!ρσ_bin.__argnames__) Object.defineProperties(ρσ_bin, {
238
302
 
239
303
  function ρσ_hex(x) {
240
304
  var ans;
241
- if (typeof x !== "number" || x % 1 !== 0) {
305
+ if (typeof x !== "number" || ρσ_op_mod_ns(x, 1) !== 0) {
242
306
  throw new TypeError("integer required");
243
307
  }
244
308
  ans = x.toString(16);
@@ -676,7 +740,7 @@ function ρσ_pow(x, y, z) {
676
740
  var ans;
677
741
  ans = Math.pow(x, y);
678
742
  if (z !== undefined) {
679
- ans %= z;
743
+ ans = ρσ_op_mod_ns(ans, z);
680
744
  }
681
745
  return ans;
682
746
  };
@@ -685,8 +749,40 @@ if (!ρσ_pow.__argnames__) Object.defineProperties(ρσ_pow, {
685
749
  __module__ : {value: "__main__"}
686
750
  });
687
751
 
752
+ ρσ_NoneType = {"__name__": "NoneType"};
753
+ ρσ_NoneType.toString = (function() {
754
+ var ρσ_anonfunc = function () {
755
+ return "<class 'NoneType'>";
756
+ };
757
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
758
+ __module__ : {value: "__main__"}
759
+ });
760
+ return ρσ_anonfunc;
761
+ })();
762
+ ρσ_js_builtin_names = {"Number": "float", "String": "str", "Boolean": "bool", "Array": "list", "Object": "object", "Function": "function", "RegExp": "RegExp", "Date": "datetime", "Map": "dict", "Set": "set", "Uint8Array": "bytes"};
688
763
  function ρσ_type(x) {
689
- return x.constructor;
764
+ var c, n;
765
+ if (x === null || x === undefined) {
766
+ return ρσ_NoneType;
767
+ }
768
+ c = x.constructor;
769
+ if (!c) {
770
+ return ρσ_NoneType;
771
+ }
772
+ if (!Object.prototype.hasOwnProperty.call(c, "__ρσ_ts")) {
773
+ n = c.__name__ || ρσ_js_builtin_names[ρσ_bound_index(c.name, ρσ_js_builtin_names)] || c.name || "object";
774
+ c.toString = (function() {
775
+ var ρσ_anonfunc = function () {
776
+ return ρσ_list_add(ρσ_list_add("<class '", n), "'>");
777
+ };
778
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
779
+ __module__ : {value: "__main__"}
780
+ });
781
+ return ρσ_anonfunc;
782
+ })();
783
+ c.__ρσ_ts = true;
784
+ }
785
+ return c;
690
786
  };
691
787
  if (!ρσ_type.__argnames__) Object.defineProperties(ρσ_type, {
692
788
  __argnames__ : {value: ["x"]},
@@ -735,14 +831,14 @@ function ρσ_hash(obj) {
735
831
  }
736
832
  return ρσ_h;
737
833
  };
738
- if (obj.__hash__ === null) throw new TypeError("unhashable type: '" + (obj.constructor && obj.constructor.name ? obj.constructor.name : "object") + "'");
834
+ if (obj.__hash__ === null) throw new TypeError("unhashable type: \'" + (obj.constructor && obj.constructor.name ? obj.constructor.name : "object") + "\'");
739
835
  if (typeof obj.__hash__ === "function") return obj.__hash__();
740
- if (Array.isArray(obj)) throw new TypeError("unhashable type: 'list'");
741
- if (typeof ρσ_set === "function" && obj instanceof ρσ_set) throw new TypeError("unhashable type: 'set'");
742
- if (typeof Set === "function" && obj instanceof Set) throw new TypeError("unhashable type: 'set'");
743
- if (typeof ρσ_dict === "function" && obj instanceof ρσ_dict) throw new TypeError("unhashable type: 'dict'");
744
- if (typeof Map === "function" && obj instanceof Map) throw new TypeError("unhashable type: 'dict'");
745
- if (!obj.constructor || obj.constructor === Object) throw new TypeError("unhashable type: 'dict'");
836
+ if (Array.isArray(obj)) throw new TypeError("unhashable type: \'list\'");
837
+ if (typeof ρσ_set === "function" && obj instanceof ρσ_set) throw new TypeError("unhashable type: \'set\'");
838
+ if (typeof Set === "function" && obj instanceof Set) throw new TypeError("unhashable type: \'set\'");
839
+ if (typeof ρσ_dict === "function" && obj instanceof ρσ_dict) throw new TypeError("unhashable type: \'dict\'");
840
+ if (typeof Map === "function" && obj instanceof Map) throw new TypeError("unhashable type: \'dict\'");
841
+ if (!obj.constructor || obj.constructor === Object) throw new TypeError("unhashable type: \'dict\'");
746
842
  if (obj.ρσ_object_id === undefined) obj.ρσ_object_id = ++ρσ_hash_id_counter;
747
843
  return obj.ρσ_object_id;
748
844
  };
@@ -1486,7 +1582,7 @@ Object.defineProperty(ρσ_complex.prototype, "__class__", {get: function() { re
1486
1582
 
1487
1583
  ρσ_complex.__name__ = "complex";
1488
1584
  var abs = ρσ_abs, max = ρσ_max.bind(Math.max), min = ρσ_max.bind(Math.min), bool = ρσ_bool, type = ρσ_type;
1489
- var float = ρσ_float, int = ρσ_int, complex = ρσ_complex, arraylike = ρσ_arraylike_creator(), ρσ_arraylike = arraylike;
1585
+ var float = ρσ_float, int = ρσ_int, long = ρσ_long, complex = ρσ_complex, arraylike = ρσ_arraylike_creator(), ρσ_arraylike = arraylike;
1490
1586
  var id = ρσ_id, get_module = ρσ_get_module, pow = ρσ_pow, divmod = ρσ_divmod, __import__ = ρσ__import__;
1491
1587
  var dir = ρσ_dir, ord = ρσ_ord, chr = ρσ_chr, bin = ρσ_bin, hex = ρσ_hex, callable = ρσ_callable, round = ρσ_round;
1492
1588
  var enumerate = ρσ_enumerate, iter = ρσ_iter, reversed = ρσ_reversed, len = ρσ_len;
@@ -1942,7 +2038,7 @@ if (!ρσ_bytes.prototype.decode.__argnames__) Object.defineProperties(ρσ_byte
1942
2038
  ρσ_bytes.fromhex = function fromhex(s) {
1943
2039
  var data, val;
1944
2040
  s = s.replace(/ /g, "");
1945
- if (s.length % 2 !== 0) {
2041
+ if (ρσ_op_mod_ns(s.length, 2) !== 0) {
1946
2042
  throw new ValueError("non-hexadecimal number found in fromhex() arg");
1947
2043
  }
1948
2044
  data = ρσ_list_decorate([]);
@@ -3646,6 +3742,7 @@ if (!ρσ_set_wrap.__argnames__) Object.defineProperties(ρσ_set_wrap, {
3646
3742
  __module__ : {value: "__main__"}
3647
3743
  });
3648
3744
 
3745
+ ρσ_set.__name__ = "set";
3649
3746
  var set = ρσ_set, set_wrap = ρσ_set_wrap;
3650
3747
  function ρσ_frozenset(iterable) {
3651
3748
  var ans, s, iterator, result, keys;
@@ -4571,6 +4668,7 @@ if (!ρσ_dict_wrap.__argnames__) Object.defineProperties(ρσ_dict_wrap, {
4571
4668
  __module__ : {value: "__main__"}
4572
4669
  });
4573
4670
 
4671
+ ρσ_dict.__name__ = "dict";
4574
4672
  var dict = ρσ_dict, dict_wrap = ρσ_dict_wrap;
4575
4673
 
4576
4674
  function ρσ_kwargs_to_dict(kw) {
@@ -4635,6 +4733,7 @@ var ρσ_json_parse = function(text, reviver) {
4635
4733
  return JSON.parse(text, dict_reviver);
4636
4734
  };;// }}}
4637
4735
  var NameError = ReferenceError;
4736
+ var _ρσ_NativeError = Error;
4638
4737
  function Exception() {
4639
4738
  if (!(this instanceof Exception)) return new Exception(...arguments);
4640
4739
  if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
@@ -4644,7 +4743,7 @@ function Exception() {
4644
4743
  Exception.prototype.__init__ = function __init__(message) {
4645
4744
  var self = this;
4646
4745
  self.message = message;
4647
- self.stack = (new Error).stack;
4746
+ self.stack = _ρσ_NativeError().stack;
4648
4747
  self.name = self.constructor.name;
4649
4748
  };
4650
4749
  if (!Exception.prototype.__init__.__argnames__) Object.defineProperties(Exception.prototype.__init__, {
@@ -4706,65 +4805,95 @@ Object.defineProperty(AttributeError.prototype, "__class__", {get: function() {
4706
4805
 
4707
4806
  if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(AttributeError);
4708
4807
 
4808
+ function LookupError() {
4809
+ if (!(this instanceof LookupError)) return new LookupError(...arguments);
4810
+ if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
4811
+ LookupError.prototype.__init__.apply(this, arguments);
4812
+ }
4813
+ ρσ_extends(LookupError, Exception);
4814
+ LookupError.prototype.__init__ = function __init__ () {
4815
+ Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
4816
+ };
4817
+ LookupError.prototype.__repr__ = function __repr__ () {
4818
+ if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
4819
+ return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
4820
+ };
4821
+ LookupError.prototype.__str__ = function __str__ () {
4822
+ if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
4823
+ return this.__repr__();
4824
+ };
4825
+ LookupError.prototype.__format__ = function __format__ () {
4826
+ if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4827
+ if (!arguments[0]) return this.__str__();
4828
+ throw new TypeError("unsupported format specification");
4829
+ };
4830
+ Object.defineProperty(LookupError.prototype, "__bases__", {value: [Exception]});
4831
+ LookupError.__name__ = "LookupError";
4832
+ LookupError.__qualname__ = "LookupError";
4833
+ LookupError.__module__ = "__main__";
4834
+ Object.defineProperty(LookupError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
4835
+
4836
+ if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(LookupError);
4837
+
4709
4838
  function IndexError() {
4710
4839
  if (!(this instanceof IndexError)) return new IndexError(...arguments);
4711
4840
  if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
4712
4841
  IndexError.prototype.__init__.apply(this, arguments);
4713
4842
  }
4714
- ρσ_extends(IndexError, Exception);
4843
+ ρσ_extends(IndexError, LookupError);
4715
4844
  IndexError.prototype.__init__ = function __init__ () {
4716
- Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
4845
+ LookupError.prototype.__init__ && LookupError.prototype.__init__.apply(this, arguments);
4717
4846
  };
4718
4847
  IndexError.prototype.__repr__ = function __repr__ () {
4719
- if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
4848
+ if(LookupError.prototype.__repr__) return LookupError.prototype.__repr__.call(this);
4720
4849
  return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
4721
4850
  };
4722
4851
  IndexError.prototype.__str__ = function __str__ () {
4723
- if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
4852
+ if(LookupError.prototype.__str__) return LookupError.prototype.__str__.call(this);
4724
4853
  return this.__repr__();
4725
4854
  };
4726
4855
  IndexError.prototype.__format__ = function __format__ () {
4727
- if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4856
+ if(LookupError.prototype.__format__) return LookupError.prototype.__format__.call(this, arguments[0]);
4728
4857
  if (!arguments[0]) return this.__str__();
4729
4858
  throw new TypeError("unsupported format specification");
4730
4859
  };
4731
- Object.defineProperty(IndexError.prototype, "__bases__", {value: [Exception]});
4860
+ Object.defineProperty(IndexError.prototype, "__bases__", {value: [LookupError]});
4732
4861
  IndexError.__name__ = "IndexError";
4733
4862
  IndexError.__qualname__ = "IndexError";
4734
4863
  IndexError.__module__ = "__main__";
4735
4864
  Object.defineProperty(IndexError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
4736
4865
 
4737
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(IndexError);
4866
+ if (typeof LookupError.__init_subclass__ === "function") LookupError.__init_subclass__.call(IndexError);
4738
4867
 
4739
4868
  function KeyError() {
4740
4869
  if (!(this instanceof KeyError)) return new KeyError(...arguments);
4741
4870
  if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
4742
4871
  KeyError.prototype.__init__.apply(this, arguments);
4743
4872
  }
4744
- ρσ_extends(KeyError, Exception);
4873
+ ρσ_extends(KeyError, LookupError);
4745
4874
  KeyError.prototype.__init__ = function __init__ () {
4746
- Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
4875
+ LookupError.prototype.__init__ && LookupError.prototype.__init__.apply(this, arguments);
4747
4876
  };
4748
4877
  KeyError.prototype.__repr__ = function __repr__ () {
4749
- if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
4878
+ if(LookupError.prototype.__repr__) return LookupError.prototype.__repr__.call(this);
4750
4879
  return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
4751
4880
  };
4752
4881
  KeyError.prototype.__str__ = function __str__ () {
4753
- if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
4882
+ if(LookupError.prototype.__str__) return LookupError.prototype.__str__.call(this);
4754
4883
  return this.__repr__();
4755
4884
  };
4756
4885
  KeyError.prototype.__format__ = function __format__ () {
4757
- if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
4886
+ if(LookupError.prototype.__format__) return LookupError.prototype.__format__.call(this, arguments[0]);
4758
4887
  if (!arguments[0]) return this.__str__();
4759
4888
  throw new TypeError("unsupported format specification");
4760
4889
  };
4761
- Object.defineProperty(KeyError.prototype, "__bases__", {value: [Exception]});
4890
+ Object.defineProperty(KeyError.prototype, "__bases__", {value: [LookupError]});
4762
4891
  KeyError.__name__ = "KeyError";
4763
4892
  KeyError.__qualname__ = "KeyError";
4764
4893
  KeyError.__module__ = "__main__";
4765
4894
  Object.defineProperty(KeyError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
4766
4895
 
4767
- if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(KeyError);
4896
+ if (typeof LookupError.__init_subclass__ === "function") LookupError.__init_subclass__.call(KeyError);
4768
4897
 
4769
4898
  function ValueError() {
4770
4899
  if (!(this instanceof ValueError)) return new ValueError(...arguments);
@@ -5173,7 +5302,7 @@ function ρσ_eslice(arr, step, start, end) {
5173
5302
  }
5174
5303
  arr = arr.slice(start, end).filter((function() {
5175
5304
  var ρσ_anonfunc = function (e, i) {
5176
- return i % step === 0;
5305
+ return ρσ_op_mod_ns(i, step) === 0;
5177
5306
  };
5178
5307
  if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
5179
5308
  __argnames__ : {value: ["e", "i"]},
@@ -5658,6 +5787,9 @@ function ρσ_arith_type_name(v) {
5658
5787
  if (t === "boolean") {
5659
5788
  return "bool";
5660
5789
  }
5790
+ if (t === "bigint") {
5791
+ return "long";
5792
+ }
5661
5793
  if (t === "number") {
5662
5794
  return (Number.isInteger(v)) ? "int" : "float";
5663
5795
  }
@@ -5693,6 +5825,9 @@ function ρσ_op_add(a, b) {
5693
5825
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5694
5826
  return a + b;
5695
5827
  }
5828
+ if (ta === "bigint" && tb === "bigint") {
5829
+ return a + b;
5830
+ }
5696
5831
  if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
5697
5832
  return a + b;
5698
5833
  }
@@ -5716,6 +5851,9 @@ function ρσ_op_sub(a, b) {
5716
5851
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5717
5852
  return a - b;
5718
5853
  }
5854
+ if (ta === "bigint" && tb === "bigint") {
5855
+ return a - b;
5856
+ }
5719
5857
  throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for -: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
5720
5858
  };
5721
5859
  if (!ρσ_op_sub.__argnames__) Object.defineProperties(ρσ_op_sub, {
@@ -5756,6 +5894,9 @@ function ρσ_op_mul(a, b) {
5756
5894
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5757
5895
  return a * b;
5758
5896
  }
5897
+ if (ta === "bigint" && tb === "bigint") {
5898
+ return a * b;
5899
+ }
5759
5900
  throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for *: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
5760
5901
  };
5761
5902
  if (!ρσ_op_mul.__argnames__) Object.defineProperties(ρσ_op_mul, {
@@ -5776,6 +5917,9 @@ function ρσ_op_truediv(a, b) {
5776
5917
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5777
5918
  return a / b;
5778
5919
  }
5920
+ if (ta === "bigint" && tb === "bigint") {
5921
+ throw new TypeError("unsupported operand type(s) for /: 'long' and 'long' — use // for integer division of long values");
5922
+ }
5779
5923
  throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for /: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
5780
5924
  };
5781
5925
  if (!ρσ_op_truediv.__argnames__) Object.defineProperties(ρσ_op_truediv, {
@@ -5796,6 +5940,9 @@ function ρσ_op_floordiv(a, b) {
5796
5940
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5797
5941
  return Math.floor(a / b);
5798
5942
  }
5943
+ if (ta === "bigint" && tb === "bigint") {
5944
+ var ρσ_bq = a / b, ρσ_br = a % b; if (ρσ_br !== 0n && (ρσ_br < 0n) !== (b < 0n)) { return ρσ_bq - 1n; } return ρσ_bq;;
5945
+ }
5799
5946
  throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for //: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
5800
5947
  };
5801
5948
  if (!ρσ_op_floordiv.__argnames__) Object.defineProperties(ρσ_op_floordiv, {
@@ -5814,7 +5961,10 @@ function ρσ_op_mod(a, b) {
5814
5961
  ta = typeof a;
5815
5962
  tb = typeof b;
5816
5963
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5817
- return a % b;
5964
+ var ρσ_mr = a % b; if (ρσ_mr !== 0 && (ρσ_mr < 0) !== (b < 0)) { return ρσ_mr + Number(b); } return ρσ_mr;;
5965
+ }
5966
+ if (ta === "bigint" && tb === "bigint") {
5967
+ var ρσ_mr = a % b; if (ρσ_mr !== 0n && (ρσ_mr < 0n) !== (b < 0n)) { return ρσ_mr + b; } return ρσ_mr;;
5818
5968
  }
5819
5969
  throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for %: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
5820
5970
  };
@@ -5836,6 +5986,12 @@ function ρσ_op_pow(a, b) {
5836
5986
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5837
5987
  return Math.pow(a, b);
5838
5988
  }
5989
+ if (ta === "bigint" && tb === "bigint") {
5990
+ if (b < 0n) {
5991
+ throw new ValueError("negative exponent not supported for long values");
5992
+ }
5993
+ return a ** b;
5994
+ }
5839
5995
  throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for **: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
5840
5996
  };
5841
5997
  if (!ρσ_op_pow.__argnames__) Object.defineProperties(ρσ_op_pow, {
@@ -5850,6 +6006,9 @@ function ρσ_op_and(a, b) {
5850
6006
  if (b !== null && typeof b.__rand__ === "function") {
5851
6007
  return b.__rand__(a);
5852
6008
  }
6009
+ if (typeof a === "bigint" !== (typeof b === "bigint")) {
6010
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for &: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
6011
+ }
5853
6012
  return a & b;
5854
6013
  };
5855
6014
  if (!ρσ_op_and.__argnames__) Object.defineProperties(ρσ_op_and, {
@@ -5864,6 +6023,9 @@ function ρσ_op_or(a, b) {
5864
6023
  if (b !== null && typeof b.__ror__ === "function") {
5865
6024
  return b.__ror__(a);
5866
6025
  }
6026
+ if (typeof a === "bigint" !== (typeof b === "bigint")) {
6027
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for |: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
6028
+ }
5867
6029
  return a | b;
5868
6030
  };
5869
6031
  if (!ρσ_op_or.__argnames__) Object.defineProperties(ρσ_op_or, {
@@ -5878,6 +6040,9 @@ function ρσ_op_xor(a, b) {
5878
6040
  if (b !== null && typeof b.__rxor__ === "function") {
5879
6041
  return b.__rxor__(a);
5880
6042
  }
6043
+ if (typeof a === "bigint" !== (typeof b === "bigint")) {
6044
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for ^: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
6045
+ }
5881
6046
  return a ^ b;
5882
6047
  };
5883
6048
  if (!ρσ_op_xor.__argnames__) Object.defineProperties(ρσ_op_xor, {
@@ -5892,6 +6057,9 @@ function ρσ_op_lshift(a, b) {
5892
6057
  if (b !== null && typeof b.__rlshift__ === "function") {
5893
6058
  return b.__rlshift__(a);
5894
6059
  }
6060
+ if (typeof a === "bigint" !== (typeof b === "bigint")) {
6061
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for <<: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
6062
+ }
5895
6063
  return a << b;
5896
6064
  };
5897
6065
  if (!ρσ_op_lshift.__argnames__) Object.defineProperties(ρσ_op_lshift, {
@@ -5906,6 +6074,9 @@ function ρσ_op_rshift(a, b) {
5906
6074
  if (b !== null && typeof b.__rrshift__ === "function") {
5907
6075
  return b.__rrshift__(a);
5908
6076
  }
6077
+ if (typeof a === "bigint" !== (typeof b === "bigint")) {
6078
+ throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for >>: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
6079
+ }
5909
6080
  return a >> b;
5910
6081
  };
5911
6082
  if (!ρσ_op_rshift.__argnames__) Object.defineProperties(ρσ_op_rshift, {
@@ -5940,6 +6111,9 @@ function ρσ_op_lt(a, b) {
5940
6111
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5941
6112
  return a < b;
5942
6113
  }
6114
+ if (ta === "bigint" && tb === "bigint") {
6115
+ return a < b;
6116
+ }
5943
6117
  if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
5944
6118
  return a < b;
5945
6119
  }
@@ -5977,6 +6151,9 @@ function ρσ_op_le(a, b) {
5977
6151
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
5978
6152
  return a <= b;
5979
6153
  }
6154
+ if (ta === "bigint" && tb === "bigint") {
6155
+ return a <= b;
6156
+ }
5980
6157
  if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
5981
6158
  return a <= b;
5982
6159
  }
@@ -6003,6 +6180,9 @@ function ρσ_op_gt(a, b) {
6003
6180
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
6004
6181
  return a > b;
6005
6182
  }
6183
+ if (ta === "bigint" && tb === "bigint") {
6184
+ return a > b;
6185
+ }
6006
6186
  if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
6007
6187
  return a > b;
6008
6188
  }
@@ -6029,6 +6209,9 @@ function ρσ_op_ge(a, b) {
6029
6209
  if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
6030
6210
  return a >= b;
6031
6211
  }
6212
+ if (ta === "bigint" && tb === "bigint") {
6213
+ return a >= b;
6214
+ }
6032
6215
  if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
6033
6216
  return a >= b;
6034
6217
  }
@@ -6328,6 +6511,9 @@ function ρσ_op_floordiv_ns(a, b) {
6328
6511
  if (b !== null && typeof b.__rfloordiv__ === "function") {
6329
6512
  return b.__rfloordiv__(a);
6330
6513
  }
6514
+ if (typeof a === "bigint" && typeof b === "bigint") {
6515
+ var ρσ_bq = a / b, ρσ_br = a % b; if (ρσ_br !== 0n && (ρσ_br < 0n) !== (b < 0n)) { return ρσ_bq - 1n; } return ρσ_bq;;
6516
+ }
6331
6517
  return Math.floor(a / b);
6332
6518
  };
6333
6519
  if (!ρσ_op_floordiv_ns.__argnames__) Object.defineProperties(ρσ_op_floordiv_ns, {
@@ -6336,12 +6522,21 @@ if (!ρσ_op_floordiv_ns.__argnames__) Object.defineProperties(ρσ_op_floordiv_
6336
6522
  });
6337
6523
 
6338
6524
  function ρσ_op_mod_ns(a, b) {
6525
+ var ta, tb;
6339
6526
  if (a !== null && typeof a.__mod__ === "function") {
6340
6527
  return a.__mod__(b);
6341
6528
  }
6342
6529
  if (b !== null && typeof b.__rmod__ === "function") {
6343
6530
  return b.__rmod__(a);
6344
6531
  }
6532
+ ta = typeof a;
6533
+ tb = typeof b;
6534
+ if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
6535
+ var ρσ_mr = a % b; if (ρσ_mr !== 0 && (ρσ_mr < 0) !== (b < 0)) { return ρσ_mr + Number(b); } return ρσ_mr;;
6536
+ }
6537
+ if (ta === "bigint" && tb === "bigint") {
6538
+ var ρσ_mr = a % b; if (ρσ_mr !== 0n && (ρσ_mr < 0n) !== (b < 0n)) { return ρσ_mr + b; } return ρσ_mr;;
6539
+ }
6345
6540
  return a % b;
6346
6541
  };
6347
6542
  if (!ρσ_op_mod_ns.__argnames__) Object.defineProperties(ρσ_op_mod_ns, {
@@ -6356,6 +6551,9 @@ function ρσ_op_pow_ns(a, b) {
6356
6551
  if (b !== null && typeof b.__rpow__ === "function") {
6357
6552
  return b.__rpow__(a);
6358
6553
  }
6554
+ if (typeof a === "bigint" && typeof b === "bigint") {
6555
+ return a ** b;
6556
+ }
6359
6557
  return Math.pow(a, b);
6360
6558
  };
6361
6559
  if (!ρσ_op_pow_ns.__argnames__) Object.defineProperties(ρσ_op_pow_ns, {
@@ -6547,15 +6745,24 @@ function ρσ_instanceof() {
6547
6745
  if ((q === Array || q === ρσ_list_constructor) && Array.isArray(obj)) {
6548
6746
  return true;
6549
6747
  }
6748
+ if (q === ρσ_tuple_constructor && Array.isArray(obj)) {
6749
+ return true;
6750
+ }
6550
6751
  if (q === ρσ_str && (typeof obj === "string" || obj instanceof String)) {
6551
6752
  return true;
6552
6753
  }
6754
+ if (q === ρσ_bool && (typeof obj === "boolean" || obj instanceof Boolean)) {
6755
+ return true;
6756
+ }
6553
6757
  if (q === ρσ_int && typeof obj === "number" && Number.isInteger(obj)) {
6554
6758
  return true;
6555
6759
  }
6556
6760
  if (q === ρσ_float && typeof obj === "number" && !Number.isInteger(obj)) {
6557
6761
  return true;
6558
6762
  }
6763
+ if (q === ρσ_long && typeof obj === "bigint") {
6764
+ return true;
6765
+ }
6559
6766
  if (bases.length > 1) {
6560
6767
  for (var c = 1; c < bases.length; c++) {
6561
6768
  cls = bases[(typeof c === "number" && c < 0) ? bases.length + c : c];
@@ -7014,6 +7221,9 @@ function ρσ_str(x) {
7014
7221
  if (x === undefined) {
7015
7222
  return "undefined";
7016
7223
  }
7224
+ if (typeof x === "bigint") {
7225
+ return String(x);
7226
+ }
7017
7227
  ans = x;
7018
7228
  if (typeof x.__str__ === "function") {
7019
7229
  ans = x.__str__();
@@ -7976,13 +8186,13 @@ define_str_func("replace", (function() {
7976
8186
  var ρσ_anonfunc = function (old, repl, count) {
7977
8187
  var string, pos, idx;
7978
8188
  string = this;
7979
- if (count === 1) {
8189
+ if (old instanceof RegExp) {
7980
8190
  return ρσ_orig_replace(string, old, repl);
7981
8191
  }
7982
- if (count < 1) {
8192
+ if (count === 0) {
7983
8193
  return string;
7984
8194
  }
7985
- count = count || Number.MAX_VALUE;
8195
+ count = (count > 0) ? count : Number.MAX_VALUE;
7986
8196
  pos = 0;
7987
8197
  while (count > 0) {
7988
8198
  count -= 1;
@@ -8016,7 +8226,7 @@ define_str_func("split", (function() {
8016
8226
  for (var i = 0; i < ans.length; i++) {
8017
8227
  if (parts.length >= ρσ_list_add(maxsplit, 1)) {
8018
8228
  extra = ρσ_list_iadd(extra, ans[(typeof i === "number" && i < 0) ? ans.length + i : i]);
8019
- } else if (i % 2 === 0) {
8229
+ } else if (ρσ_op_mod_ns(i, 2) === 0) {
8020
8230
  parts.push(ans[(typeof i === "number" && i < 0) ? ans.length + i : i]);
8021
8231
  }
8022
8232
  }
@@ -8128,7 +8338,7 @@ define_str_func("splitlines", (function() {
8128
8338
  parts = split(this, /((?:\r?\n)|\r)/);
8129
8339
  ans = [];
8130
8340
  for (var i = 0; i < parts.length; i++) {
8131
- if (i % 2 === 0) {
8341
+ if (ρσ_op_mod_ns(i, 2) === 0) {
8132
8342
  ans.push(parts[(typeof i === "number" && i < 0) ? parts.length + i : i]);
8133
8343
  } else {
8134
8344
  ans[ans.length-1] = ρσ_list_iadd(ans[ans.length-1], parts[(typeof i === "number" && i < 0) ? parts.length + i : i]);
@@ -8192,7 +8402,7 @@ define_str_func("expandtabs", (function() {
8192
8402
  ch = string[(typeof i === "number" && i < 0) ? string.length + i : i];
8193
8403
  if (ch === "\t") {
8194
8404
  if (tabsize > 0) {
8195
- spaces = tabsize - col % tabsize;
8405
+ spaces = tabsize - ρσ_op_mod_ns(col, tabsize);
8196
8406
  ans = ρσ_list_iadd(ans, new Array(spaces + 1).join(" "));
8197
8407
  col = ρσ_list_iadd(col, spaces);
8198
8408
  }
@@ -9869,6 +10079,7 @@ return this.__repr__();
9869
10079
  ρσ_d["name"] = "[AST_SymbolRef?] the loop variable, only if `init` is AST_Var";
9870
10080
  ρσ_d["object"] = "[AST_Node] the object that we're looping through";
9871
10081
  ρσ_d["belse"] = "[AST_Else?] the `else` clause, run when no break occurred";
10082
+ ρσ_d["is_async"] = "[bool*] True iff this is an `async for` (uses `for await ... of`)";
9872
10083
  return ρσ_d;
9873
10084
  }).call(this);
9874
10085
  if (typeof AST_StatementWithBody.__init_subclass__ === "function") AST_StatementWithBody.__init_subclass__.call(AST_ForIn);
@@ -11115,6 +11326,7 @@ return this.__repr__();
11115
11326
  ρσ_d["is_expression"] = "[bool*] True iff this function is a function expression";
11116
11327
  ρσ_d["is_anonymous"] = "[bool*] True iff this function is an anonymous function";
11117
11328
  ρσ_d["return_annotation"] = "[AST_Node?] The return type annotation provided (if any)";
11329
+ ρσ_d["type_enforce"] = "[bool*] True iff type_enforcement scoped flag is active for this function";
11118
11330
  return ρσ_d;
11119
11331
  }).call(this);
11120
11332
  if (typeof AST_Scope.__init_subclass__ === "function") AST_Scope.__init_subclass__.call(AST_Lambda);
@@ -12744,6 +12956,7 @@ return this.__repr__();
12744
12956
  ρσ_d["right"] = "[AST_Node] right-hand side expression";
12745
12957
  ρσ_d["overloaded"] = "[bool] Whether to use Python-style operator overloading dispatch";
12746
12958
  ρσ_d["strict_arith"] = "[bool] Whether incompatible operand types raise TypeError (default True when overloaded; disable with no_strict_arithmetic)";
12959
+ ρσ_d["python_mod"] = "[bool] Whether `%` uses Python-style modulo (sign of divisor); disable with no_python_modulo";
12747
12960
  ρσ_d["python_truthiness"] = "[bool] Whether to use Python truthiness (from __python__ import truthiness)";
12748
12961
  return ρσ_d;
12749
12962
  }).call(this);
@@ -16027,7 +16240,7 @@ return this.__repr__();
16027
16240
  if ((peek() === "'" || peek() === "\"") && is_string_modifier(tok.value)) {
16028
16241
  mods = tok.value.toLowerCase();
16029
16242
  start_pos_for_string = S.tokpos;
16030
- stok = read_string(mods.indexOf("r") !== -1, mods.indexOf("v") !== -1);
16243
+ stok = read_string(mods.indexOf("r") !== -1 || mods.indexOf("v") !== -1, mods.indexOf("v") !== -1);
16031
16244
  tok.endpos = stok.endpos;
16032
16245
  if (stok.type !== "js" && mods.indexOf("f") !== -1) {
16033
16246
  tok.col = ρσ_list_iadd(tok.col, start_pos_for_string - tok.pos);
@@ -16244,7 +16457,7 @@ return this.__repr__();
16244
16457
  var is_token = ρσ_modules.tokenizer.is_token;
16245
16458
  var RESERVED_WORDS = ρσ_modules.tokenizer.RESERVED_WORDS;
16246
16459
 
16247
- COMPILER_VERSION = "146ab479438eea3efe2870440ee9a4ef2bdd4319";
16460
+ COMPILER_VERSION = "60322f3e68e9a8e835b99d99a32e8f7eed1358dd";
16248
16461
  PYTHON_FLAGS = (function(){
16249
16462
  var ρσ_d = Object.create(null);
16250
16463
  ρσ_d["dict_literals"] = true;
@@ -16255,6 +16468,8 @@ return this.__repr__();
16255
16468
  ρσ_d["truthiness"] = true;
16256
16469
  ρσ_d["jsx"] = true;
16257
16470
  ρσ_d["strict_arithmetic"] = true;
16471
+ ρσ_d["python_modulo"] = true;
16472
+ ρσ_d["type_enforcement"] = true;
16258
16473
  return ρσ_d;
16259
16474
  }).call(this);
16260
16475
  function get_compiler_version() {
@@ -16950,7 +17165,7 @@ return this.__repr__();
16950
17165
 
16951
17166
  var statement = embed_tokens((function() {
16952
17167
  var ρσ_anonfunc = function statement() {
16953
- var tmp_, p, while_cond, while_body, while_belse, start, func, chain, value, node, cond, msg, tmp, cause;
17168
+ var tmp_, p, while_cond, while_body, while_belse, start, func, chain, forstmt, value, node, cond, msg, tmp, cause;
16954
17169
  if (S.token.type === "operator" && S.token.value.substr(0, 1) === "/") {
16955
17170
  token_error(S.token, "RapydScript does not support statements starting with regexp literals");
16956
17171
  }
@@ -17101,8 +17316,15 @@ return this.__repr__();
17101
17316
  }
17102
17317
  } else if (tmp_ === "async") {
17103
17318
  start = prev();
17319
+ if (is_("keyword", "for")) {
17320
+ next();
17321
+ forstmt = for_();
17322
+ forstmt.is_async = true;
17323
+ forstmt.start = start;
17324
+ return forstmt;
17325
+ }
17104
17326
  if (!is_("keyword", "def")) {
17105
- croak("Expected 'def' after 'async'");
17327
+ croak("Expected 'def' or 'for' after 'async'");
17106
17328
  }
17107
17329
  next();
17108
17330
  func = function_((ρσ_expr_temp = S.in_class)[ρσ_expr_temp.length-1], false, true);
@@ -17245,33 +17467,95 @@ return this.__repr__();
17245
17467
  })());
17246
17468
 
17247
17469
  function with_() {
17248
- var clauses, start, expr, alias, body;
17470
+ var clauses, start, is_parenthesized_with, depth, i, tok, expr, alias, body;
17249
17471
  clauses = [];
17250
17472
  start = S.token;
17251
- while (true) {
17252
- if (is_("eof")) {
17253
- unexpected();
17254
- }
17255
- expr = expression();
17256
- alias = null;
17257
- if (is_("keyword", "as")) {
17258
- next();
17259
- alias = as_symbol(AST_SymbolAlias);
17473
+ is_parenthesized_with = false;
17474
+ if (is_("punc", "(")) {
17475
+ depth = 0;
17476
+ i = 0;
17477
+ while (true) {
17478
+ while (S.peeked.length <= i) {
17479
+ S.peeked.push(S.input());
17480
+ }
17481
+ tok = (ρσ_expr_temp = S.peeked)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
17482
+ if (tok.type === "eof") {
17483
+ break;
17484
+ }
17485
+ if (tok.type === "punc") {
17486
+ if (tok.value === "(" || tok.value === "[" || tok.value === "{") {
17487
+ depth = ρσ_list_iadd(depth, 1);
17488
+ } else if (tok.value === ")" || tok.value === "]" || tok.value === "}") {
17489
+ if (depth === 0) {
17490
+ break;
17491
+ }
17492
+ depth -= 1;
17493
+ }
17494
+ } else if (tok.type === "keyword" && tok.value === "as" && depth === 0) {
17495
+ is_parenthesized_with = true;
17496
+ break;
17497
+ }
17498
+ i = ρσ_list_iadd(i, 1);
17260
17499
  }
17261
- clauses.push(new AST_WithClause((function(){
17262
- var ρσ_d = Object.create(null);
17263
- ρσ_d["expression"] = expr;
17264
- ρσ_d["alias"] = alias;
17265
- return ρσ_d;
17266
- }).call(this)));
17267
- if (is_("punc", ",")) {
17500
+ }
17501
+ if (is_parenthesized_with) {
17502
+ next();
17503
+ while (true) {
17504
+ if (is_("eof")) {
17505
+ unexpected();
17506
+ }
17507
+ if (is_("punc", ")")) {
17508
+ next();
17509
+ break;
17510
+ }
17511
+ expr = expression();
17512
+ alias = null;
17513
+ if (is_("keyword", "as")) {
17514
+ next();
17515
+ alias = as_symbol(AST_SymbolAlias);
17516
+ }
17517
+ clauses.push(new AST_WithClause((function(){
17518
+ var ρσ_d = Object.create(null);
17519
+ ρσ_d["expression"] = expr;
17520
+ ρσ_d["alias"] = alias;
17521
+ return ρσ_d;
17522
+ }).call(this)));
17523
+ if (is_("punc", ",")) {
17524
+ next();
17525
+ continue;
17526
+ }
17527
+ if (!is_("punc", ")")) {
17528
+ unexpected();
17529
+ }
17268
17530
  next();
17269
- continue;
17531
+ break;
17270
17532
  }
17271
- if (!is_("punc", ":")) {
17272
- unexpected();
17533
+ } else {
17534
+ while (true) {
17535
+ if (is_("eof")) {
17536
+ unexpected();
17537
+ }
17538
+ expr = expression();
17539
+ alias = null;
17540
+ if (is_("keyword", "as")) {
17541
+ next();
17542
+ alias = as_symbol(AST_SymbolAlias);
17543
+ }
17544
+ clauses.push(new AST_WithClause((function(){
17545
+ var ρσ_d = Object.create(null);
17546
+ ρσ_d["expression"] = expr;
17547
+ ρσ_d["alias"] = alias;
17548
+ return ρσ_d;
17549
+ }).call(this)));
17550
+ if (is_("punc", ",")) {
17551
+ next();
17552
+ continue;
17553
+ }
17554
+ if (!is_("punc", ":")) {
17555
+ unexpected();
17556
+ }
17557
+ break;
17273
17558
  }
17274
- break;
17275
17559
  }
17276
17560
  if (!clauses.length) {
17277
17561
  token_error(start, "with statement must have at least one clause");
@@ -18295,6 +18579,10 @@ return this.__repr__();
18295
18579
  argnames.push(aname);
18296
18580
  if (is_("punc", ",")) {
18297
18581
  next();
18582
+ if (bracketed && is_("punc", ")")) {
18583
+ next();
18584
+ break;
18585
+ }
18298
18586
  } else {
18299
18587
  if (bracketed) {
18300
18588
  if (is_("punc", ")")) {
@@ -18874,6 +19162,7 @@ return this.__repr__();
18874
19162
  return ρσ_d;
18875
19163
  }).call(this));
18876
19164
  definition.return_annotation = return_annotation;
19165
+ definition.type_enforce = S.scoped_flags.get("type_enforcement", false);
18877
19166
  definition.is_generator = is_generator[0];
18878
19167
  definition.is_async = is_async;
18879
19168
  if (is_node_type(definition, AST_Method)) {
@@ -21007,6 +21296,7 @@ return this.__repr__();
21007
21296
  ρσ_d["end"] = right.end;
21008
21297
  ρσ_d["overloaded"] = S.scoped_flags.get("overload_operators", false);
21009
21298
  ρσ_d["strict_arith"] = S.scoped_flags.get("overload_operators", false) && S.scoped_flags.get("strict_arithmetic", true);
21299
+ ρσ_d["python_mod"] = op === "%" && S.scoped_flags.get("python_modulo", true);
21010
21300
  ρσ_d["python_truthiness"] = S.scoped_flags.get("truthiness", false) && (op === "&&" || op === "||");
21011
21301
  return ρσ_d;
21012
21302
  }).call(this));
@@ -21137,6 +21427,9 @@ return this.__repr__();
21137
21427
  asgn.overloaded = true;
21138
21428
  asgn.strict_arith = S.scoped_flags.get("strict_arithmetic", true);
21139
21429
  }
21430
+ if (val === "%=") {
21431
+ asgn.python_mod = S.scoped_flags.get("python_modulo", true);
21432
+ }
21140
21433
  return asgn;
21141
21434
  }
21142
21435
  return left;
@@ -21622,7 +21915,6 @@ return this.__repr__();
21622
21915
  ρσ_d["module_cache_dir"] = "";
21623
21916
  ρσ_d["js_version"] = 5;
21624
21917
  ρσ_d["write_name"] = true;
21625
- ρσ_d["omit_function_metadata"] = false;
21626
21918
  ρσ_d["pythonize_strings"] = false;
21627
21919
  ρσ_d["repl_mode"] = false;
21628
21920
  return ρσ_d;
@@ -23517,7 +23809,7 @@ return this.__repr__();
23517
23809
  var itervar, flat, stmt;
23518
23810
  if (!((self.simple_for_index || is_simple_for_in(self)))) {
23519
23811
  output.indent();
23520
- if (output.options.js_version === 5) {
23812
+ if (output.options.js_version === 5 && !self.is_async) {
23521
23813
  itervar = ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("ρσ_Iter", output.index_counter), "[ρσ_Index"), output.index_counter), "]");
23522
23814
  } else {
23523
23815
  itervar = ρσ_list_add("ρσ_Index", output.index_counter);
@@ -23675,7 +23967,14 @@ return this.__repr__();
23675
23967
  return ρσ_anonfunc;
23676
23968
  })());
23677
23969
  } else {
23678
- if (output.options.js_version === 5) {
23970
+ if (self.is_async) {
23971
+ itervar = ρσ_list_add("ρσ_Iter", output.index_counter);
23972
+ output.assign(ρσ_list_add("var ", itervar));
23973
+ write_object();
23974
+ output.end_statement();
23975
+ output.indent();
23976
+ output.spaced("for", "await", "(var", ρσ_list_add("ρσ_Index", output.index_counter), "of", ρσ_list_add(itervar, ")"));
23977
+ } else if (output.options.js_version === 5) {
23679
23978
  output.assign(ρσ_list_add("var ρσ_Iter", output.index_counter));
23680
23979
  output.print("ρσ_Iterable");
23681
23980
  output.with_parens(write_object);
@@ -24031,7 +24330,7 @@ return this.__repr__();
24031
24330
  output.space();
24032
24331
  output.with_block((function() {
24033
24332
  var ρσ_anonfunc = function () {
24034
- var body_out, previous_indentation, clause;
24333
+ var body_out, previous_indentation, needs_unpack, clause;
24035
24334
  body_out = output;
24036
24335
  if (is_generator) {
24037
24336
  body_out.indent();
@@ -24061,18 +24360,33 @@ return this.__repr__();
24061
24360
  body_out.assign("ρσ_Result");
24062
24361
  body_out.print(result_obj);
24063
24362
  }
24363
+ needs_unpack = is_node_type(self.init, AST_Array);
24364
+ if (!needs_unpack) {
24365
+ var ρσ_Iter129 = ρσ_Iterable(clauses);
24366
+ for (var ρσ_Index129 = 0; ρσ_Index129 < ρσ_Iter129.length; ρσ_Index129++) {
24367
+ clause = ρσ_Iter129[ρσ_Index129];
24368
+ if (is_node_type(clause.init, AST_Array)) {
24369
+ needs_unpack = true;
24370
+ break;
24371
+ }
24372
+ }
24373
+ }
24374
+ if (needs_unpack) {
24375
+ body_out.comma();
24376
+ body_out.print("ρσ_unpack");
24377
+ }
24064
24378
  function decl_loop_vars(init_node) {
24065
24379
  var i;
24066
24380
  if (is_node_type(init_node, AST_Array)) {
24067
- var ρσ_Iter129 = ρσ_Iterable(init_node.elements);
24068
- for (var ρσ_Index129 = 0; ρσ_Index129 < ρσ_Iter129.length; ρσ_Index129++) {
24069
- i = ρσ_Iter129[ρσ_Index129];
24381
+ var ρσ_Iter130 = ρσ_Iterable(init_node.elements);
24382
+ for (var ρσ_Index130 = 0; ρσ_Index130 < ρσ_Iter130.length; ρσ_Index130++) {
24383
+ i = ρσ_Iter130[ρσ_Index130];
24070
24384
  decl_loop_vars(i);
24071
24385
  }
24072
24386
  } else if (is_node_type(init_node, AST_Seq)) {
24073
- var ρσ_Iter130 = ρσ_Iterable(init_node.to_array());
24074
- for (var ρσ_Index130 = 0; ρσ_Index130 < ρσ_Iter130.length; ρσ_Index130++) {
24075
- i = ρσ_Iter130[ρσ_Index130];
24387
+ var ρσ_Iter131 = ρσ_Iterable(init_node.to_array());
24388
+ for (var ρσ_Index131 = 0; ρσ_Index131 < ρσ_Iter131.length; ρσ_Index131++) {
24389
+ i = ρσ_Iter131[ρσ_Index131];
24076
24390
  decl_loop_vars(i);
24077
24391
  }
24078
24392
  } else {
@@ -24086,9 +24400,9 @@ return this.__repr__();
24086
24400
  });
24087
24401
 
24088
24402
  decl_loop_vars(self.init);
24089
- var ρσ_Iter131 = ρσ_Iterable(clauses);
24090
- for (var ρσ_Index131 = 0; ρσ_Index131 < ρσ_Iter131.length; ρσ_Index131++) {
24091
- clause = ρσ_Iter131[ρσ_Index131];
24403
+ var ρσ_Iter132 = ρσ_Iterable(clauses);
24404
+ for (var ρσ_Index132 = 0; ρσ_Index132 < ρσ_Iter132.length; ρσ_Index132++) {
24405
+ clause = ρσ_Iter132[ρσ_Index132];
24092
24406
  decl_loop_vars(clause.init);
24093
24407
  }
24094
24408
  body_out.end_statement();
@@ -24207,9 +24521,9 @@ return this.__repr__();
24207
24521
  if (is_node_type(prop, AST_Array) && prop.is_subscript_tuple) {
24208
24522
  expr.print(output);
24209
24523
  output.print("[[");
24210
- var ρσ_Iter132 = ρσ_Iterable(enumerate(prop.elements));
24211
- for (var ρσ_Index132 = 0; ρσ_Index132 < ρσ_Iter132.length; ρσ_Index132++) {
24212
- ρσ_unpack = ρσ_Iter132[ρσ_Index132];
24524
+ var ρσ_Iter133 = ρσ_Iterable(enumerate(prop.elements));
24525
+ for (var ρσ_Index133 = 0; ρσ_Index133 < ρσ_Iter133.length; ρσ_Index133++) {
24526
+ ρσ_unpack = ρσ_Iter133[ρσ_Index133];
24213
24527
  i = ρσ_unpack[0];
24214
24528
  elem = ρσ_unpack[1];
24215
24529
  if (i) {
@@ -24601,6 +24915,14 @@ return this.__repr__();
24601
24915
  output.print(")");
24602
24916
  return;
24603
24917
  }
24918
+ if (self.operator === "%" && self.python_mod) {
24919
+ output.print("ρσ_op_mod_ns(");
24920
+ self.left.print(output);
24921
+ output.comma();
24922
+ self.right.print(output);
24923
+ output.print(")");
24924
+ return;
24925
+ }
24604
24926
  if (function_ops[ρσ_bound_index(self.operator, function_ops)]) {
24605
24927
  output.print(function_ops[ρσ_bound_index(self.operator, function_ops)]);
24606
24928
  output.with_parens((function() {
@@ -24763,9 +25085,9 @@ return this.__repr__();
24763
25085
  flat = left.flatten();
24764
25086
  flattened = flat.length > left.elements.length;
24765
25087
  has_starred = false;
24766
- var ρσ_Iter133 = ρσ_Iterable(flat);
24767
- for (var ρσ_Index133 = 0; ρσ_Index133 < ρσ_Iter133.length; ρσ_Index133++) {
24768
- elem = ρσ_Iter133[ρσ_Index133];
25088
+ var ρσ_Iter134 = ρσ_Iterable(flat);
25089
+ for (var ρσ_Index134 = 0; ρσ_Index134 < ρσ_Iter134.length; ρσ_Index134++) {
25090
+ elem = ρσ_Iter134[ρσ_Index134];
24769
25091
  if (is_node_type(elem, AST_Starred)) {
24770
25092
  has_starred = true;
24771
25093
  break;
@@ -24842,6 +25164,15 @@ return this.__repr__();
24842
25164
  })());
24843
25165
  return;
24844
25166
  }
25167
+ if (self.operator === "%=" && self.python_mod) {
25168
+ output.assign(self.left);
25169
+ output.print("ρσ_op_mod_ns(");
25170
+ self.left.print(output);
25171
+ output.comma();
25172
+ self.right.print(output);
25173
+ output.print(")");
25174
+ return;
25175
+ }
24845
25176
  if (self.operator === "**=") {
24846
25177
  output.assign(self.left);
24847
25178
  if (output.options.js_version > 6) {
@@ -24868,9 +25199,9 @@ return this.__repr__();
24868
25199
  left_hand_sides = ρσ_unpack[0];
24869
25200
  rhs = ρσ_unpack[1];
24870
25201
  is_compound_assign = false;
24871
- var ρσ_Iter134 = ρσ_Iterable(left_hand_sides);
24872
- for (var ρσ_Index134 = 0; ρσ_Index134 < ρσ_Iter134.length; ρσ_Index134++) {
24873
- lhs = ρσ_Iter134[ρσ_Index134];
25202
+ var ρσ_Iter135 = ρσ_Iterable(left_hand_sides);
25203
+ for (var ρσ_Index135 = 0; ρσ_Index135 < ρσ_Iter135.length; ρσ_Index135++) {
25204
+ lhs = ρσ_Iter135[ρσ_Index135];
24874
25205
  if (is_node_type(lhs, AST_Seq) || is_node_type(lhs, AST_Array) || is_node_type(lhs, AST_ItemAccess)) {
24875
25206
  is_compound_assign = true;
24876
25207
  break;
@@ -24889,9 +25220,9 @@ return this.__repr__();
24889
25220
  ρσ_d["right"] = rhs;
24890
25221
  return ρσ_d;
24891
25222
  }).call(this)), output);
24892
- var ρσ_Iter135 = ρσ_Iterable(left_hand_sides);
24893
- for (var ρσ_Index135 = 0; ρσ_Index135 < ρσ_Iter135.length; ρσ_Index135++) {
24894
- lhs = ρσ_Iter135[ρσ_Index135];
25223
+ var ρσ_Iter136 = ρσ_Iterable(left_hand_sides);
25224
+ for (var ρσ_Index136 = 0; ρσ_Index136 < ρσ_Iter136.length; ρσ_Index136++) {
25225
+ lhs = ρσ_Iter136[ρσ_Index136];
24895
25226
  [output.end_statement(), output.indent()];
24896
25227
  print_assignment(new AST_Assign((function(){
24897
25228
  var ρσ_d = Object.create(null);
@@ -24902,9 +25233,9 @@ return this.__repr__();
24902
25233
  }).call(this)), output);
24903
25234
  }
24904
25235
  } else {
24905
- var ρσ_Iter136 = ρσ_Iterable(left_hand_sides);
24906
- for (var ρσ_Index136 = 0; ρσ_Index136 < ρσ_Iter136.length; ρσ_Index136++) {
24907
- lhs = ρσ_Iter136[ρσ_Index136];
25236
+ var ρσ_Iter137 = ρσ_Iterable(left_hand_sides);
25237
+ for (var ρσ_Index137 = 0; ρσ_Index137 < ρσ_Iter137.length; ρσ_Index137++) {
25238
+ lhs = ρσ_Iter137[ρσ_Index137];
24908
25239
  output.spaced(lhs, "=", "");
24909
25240
  }
24910
25241
  rhs.print(output);
@@ -25092,9 +25423,9 @@ return this.__repr__();
25092
25423
  var ρσ_anonfunc = function () {
25093
25424
  var ρσ_unpack, i, arg;
25094
25425
  if (argnames && argnames.length && (argnames.is_simple_func === true || argnames.is_simple_func === undefined)) {
25095
- var ρσ_Iter137 = ρσ_Iterable(enumerate((strip_first) ? argnames.slice(1) : argnames));
25096
- for (var ρσ_Index137 = 0; ρσ_Index137 < ρσ_Iter137.length; ρσ_Index137++) {
25097
- ρσ_unpack = ρσ_Iter137[ρσ_Index137];
25426
+ var ρσ_Iter138 = ρσ_Iterable(enumerate((strip_first) ? argnames.slice(1) : argnames));
25427
+ for (var ρσ_Index138 = 0; ρσ_Index138 < ρσ_Iter138.length; ρσ_Index138++) {
25428
+ ρσ_unpack = ρσ_Iter138[ρσ_Index138];
25098
25429
  i = ρσ_unpack[0];
25099
25430
  arg = ρσ_unpack[1];
25100
25431
  if (i) {
@@ -25117,17 +25448,84 @@ return this.__repr__();
25117
25448
  });
25118
25449
 
25119
25450
  function function_preamble(node, output, offset) {
25120
- var a, fname, kw, positional_count, i, ρσ_unpack, c, arg, is_posonly, is_kwonly, dname, aname, nargs;
25451
+ var a, type_enforce, fname, kw, max_pos, ρσ_unpack, c, arg, max_msg, miss_msg, annot_name, type_msg, positional_count, i, posonly_count, parg, posonly_msg, pi, is_posonly, is_kwonly, dname, aname, posonly_names, nargs, miss_kw;
25121
25452
  a = node.argnames;
25122
- if (a === null || a === undefined || a.is_simple_func) {
25453
+ if (a === null || a === undefined) {
25454
+ return;
25455
+ }
25456
+ type_enforce = node.type_enforce;
25457
+ if (a.is_simple_func && !type_enforce) {
25123
25458
  return;
25124
25459
  }
25125
25460
  fname = (node.name) ? node.name.name : anonfunc;
25126
25461
  kw = "arguments[arguments.length-1]";
25462
+ if (type_enforce) {
25463
+ max_pos = 0;
25464
+ var ρσ_Iter139 = ρσ_Iterable(enumerate(a));
25465
+ for (var ρσ_Index139 = 0; ρσ_Index139 < ρσ_Iter139.length; ρσ_Index139++) {
25466
+ ρσ_unpack = ρσ_Iter139[ρσ_Index139];
25467
+ c = ρσ_unpack[0];
25468
+ arg = ρσ_unpack[1];
25469
+ if (c >= offset && !arg.kwonly) {
25470
+ max_pos = ρσ_list_iadd(max_pos, 1);
25471
+ }
25472
+ }
25473
+ if (a.is_simple_func) {
25474
+ if (!a.starargs) {
25475
+ output.indent();
25476
+ output.spaced("var", "ρσ_nargs", "=", "arguments.length");
25477
+ output.end_statement();
25478
+ output.indent();
25479
+ output.print("if (ρσ_nargs > 0 && arguments[ρσ_nargs-1] !== null && typeof arguments[ρσ_nargs-1] === \"object\" && arguments[ρσ_nargs-1][ρσ_kwargs_symbol] === true) ρσ_nargs--");
25480
+ output.end_statement();
25481
+ max_msg = ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() takes "), max_pos), " positional argument"), (((max_pos === 1 || typeof max_pos === "object" && ρσ_equals(max_pos, 1))) ? "" : "s")), " but ");
25482
+ output.indent();
25483
+ output.print(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("if (ρσ_nargs > ", max_pos), ") throw new TypeError("), JSON.stringify(max_msg)), " + ρσ_nargs + \" were given\")"));
25484
+ output.end_statement();
25485
+ }
25486
+ var ρσ_Iter140 = ρσ_Iterable(enumerate(a));
25487
+ for (var ρσ_Index140 = 0; ρσ_Index140 < ρσ_Iter140.length; ρσ_Index140++) {
25488
+ ρσ_unpack = ρσ_Iter140[ρσ_Index140];
25489
+ c = ρσ_unpack[0];
25490
+ arg = ρσ_unpack[1];
25491
+ if (c < offset) {
25492
+ continue;
25493
+ }
25494
+ if (!arg.kwonly) {
25495
+ miss_msg = ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() missing required positional argument: '"), arg.name), "'");
25496
+ output.indent();
25497
+ output.print(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("if (", arg.name), " === undefined) throw new TypeError("), JSON.stringify(miss_msg)), ")"));
25498
+ output.end_statement();
25499
+ }
25500
+ if (arg.annotation) {
25501
+ annot_name = arg.annotation.name || "";
25502
+ type_msg = ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() argument '"), arg.name), "' must be "), annot_name);
25503
+ output.indent();
25504
+ output.print(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("if (", arg.name), " !== undefined && !ρσ_instanceof("), arg.name), ", "));
25505
+ arg.annotation.print(output);
25506
+ output.print(ρσ_list_add(ρσ_list_add(")) throw new TypeError(", JSON.stringify(type_msg)), ")"));
25507
+ output.end_statement();
25508
+ }
25509
+ }
25510
+ return;
25511
+ }
25512
+ if (!a.starargs) {
25513
+ output.indent();
25514
+ output.spaced("var", "ρσ_nargs", "=", "arguments.length");
25515
+ output.end_statement();
25516
+ output.indent();
25517
+ output.print("if (ρσ_nargs > 0 && arguments[ρσ_nargs-1] !== null && typeof arguments[ρσ_nargs-1] === \"object\" && arguments[ρσ_nargs-1][ρσ_kwargs_symbol] === true) ρσ_nargs--");
25518
+ output.end_statement();
25519
+ max_msg = ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() takes "), max_pos), " positional argument"), (((max_pos === 1 || typeof max_pos === "object" && ρσ_equals(max_pos, 1))) ? "" : "s")), " but ");
25520
+ output.indent();
25521
+ output.print(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("if (ρσ_nargs > ", max_pos), ") throw new TypeError("), JSON.stringify(max_msg)), " + ρσ_nargs + \" were given\")"));
25522
+ output.end_statement();
25523
+ }
25524
+ }
25127
25525
  positional_count = 0;
25128
- var ρσ_Iter138 = ρσ_Iterable(enumerate(a));
25129
- for (var ρσ_Index138 = 0; ρσ_Index138 < ρσ_Iter138.length; ρσ_Index138++) {
25130
- ρσ_unpack = ρσ_Iter138[ρσ_Index138];
25526
+ var ρσ_Iter141 = ρσ_Iterable(enumerate(a));
25527
+ for (var ρσ_Index141 = 0; ρσ_Index141 < ρσ_Iter141.length; ρσ_Index141++) {
25528
+ ρσ_unpack = ρσ_Iter141[ρσ_Index141];
25131
25529
  c = ρσ_unpack[0];
25132
25530
  arg = ρσ_unpack[1];
25133
25531
  i = c - offset;
@@ -25165,10 +25563,35 @@ return this.__repr__();
25165
25563
  output.indent();
25166
25564
  output.spaced("if", ρσ_list_add("(", kw), "===", "null", "||", "typeof", kw, "!==", "\"object\"", "||", kw, "[ρσ_kwargs_symbol]", "!==", "true)", kw, "=", "{}");
25167
25565
  output.end_statement();
25566
+ if (type_enforce) {
25567
+ posonly_count = a.posonly_count || 0;
25568
+ for (var ρσ_Index142 = 0; ρσ_Index142 < posonly_count; ρσ_Index142++) {
25569
+ pi = ρσ_Index142;
25570
+ if (pi < offset) {
25571
+ continue;
25572
+ }
25573
+ parg = a[(typeof pi === "number" && pi < 0) ? a.length + pi : pi];
25574
+ posonly_msg = ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() got some positional-only arguments passed as keyword arguments: '"), parg.name), "'");
25575
+ output.indent();
25576
+ output.spaced("if", ρσ_list_add(ρσ_list_add("(Object.prototype.hasOwnProperty.call(", kw), ","), ρσ_list_add(ρσ_list_add("\"", parg.name), "\"))"));
25577
+ output.with_block((function() {
25578
+ var ρσ_anonfunc = function () {
25579
+ output.indent();
25580
+ output.print(ρσ_list_add(ρσ_list_add("throw new TypeError(", JSON.stringify(posonly_msg)), ")"));
25581
+ output.end_statement();
25582
+ };
25583
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
25584
+ __module__ : {value: "output.functions"}
25585
+ });
25586
+ return ρσ_anonfunc;
25587
+ })());
25588
+ output.newline();
25589
+ }
25590
+ }
25168
25591
  if (a.has_defaults) {
25169
- var ρσ_Iter139 = ρσ_Iterable(Object.keys(a.defaults));
25170
- for (var ρσ_Index139 = 0; ρσ_Index139 < ρσ_Iter139.length; ρσ_Index139++) {
25171
- dname = ρσ_Iter139[ρσ_Index139];
25592
+ var ρσ_Iter143 = ρσ_Iterable(Object.keys(a.defaults));
25593
+ for (var ρσ_Index143 = 0; ρσ_Index143 < ρσ_Iter143.length; ρσ_Index143++) {
25594
+ dname = ρσ_Iter143[ρσ_Index143];
25172
25595
  is_posonly = false;
25173
25596
  for (var qi = 0; qi < (a.posonly_count || 0); qi++) {
25174
25597
  if (a[(typeof qi === "number" && qi < 0) ? a.length + qi : qi].name === dname) {
@@ -25211,9 +25634,9 @@ return this.__repr__();
25211
25634
  }
25212
25635
  }
25213
25636
  if (a.bare_star) {
25214
- var ρσ_Iter140 = ρσ_Iterable(a);
25215
- for (var ρσ_Index140 = 0; ρσ_Index140 < ρσ_Iter140.length; ρσ_Index140++) {
25216
- arg = ρσ_Iter140[ρσ_Index140];
25637
+ var ρσ_Iter144 = ρσ_Iterable(a);
25638
+ for (var ρσ_Index144 = 0; ρσ_Index144 < ρσ_Iter144.length; ρσ_Index144++) {
25639
+ arg = ρσ_Iter144[ρσ_Index144];
25217
25640
  if (!arg.kwonly) {
25218
25641
  continue;
25219
25642
  }
@@ -25239,6 +25662,40 @@ return this.__repr__();
25239
25662
  output.newline();
25240
25663
  }
25241
25664
  }
25665
+ } else if (type_enforce && (a.posonly_count || 0) > 0) {
25666
+ posonly_count = a.posonly_count || 0;
25667
+ posonly_names = ρσ_list_decorate([]);
25668
+ for (var ρσ_Index145 = 0; ρσ_Index145 < posonly_count; ρσ_Index145++) {
25669
+ pi = ρσ_Index145;
25670
+ if (pi >= offset) {
25671
+ posonly_names.push(a[(typeof pi === "number" && pi < 0) ? a.length + pi : pi].name);
25672
+ }
25673
+ }
25674
+ if (posonly_names.length > 0) {
25675
+ output.indent();
25676
+ output.spaced("var", "ρσ_kw_chk", "=", "arguments[arguments.length-1]");
25677
+ output.end_statement();
25678
+ output.indent();
25679
+ output.spaced("if", "(ρσ_kw_chk !== null && typeof ρσ_kw_chk === \"object\" && ρσ_kw_chk[ρσ_kwargs_symbol] === true)");
25680
+ output.with_block((function() {
25681
+ var ρσ_anonfunc = function () {
25682
+ var posonly_msg, pname;
25683
+ var ρσ_Iter146 = ρσ_Iterable(posonly_names);
25684
+ for (var ρσ_Index146 = 0; ρσ_Index146 < ρσ_Iter146.length; ρσ_Index146++) {
25685
+ pname = ρσ_Iter146[ρσ_Index146];
25686
+ posonly_msg = ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() got some positional-only arguments passed as keyword arguments: '"), pname), "'");
25687
+ output.indent();
25688
+ output.print(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("if (Object.prototype.hasOwnProperty.call(ρσ_kw_chk, \"", pname), "\")) throw new TypeError("), JSON.stringify(posonly_msg)), ")"));
25689
+ output.end_statement();
25690
+ }
25691
+ };
25692
+ if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
25693
+ __module__ : {value: "output.functions"}
25694
+ });
25695
+ return ρσ_anonfunc;
25696
+ })());
25697
+ output.newline();
25698
+ }
25242
25699
  }
25243
25700
  if (a.starargs !== undefined) {
25244
25701
  nargs = a.length - offset;
@@ -25255,6 +25712,60 @@ return this.__repr__();
25255
25712
  output.spaced(kw, "=", ρσ_list_add(ρσ_list_add("ρσ_kwargs_to_dict(", kw), ")"));
25256
25713
  output.end_statement();
25257
25714
  }
25715
+ if (type_enforce) {
25716
+ var ρσ_Iter147 = ρσ_Iterable(enumerate(a));
25717
+ for (var ρσ_Index147 = 0; ρσ_Index147 < ρσ_Iter147.length; ρσ_Index147++) {
25718
+ ρσ_unpack = ρσ_Iter147[ρσ_Index147];
25719
+ c = ρσ_unpack[0];
25720
+ arg = ρσ_unpack[1];
25721
+ if (c < offset) {
25722
+ continue;
25723
+ }
25724
+ if (arg.kwonly) {
25725
+ continue;
25726
+ }
25727
+ if (!Object.prototype.hasOwnProperty.call(a.defaults, arg.name)) {
25728
+ miss_msg = ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() missing required positional argument: '"), arg.name), "'");
25729
+ output.indent();
25730
+ output.print(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("if (", arg.name), " === undefined) throw new TypeError("), JSON.stringify(miss_msg)), ")"));
25731
+ output.end_statement();
25732
+ }
25733
+ }
25734
+ var ρσ_Iter148 = ρσ_Iterable(enumerate(a));
25735
+ for (var ρσ_Index148 = 0; ρσ_Index148 < ρσ_Iter148.length; ρσ_Index148++) {
25736
+ ρσ_unpack = ρσ_Iter148[ρσ_Index148];
25737
+ c = ρσ_unpack[0];
25738
+ arg = ρσ_unpack[1];
25739
+ if (!arg.kwonly) {
25740
+ continue;
25741
+ }
25742
+ if (!Object.prototype.hasOwnProperty.call(a.defaults, arg.name)) {
25743
+ miss_kw = ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() missing required keyword-only argument: '"), arg.name), "'");
25744
+ output.indent();
25745
+ output.print(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("if (", arg.name), " === undefined) throw new TypeError("), JSON.stringify(miss_kw)), ")"));
25746
+ output.end_statement();
25747
+ }
25748
+ }
25749
+ var ρσ_Iter149 = ρσ_Iterable(enumerate(a));
25750
+ for (var ρσ_Index149 = 0; ρσ_Index149 < ρσ_Iter149.length; ρσ_Index149++) {
25751
+ ρσ_unpack = ρσ_Iter149[ρσ_Index149];
25752
+ c = ρσ_unpack[0];
25753
+ arg = ρσ_unpack[1];
25754
+ if (c < offset) {
25755
+ continue;
25756
+ }
25757
+ if (!arg.annotation) {
25758
+ continue;
25759
+ }
25760
+ annot_name = arg.annotation.name || "";
25761
+ type_msg = ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add(fname, "() argument '"), arg.name), "' must be "), annot_name);
25762
+ output.indent();
25763
+ output.print(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("if (", arg.name), " !== undefined && !ρσ_instanceof("), arg.name), ", "));
25764
+ arg.annotation.print(output);
25765
+ output.print(ρσ_list_add(ρσ_list_add(")) throw new TypeError(", JSON.stringify(type_msg)), ")"));
25766
+ output.end_statement();
25767
+ }
25768
+ }
25258
25769
  };
25259
25770
  if (!function_preamble.__argnames__) Object.defineProperties(function_preamble, {
25260
25771
  __argnames__ : {value: ["node", "output", "offset"]},
@@ -25266,9 +25777,9 @@ return this.__repr__();
25266
25777
  if (self.return_annotation) {
25267
25778
  return true;
25268
25779
  }
25269
- var ρσ_Iter141 = ρσ_Iterable(self.argnames);
25270
- for (var ρσ_Index141 = 0; ρσ_Index141 < ρσ_Iter141.length; ρσ_Index141++) {
25271
- arg = ρσ_Iter141[ρσ_Index141];
25780
+ var ρσ_Iter150 = ρσ_Iterable(self.argnames);
25781
+ for (var ρσ_Index150 = 0; ρσ_Index150 < ρσ_Iter150.length; ρσ_Index150++) {
25782
+ arg = ρσ_Iter150[ρσ_Index150];
25272
25783
  if (arg.annotation) {
25273
25784
  return true;
25274
25785
  }
@@ -25282,9 +25793,6 @@ return this.__repr__();
25282
25793
 
25283
25794
  function function_annotation(self, output, strip_first, name) {
25284
25795
  var fname, props, defaults, dkeys, argnames_entries, ρσ_unpack, i, arg, names;
25285
- if (output.options.omit_function_metadata) {
25286
- return;
25287
- }
25288
25796
  fname = name || ((self.name) ? self.name.name : anonfunc);
25289
25797
  props = Object.create(null);
25290
25798
  if (has_annotations(self)) {
@@ -25293,9 +25801,9 @@ return this.__repr__();
25293
25801
  var ρσ_unpack, i, arg;
25294
25802
  output.print("{");
25295
25803
  if (self.argnames && self.argnames.length) {
25296
- var ρσ_Iter142 = ρσ_Iterable(enumerate(self.argnames));
25297
- for (var ρσ_Index142 = 0; ρσ_Index142 < ρσ_Iter142.length; ρσ_Index142++) {
25298
- ρσ_unpack = ρσ_Iter142[ρσ_Index142];
25804
+ var ρσ_Iter151 = ρσ_Iterable(enumerate(self.argnames));
25805
+ for (var ρσ_Index151 = 0; ρσ_Index151 < ρσ_Iter151.length; ρσ_Index151++) {
25806
+ ρσ_unpack = ρσ_Iter151[ρσ_Index151];
25299
25807
  i = ρσ_unpack[0];
25300
25808
  arg = ρσ_unpack[1];
25301
25809
  if (arg.annotation) {
@@ -25327,9 +25835,9 @@ return this.__repr__();
25327
25835
  var ρσ_anonfunc = function () {
25328
25836
  var ρσ_unpack, i, k;
25329
25837
  output.print("{");
25330
- var ρσ_Iter143 = ρσ_Iterable(enumerate(dkeys));
25331
- for (var ρσ_Index143 = 0; ρσ_Index143 < ρσ_Iter143.length; ρσ_Index143++) {
25332
- ρσ_unpack = ρσ_Iter143[ρσ_Index143];
25838
+ var ρσ_Iter152 = ρσ_Iterable(enumerate(dkeys));
25839
+ for (var ρσ_Index152 = 0; ρσ_Index152 < ρσ_Iter152.length; ρσ_Index152++) {
25840
+ ρσ_unpack = ρσ_Iter152[ρσ_Index152];
25333
25841
  i = ρσ_unpack[0];
25334
25842
  k = ρσ_unpack[1];
25335
25843
  [output.print(ρσ_list_add(k, ":")), defaults[(typeof k === "number" && k < 0) ? defaults.length + k : k].print(output)];
@@ -25357,9 +25865,9 @@ return this.__repr__();
25357
25865
  })();
25358
25866
  }
25359
25867
  argnames_entries = [];
25360
- var ρσ_Iter144 = ρσ_Iterable(enumerate(self.argnames));
25361
- for (var ρσ_Index144 = 0; ρσ_Index144 < ρσ_Iter144.length; ρσ_Index144++) {
25362
- ρσ_unpack = ρσ_Iter144[ρσ_Index144];
25868
+ var ρσ_Iter153 = ρσ_Iterable(enumerate(self.argnames));
25869
+ for (var ρσ_Index153 = 0; ρσ_Index153 < ρσ_Iter153.length; ρσ_Index153++) {
25870
+ ρσ_unpack = ρσ_Iter153[ρσ_Index153];
25363
25871
  i = ρσ_unpack[0];
25364
25872
  arg = ρσ_unpack[1];
25365
25873
  if (strip_first && i === 0) {
@@ -25380,9 +25888,9 @@ return this.__repr__();
25380
25888
  var ρσ_anonfunc = function () {
25381
25889
  var ρσ_unpack, ei, entry;
25382
25890
  output.print("[");
25383
- var ρσ_Iter145 = ρσ_Iterable(enumerate(argnames_entries));
25384
- for (var ρσ_Index145 = 0; ρσ_Index145 < ρσ_Iter145.length; ρσ_Index145++) {
25385
- ρσ_unpack = ρσ_Iter145[ρσ_Index145];
25891
+ var ρσ_Iter154 = ρσ_Iterable(enumerate(argnames_entries));
25892
+ for (var ρσ_Index154 = 0; ρσ_Index154 < ρσ_Iter154.length; ρσ_Index154++) {
25893
+ ρσ_unpack = ρσ_Iter154[ρσ_Index154];
25386
25894
  ei = ρσ_unpack[0];
25387
25895
  entry = ρσ_unpack[1];
25388
25896
  if (entry.posonly) {
@@ -25452,7 +25960,7 @@ return this.__repr__();
25452
25960
  });
25453
25961
 
25454
25962
  function function_definition(self, output, strip_first, as_expression) {
25455
- var orig_indent;
25963
+ var orig_indent, inner_decl;
25456
25964
  as_expression = as_expression || self.is_expression || self.is_anonymous;
25457
25965
  if (as_expression) {
25458
25966
  orig_indent = output.indentation();
@@ -25460,7 +25968,7 @@ return this.__repr__();
25460
25968
  [output.spaced("(function()", "{"), output.newline()];
25461
25969
  [output.indent(), output.spaced("var", anonfunc, "="), output.space()];
25462
25970
  }
25463
- if (self.is_async) {
25971
+ if (self.is_async && !self.is_generator) {
25464
25972
  [output.print("async"), output.space()];
25465
25973
  }
25466
25974
  [output.print("function"), output.space()];
@@ -25468,11 +25976,12 @@ return this.__repr__();
25468
25976
  self.name.print(output);
25469
25977
  }
25470
25978
  if (self.is_generator) {
25979
+ inner_decl = (self.is_async) ? "async function* js_generator" : "function* js_generator";
25471
25980
  [output.print("()"), output.space()];
25472
25981
  output.with_block((function() {
25473
25982
  var ρσ_anonfunc = function () {
25474
25983
  output.indent();
25475
- output.print("function* js_generator");
25984
+ output.print(inner_decl);
25476
25985
  function_args(self.argnames, output, strip_first);
25477
25986
  print_bracketed(self, output, true, function_preamble);
25478
25987
  output.newline();
@@ -25482,6 +25991,11 @@ return this.__repr__();
25482
25991
  output.indent();
25483
25992
  output.spaced("result.send", "=", "result.next");
25484
25993
  output.end_statement();
25994
+ if (self.is_async) {
25995
+ output.indent();
25996
+ output.spaced("result.asend", "=", "result.next");
25997
+ output.end_statement();
25998
+ }
25485
25999
  output.indent();
25486
26000
  output.spaced("return", "result");
25487
26001
  output.end_statement();
@@ -25607,9 +26121,9 @@ return this.__repr__();
25607
26121
  var ρσ_unpack, i, kwname, pair;
25608
26122
  output.print("ρσ_desugar_kwargs(");
25609
26123
  if (has_kwarg_items) {
25610
- var ρσ_Iter146 = ρσ_Iterable(enumerate(self.args.kwarg_items));
25611
- for (var ρσ_Index146 = 0; ρσ_Index146 < ρσ_Iter146.length; ρσ_Index146++) {
25612
- ρσ_unpack = ρσ_Iter146[ρσ_Index146];
26124
+ var ρσ_Iter155 = ρσ_Iterable(enumerate(self.args.kwarg_items));
26125
+ for (var ρσ_Index155 = 0; ρσ_Index155 < ρσ_Iter155.length; ρσ_Index155++) {
26126
+ ρσ_unpack = ρσ_Iter155[ρσ_Index155];
25613
26127
  i = ρσ_unpack[0];
25614
26128
  kwname = ρσ_unpack[1];
25615
26129
  if (i > 0) {
@@ -25625,9 +26139,9 @@ return this.__repr__();
25625
26139
  }
25626
26140
  if (has_kwarg_formals) {
25627
26141
  output.print("{");
25628
- var ρσ_Iter147 = ρσ_Iterable(enumerate(self.args.kwargs));
25629
- for (var ρσ_Index147 = 0; ρσ_Index147 < ρσ_Iter147.length; ρσ_Index147++) {
25630
- ρσ_unpack = ρσ_Iter147[ρσ_Index147];
26142
+ var ρσ_Iter156 = ρσ_Iterable(enumerate(self.args.kwargs));
26143
+ for (var ρσ_Index156 = 0; ρσ_Index156 < ρσ_Iter156.length; ρσ_Index156++) {
26144
+ ρσ_unpack = ρσ_Iter156[ρσ_Index156];
25631
26145
  i = ρσ_unpack[0];
25632
26146
  pair = ρσ_unpack[1];
25633
26147
  if (i) {
@@ -25720,9 +26234,9 @@ return this.__repr__();
25720
26234
  output.with_parens((function() {
25721
26235
  var ρσ_anonfunc = function () {
25722
26236
  var ρσ_unpack, i, a;
25723
- var ρσ_Iter148 = ρσ_Iterable(enumerate(self.args));
25724
- for (var ρσ_Index148 = 0; ρσ_Index148 < ρσ_Iter148.length; ρσ_Index148++) {
25725
- ρσ_unpack = ρσ_Iter148[ρσ_Index148];
26237
+ var ρσ_Iter157 = ρσ_Iterable(enumerate(self.args));
26238
+ for (var ρσ_Index157 = 0; ρσ_Index157 < ρσ_Iter157.length; ρσ_Index157++) {
26239
+ ρσ_unpack = ρσ_Iter157[ρσ_Index157];
25726
26240
  i = ρσ_unpack[0];
25727
26241
  a = ρσ_unpack[1];
25728
26242
  if (i) {
@@ -25741,15 +26255,17 @@ return this.__repr__();
25741
26255
  output.with_parens((function() {
25742
26256
  var ρσ_anonfunc = function () {
25743
26257
  var ρσ_unpack, i, a;
25744
- var ρσ_Iter149 = ρσ_Iterable(enumerate(self.args));
25745
- for (var ρσ_Index149 = 0; ρσ_Index149 < ρσ_Iter149.length; ρσ_Index149++) {
25746
- ρσ_unpack = ρσ_Iter149[ρσ_Index149];
26258
+ var ρσ_Iter158 = ρσ_Iterable(enumerate(self.args));
26259
+ for (var ρσ_Index158 = 0; ρσ_Index158 < ρσ_Iter158.length; ρσ_Index158++) {
26260
+ ρσ_unpack = ρσ_Iter158[ρσ_Index158];
25747
26261
  i = ρσ_unpack[0];
25748
26262
  a = ρσ_unpack[1];
25749
26263
  if (i) {
25750
26264
  output.comma();
25751
26265
  }
26266
+ output.print("ρσ_str(");
25752
26267
  a.print(output);
26268
+ output.print(")");
25753
26269
  }
25754
26270
  };
25755
26271
  if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
@@ -25793,9 +26309,9 @@ return this.__repr__();
25793
26309
  compiled_js = inner_os.get().trim();
25794
26310
  function _print_extra_args() {
25795
26311
  var a;
25796
- var ρσ_Iter150 = ρσ_Iterable(self.args.slice(1));
25797
- for (var ρσ_Index150 = 0; ρσ_Index150 < ρσ_Iter150.length; ρσ_Index150++) {
25798
- a = ρσ_Iter150[ρσ_Index150];
26312
+ var ρσ_Iter159 = ρσ_Iterable(self.args.slice(1));
26313
+ for (var ρσ_Index159 = 0; ρσ_Index159 < ρσ_Iter159.length; ρσ_Index159++) {
26314
+ a = ρσ_Iter159[ρσ_Index159];
25799
26315
  output.comma();
25800
26316
  a.print(output);
25801
26317
  }
@@ -25845,9 +26361,9 @@ return this.__repr__();
25845
26361
  output.with_parens((function() {
25846
26362
  var ρσ_anonfunc = function () {
25847
26363
  var ρσ_unpack, i, a;
25848
- var ρσ_Iter151 = ρσ_Iterable(enumerate(self.args));
25849
- for (var ρσ_Index151 = 0; ρσ_Index151 < ρσ_Iter151.length; ρσ_Index151++) {
25850
- ρσ_unpack = ρσ_Iter151[ρσ_Index151];
26364
+ var ρσ_Iter160 = ρσ_Iterable(enumerate(self.args));
26365
+ for (var ρσ_Index160 = 0; ρσ_Index160 < ρσ_Iter160.length; ρσ_Index160++) {
26366
+ ρσ_unpack = ρσ_Iter160[ρσ_Index160];
25851
26367
  i = ρσ_unpack[0];
25852
26368
  a = ρσ_unpack[1];
25853
26369
  if (i) {
@@ -25864,9 +26380,9 @@ return this.__repr__();
25864
26380
  } else if (is_node_type(self.expression, AST_SymbolRef) && self.python_truthiness) {
25865
26381
  output.print("ρσ_callable_call(");
25866
26382
  print_function_name();
25867
- var ρσ_Iter152 = ρσ_Iterable(enumerate(self.args));
25868
- for (var ρσ_Index152 = 0; ρσ_Index152 < ρσ_Iter152.length; ρσ_Index152++) {
25869
- ρσ_unpack = ρσ_Iter152[ρσ_Index152];
26383
+ var ρσ_Iter161 = ρσ_Iterable(enumerate(self.args));
26384
+ for (var ρσ_Index161 = 0; ρσ_Index161 < ρσ_Iter161.length; ρσ_Index161++) {
26385
+ ρσ_unpack = ρσ_Iter161[ρσ_Index161];
25870
26386
  i = ρσ_unpack[0];
25871
26387
  a = ρσ_unpack[1];
25872
26388
  output.comma();
@@ -25881,9 +26397,9 @@ return this.__repr__();
25881
26397
  if (is_node_type(self.expression, AST_Dot) && self.expression.property === "split" && !self.args.length) {
25882
26398
  output.print("\" \"");
25883
26399
  } else {
25884
- var ρσ_Iter153 = ρσ_Iterable(enumerate(self.args));
25885
- for (var ρσ_Index153 = 0; ρσ_Index153 < ρσ_Iter153.length; ρσ_Index153++) {
25886
- ρσ_unpack = ρσ_Iter153[ρσ_Index153];
26400
+ var ρσ_Iter162 = ρσ_Iterable(enumerate(self.args));
26401
+ for (var ρσ_Index162 = 0; ρσ_Index162 < ρσ_Iter162.length; ρσ_Index162++) {
26402
+ ρσ_unpack = ρσ_Iter162[ρσ_Index162];
25887
26403
  i = ρσ_unpack[0];
25888
26404
  a = ρσ_unpack[1];
25889
26405
  if (i) {
@@ -26205,8 +26721,8 @@ return this.__repr__();
26205
26721
  self.name.print(output);
26206
26722
  output.spaced(".ρσ_decorators", "=", "[");
26207
26723
  num = decorators.length;
26208
- for (var ρσ_Index154 = 0; ρσ_Index154 < num; ρσ_Index154++) {
26209
- i = ρσ_Index154;
26724
+ for (var ρσ_Index163 = 0; ρσ_Index163 < num; ρσ_Index163++) {
26725
+ i = ρσ_Index163;
26210
26726
  decorators[(typeof i === "number" && i < 0) ? decorators.length + i : i].expression.print(output);
26211
26727
  output.spaced((i < num - 1) ? "," : "]");
26212
26728
  }
@@ -26245,9 +26761,9 @@ return this.__repr__();
26245
26761
  output.end_statement();
26246
26762
  }
26247
26763
  }
26248
- var ρσ_Iter155 = ρσ_Iterable(self.bound);
26249
- for (var ρσ_Index155 = 0; ρσ_Index155 < ρσ_Iter155.length; ρσ_Index155++) {
26250
- bname = ρσ_Iter155[ρσ_Index155];
26764
+ var ρσ_Iter164 = ρσ_Iterable(self.bound);
26765
+ for (var ρσ_Index164 = 0; ρσ_Index164 < ρσ_Iter164.length; ρσ_Index164++) {
26766
+ bname = ρσ_Iter164[ρσ_Index164];
26251
26767
  if (seen_methods[(typeof bname === "number" && bname < 0) ? seen_methods.length + bname : bname] || (ρσ_expr_temp = self.dynamic_properties)[(typeof bname === "number" && bname < 0) ? ρσ_expr_temp.length + bname : bname]) {
26252
26768
  continue;
26253
26769
  }
@@ -26279,9 +26795,9 @@ return this.__repr__();
26279
26795
  output.with_block((function() {
26280
26796
  var ρσ_anonfunc = function () {
26281
26797
  var prop, name;
26282
- var ρσ_Iter156 = ρσ_Iterable(property_names);
26283
- for (var ρσ_Index156 = 0; ρσ_Index156 < ρσ_Iter156.length; ρσ_Index156++) {
26284
- name = ρσ_Iter156[ρσ_Index156];
26798
+ var ρσ_Iter165 = ρσ_Iterable(property_names);
26799
+ for (var ρσ_Index165 = 0; ρσ_Index165 < ρσ_Iter165.length; ρσ_Index165++) {
26800
+ name = ρσ_Iter165[ρσ_Index165];
26285
26801
  prop = (ρσ_expr_temp = self.dynamic_properties)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name];
26286
26802
  [output.indent(), output.print(ρσ_list_add(JSON.stringify(name), ":")), output.space()];
26287
26803
  output.with_block((function() {
@@ -26350,9 +26866,9 @@ return this.__repr__();
26350
26866
  })());
26351
26867
  }
26352
26868
  defined_methods = Object.create(null);
26353
- var ρσ_Iter157 = ρσ_Iterable(self.body);
26354
- for (var ρσ_Index157 = 0; ρσ_Index157 < ρσ_Iter157.length; ρσ_Index157++) {
26355
- stmt = ρσ_Iter157[ρσ_Index157];
26869
+ var ρσ_Iter166 = ρσ_Iterable(self.body);
26870
+ for (var ρσ_Index166 = 0; ρσ_Index166 < ρσ_Iter166.length; ρσ_Index166++) {
26871
+ stmt = ρσ_Iter166[ρσ_Index166];
26356
26872
  if (is_node_type(stmt, AST_Method)) {
26357
26873
  if (stmt.is_getter || stmt.is_setter) {
26358
26874
  continue;
@@ -26361,9 +26877,9 @@ return this.__repr__();
26361
26877
  defined_methods[ρσ_bound_index(stmt.name.name, defined_methods)] = true;
26362
26878
  sname = stmt.name.name;
26363
26879
  if (sname === "__init__") {
26364
- var ρσ_Iter158 = ρσ_Iterable(ρσ_list_decorate([ ".__argnames__", ".__handles_kwarg_interpolation__" ]));
26365
- for (var ρσ_Index158 = 0; ρσ_Index158 < ρσ_Iter158.length; ρσ_Index158++) {
26366
- attr = ρσ_Iter158[ρσ_Index158];
26880
+ var ρσ_Iter167 = ρσ_Iterable(ρσ_list_decorate([ ".__argnames__", ".__handles_kwarg_interpolation__" ]));
26881
+ for (var ρσ_Index167 = 0; ρσ_Index167 < ρσ_Iter167.length; ρσ_Index167++) {
26882
+ attr = ρσ_Iter167[ρσ_Index167];
26367
26883
  [output.indent(), self.name.print(output), output.assign(attr)];
26368
26884
  [self.name.print(output), output.print(ρσ_list_add(".prototype.__init__", attr)),
26369
26885
  output.end_statement()];
@@ -26463,9 +26979,9 @@ return this.__repr__();
26463
26979
  self.name.print(output);
26464
26980
  output.print(".prototype, \"__class__\", {get: function() { return this.constructor; }, configurable: true})");
26465
26981
  output.end_statement();
26466
- var ρσ_Iter159 = ρσ_Iterable(self.statements);
26467
- for (var ρσ_Index159 = 0; ρσ_Index159 < ρσ_Iter159.length; ρσ_Index159++) {
26468
- stmt = ρσ_Iter159[ρσ_Index159];
26982
+ var ρσ_Iter168 = ρσ_Iterable(self.statements);
26983
+ for (var ρσ_Index168 = 0; ρσ_Index168 < ρσ_Iter168.length; ρσ_Index168++) {
26984
+ stmt = ρσ_Iter168[ρσ_Index168];
26469
26985
  if (is_node_type(stmt, AST_Class)) {
26470
26986
  output.indent();
26471
26987
  stmt.print(output);
@@ -26486,9 +27002,9 @@ return this.__repr__();
26486
27002
  }
26487
27003
  }
26488
27004
  annotated_field_names = ρσ_list_decorate([]);
26489
- var ρσ_Iter160 = ρσ_Iterable(self.statements);
26490
- for (var ρσ_Index160 = 0; ρσ_Index160 < ρσ_Iter160.length; ρσ_Index160++) {
26491
- stmt = ρσ_Iter160[ρσ_Index160];
27005
+ var ρσ_Iter169 = ρσ_Iterable(self.statements);
27006
+ for (var ρσ_Index169 = 0; ρσ_Index169 < ρσ_Iter169.length; ρσ_Index169++) {
27007
+ stmt = ρσ_Iter169[ρσ_Index169];
26492
27008
  if (is_node_type(stmt, AST_AnnotatedAssign) && is_node_type(stmt.target, AST_SymbolRef)) {
26493
27009
  annotated_field_names.push(stmt.target.name);
26494
27010
  }
@@ -26497,8 +27013,8 @@ return this.__repr__();
26497
27013
  output.indent();
26498
27014
  self.name.print(output);
26499
27015
  output.print(".__annotations__ = {");
26500
- for (var ρσ_Index161 = 0; ρσ_Index161 < annotated_field_names.length; ρσ_Index161++) {
26501
- i = ρσ_Index161;
27016
+ for (var ρσ_Index170 = 0; ρσ_Index170 < annotated_field_names.length; ρσ_Index170++) {
27017
+ i = ρσ_Index170;
26502
27018
  if (i > 0) {
26503
27019
  output.comma();
26504
27020
  }
@@ -26576,8 +27092,8 @@ return this.__repr__();
26576
27092
  if (decorators.length) {
26577
27093
  output.indent();
26578
27094
  output.assign(self.name);
26579
- for (var ρσ_Index162 = 0; ρσ_Index162 < decorators.length; ρσ_Index162++) {
26580
- di = ρσ_Index162;
27095
+ for (var ρσ_Index171 = 0; ρσ_Index171 < decorators.length; ρσ_Index171++) {
27096
+ di = ρσ_Index171;
26581
27097
  self.name.print(output);
26582
27098
  output.print(ρσ_list_add(ρσ_list_add(".ρσ_decorators[", ρσ_str.format("{}", di)), "]("));
26583
27099
  }
@@ -26621,9 +27137,9 @@ return this.__repr__();
26621
27137
  if (len_ > 0) {
26622
27138
  output.space();
26623
27139
  }
26624
- var ρσ_Iter163 = ρσ_Iterable(enumerate(a));
26625
- for (var ρσ_Index163 = 0; ρσ_Index163 < ρσ_Iter163.length; ρσ_Index163++) {
26626
- ρσ_unpack = ρσ_Iter163[ρσ_Index163];
27140
+ var ρσ_Iter172 = ρσ_Iterable(enumerate(a));
27141
+ for (var ρσ_Index172 = 0; ρσ_Index172 < ρσ_Iter172.length; ρσ_Index172++) {
27142
+ ρσ_unpack = ρσ_Iter172[ρσ_Index172];
26627
27143
  i = ρσ_unpack[0];
26628
27144
  exp = ρσ_unpack[1];
26629
27145
  if (i) {
@@ -26671,9 +27187,9 @@ return this.__repr__();
26671
27187
  output.spaced("var", "ρσ_d", "=", (self.is_jshash) ? "Object.create(null)" : "{}");
26672
27188
  }
26673
27189
  output.end_statement();
26674
- var ρσ_Iter164 = ρσ_Iterable(enumerate(self.properties));
26675
- for (var ρσ_Index164 = 0; ρσ_Index164 < ρσ_Iter164.length; ρσ_Index164++) {
26676
- ρσ_unpack = ρσ_Iter164[ρσ_Index164];
27190
+ var ρσ_Iter173 = ρσ_Iterable(enumerate(self.properties));
27191
+ for (var ρσ_Index173 = 0; ρσ_Index173 < ρσ_Iter173.length; ρσ_Index173++) {
27192
+ ρσ_unpack = ρσ_Iter173[ρσ_Index173];
26677
27193
  i = ρσ_unpack[0];
26678
27194
  prop = ρσ_unpack[1];
26679
27195
  output.indent();
@@ -26777,9 +27293,9 @@ return this.__repr__();
26777
27293
  function print_set(self, output) {
26778
27294
  var has_spread, item;
26779
27295
  has_spread = false;
26780
- var ρσ_Iter165 = ρσ_Iterable(self.items);
26781
- for (var ρσ_Index165 = 0; ρσ_Index165 < ρσ_Iter165.length; ρσ_Index165++) {
26782
- item = ρσ_Iter165[ρσ_Index165];
27296
+ var ρσ_Iter174 = ρσ_Iterable(self.items);
27297
+ for (var ρσ_Index174 = 0; ρσ_Index174 < ρσ_Iter174.length; ρσ_Index174++) {
27298
+ item = ρσ_Iter174[ρσ_Index174];
26783
27299
  if (is_node_type(item, AST_Spread)) {
26784
27300
  has_spread = true;
26785
27301
  break;
@@ -26792,9 +27308,9 @@ return this.__repr__();
26792
27308
  output.with_square((function() {
26793
27309
  var ρσ_anonfunc = function () {
26794
27310
  var ρσ_unpack, i, item;
26795
- var ρσ_Iter166 = ρσ_Iterable(enumerate(self.items));
26796
- for (var ρσ_Index166 = 0; ρσ_Index166 < ρσ_Iter166.length; ρσ_Index166++) {
26797
- ρσ_unpack = ρσ_Iter166[ρσ_Index166];
27311
+ var ρσ_Iter175 = ρσ_Iterable(enumerate(self.items));
27312
+ for (var ρσ_Index175 = 0; ρσ_Index175 < ρσ_Iter175.length; ρσ_Index175++) {
27313
+ ρσ_unpack = ρσ_Iter175[ρσ_Index175];
26798
27314
  i = ρσ_unpack[0];
26799
27315
  item = ρσ_unpack[1];
26800
27316
  if (i) {
@@ -26834,9 +27350,9 @@ return this.__repr__();
26834
27350
  output.indent();
26835
27351
  output.spaced.apply(output, "var s = ρσ_set()".split(" "));
26836
27352
  output.end_statement();
26837
- var ρσ_Iter167 = ρσ_Iterable(self.items);
26838
- for (var ρσ_Index167 = 0; ρσ_Index167 < ρσ_Iter167.length; ρσ_Index167++) {
26839
- item = ρσ_Iter167[ρσ_Index167];
27353
+ var ρσ_Iter176 = ρσ_Iterable(self.items);
27354
+ for (var ρσ_Index176 = 0; ρσ_Index176 < ρσ_Iter176.length; ρσ_Index176++) {
27355
+ item = ρσ_Iter176[ρσ_Index176];
26840
27356
  output.indent();
26841
27357
  output.print("s.jsset.add");
26842
27358
  output.with_parens((function() {
@@ -26903,9 +27419,9 @@ return this.__repr__();
26903
27419
 
26904
27420
  function output_comments(comments, output, nlb) {
26905
27421
  var comm;
26906
- var ρσ_Iter168 = ρσ_Iterable(comments);
26907
- for (var ρσ_Index168 = 0; ρσ_Index168 < ρσ_Iter168.length; ρσ_Index168++) {
26908
- comm = ρσ_Iter168[ρσ_Index168];
27422
+ var ρσ_Iter177 = ρσ_Iterable(comments);
27423
+ for (var ρσ_Index177 = 0; ρσ_Index177 < ρσ_Iter177.length; ρσ_Index177++) {
27424
+ comm = ρσ_Iter177[ρσ_Index177];
26909
27425
  if (comm.type === "comment1") {
26910
27426
  output.print(ρσ_list_add(ρσ_list_add("//", comm.value), "\n"));
26911
27427
  output.indent();
@@ -27002,9 +27518,9 @@ return this.__repr__();
27002
27518
  function write_imports(module, output) {
27003
27519
  var imports, import_id, nonlocalvars, name, module_, module_id;
27004
27520
  imports = ρσ_list_decorate([]);
27005
- var ρσ_Iter169 = ρσ_Iterable(Object.keys(module.imports));
27006
- for (var ρσ_Index169 = 0; ρσ_Index169 < ρσ_Iter169.length; ρσ_Index169++) {
27007
- import_id = ρσ_Iter169[ρσ_Index169];
27521
+ var ρσ_Iter178 = ρσ_Iterable(Object.keys(module.imports));
27522
+ for (var ρσ_Index178 = 0; ρσ_Index178 < ρσ_Iter178.length; ρσ_Index178++) {
27523
+ import_id = ρσ_Iter178[ρσ_Index178];
27008
27524
  imports.push((ρσ_expr_temp = module.imports)[(typeof import_id === "number" && import_id < 0) ? ρσ_expr_temp.length + import_id : import_id]);
27009
27525
  }
27010
27526
  imports.jssort((function() {
@@ -27027,12 +27543,12 @@ return this.__repr__();
27027
27543
  output.newline();
27028
27544
  }
27029
27545
  nonlocalvars = Object.create(null);
27030
- var ρσ_Iter170 = ρσ_Iterable(imports);
27031
- for (var ρσ_Index170 = 0; ρσ_Index170 < ρσ_Iter170.length; ρσ_Index170++) {
27032
- module_ = ρσ_Iter170[ρσ_Index170];
27033
- var ρσ_Iter171 = ρσ_Iterable(module_.nonlocalvars);
27034
- for (var ρσ_Index171 = 0; ρσ_Index171 < ρσ_Iter171.length; ρσ_Index171++) {
27035
- name = ρσ_Iter171[ρσ_Index171];
27546
+ var ρσ_Iter179 = ρσ_Iterable(imports);
27547
+ for (var ρσ_Index179 = 0; ρσ_Index179 < ρσ_Iter179.length; ρσ_Index179++) {
27548
+ module_ = ρσ_Iter179[ρσ_Index179];
27549
+ var ρσ_Iter180 = ρσ_Iterable(module_.nonlocalvars);
27550
+ for (var ρσ_Index180 = 0; ρσ_Index180 < ρσ_Iter180.length; ρσ_Index180++) {
27551
+ name = ρσ_Iter180[ρσ_Index180];
27036
27552
  nonlocalvars[(typeof name === "number" && name < 0) ? nonlocalvars.length + name : name] = true;
27037
27553
  }
27038
27554
  }
@@ -27043,9 +27559,9 @@ return this.__repr__();
27043
27559
  output.semicolon();
27044
27560
  output.newline();
27045
27561
  }
27046
- var ρσ_Iter172 = ρσ_Iterable(imports);
27047
- for (var ρσ_Index172 = 0; ρσ_Index172 < ρσ_Iter172.length; ρσ_Index172++) {
27048
- module_ = ρσ_Iter172[ρσ_Index172];
27562
+ var ρσ_Iter181 = ρσ_Iterable(imports);
27563
+ for (var ρσ_Index181 = 0; ρσ_Index181 < ρσ_Iter181.length; ρσ_Index181++) {
27564
+ module_ = ρσ_Iter181[ρσ_Index181];
27049
27565
  module_id = module_.module_id;
27050
27566
  if (module_id !== "__main__") {
27051
27567
  output.indent();
@@ -27058,9 +27574,9 @@ return this.__repr__();
27058
27574
  output.end_statement();
27059
27575
  }
27060
27576
  }
27061
- var ρσ_Iter173 = ρσ_Iterable(imports);
27062
- for (var ρσ_Index173 = 0; ρσ_Index173 < ρσ_Iter173.length; ρσ_Index173++) {
27063
- module_ = ρσ_Iter173[ρσ_Index173];
27577
+ var ρσ_Iter182 = ρσ_Iterable(imports);
27578
+ for (var ρσ_Index182 = 0; ρσ_Index182 < ρσ_Iter182.length; ρσ_Index182++) {
27579
+ module_ = ρσ_Iter182[ρσ_Index182];
27064
27580
  if (module_.module_id !== "__main__") {
27065
27581
  print_module(module_, output);
27066
27582
  }
@@ -27110,9 +27626,9 @@ return this.__repr__();
27110
27626
  output.end_statement();
27111
27627
  }
27112
27628
  output.newline();
27113
- var ρσ_Iter174 = ρσ_Iterable(exports);
27114
- for (var ρσ_Index174 = 0; ρσ_Index174 < ρσ_Iter174.length; ρσ_Index174++) {
27115
- symbol = ρσ_Iter174[ρσ_Index174];
27629
+ var ρσ_Iter183 = ρσ_Iterable(exports);
27630
+ for (var ρσ_Index183 = 0; ρσ_Index183 < ρσ_Iter183.length; ρσ_Index183++) {
27631
+ symbol = ρσ_Iter183[ρσ_Index183];
27116
27632
  if (!Object.prototype.hasOwnProperty.call(seen, symbol.name)) {
27117
27633
  output.indent();
27118
27634
  if (module_id.indexOf(".") === -1) {
@@ -27133,7 +27649,7 @@ return this.__repr__();
27133
27649
 
27134
27650
  function _inject_pythonize_strings(output) {
27135
27651
  var str_funcs;
27136
- str_funcs = "capitalize strip lstrip rstrip islower isupper isspace lower upper swapcase title center count endswith startswith find rfind index rindex format join ljust rjust partition rpartition splitlines zfill".split(" ");
27652
+ str_funcs = "capitalize strip lstrip rstrip islower isupper isspace lower upper swapcase title center count endswith startswith find rfind index rindex format join ljust rjust partition rpartition replace splitlines zfill".split(" ");
27137
27653
  output.newline();
27138
27654
  output.indent();
27139
27655
  output.print(ρσ_list_add(ρσ_list_add("(function(){var _f=", JSON.stringify(str_funcs)), ";for(var _i=0;_i<_f.length;_i++)String.prototype[_f[_i]]=ρσ_str.prototype[_f[_i]];})()"));
@@ -27301,9 +27817,9 @@ return this.__repr__();
27301
27817
  function filter_body_for_tree_shaking(body, needed) {
27302
27818
  var result, name, stmt;
27303
27819
  result = ρσ_list_decorate([]);
27304
- var ρσ_Iter175 = ρσ_Iterable(body);
27305
- for (var ρσ_Index175 = 0; ρσ_Index175 < ρσ_Iter175.length; ρσ_Index175++) {
27306
- stmt = ρσ_Iter175[ρσ_Index175];
27820
+ var ρσ_Iter184 = ρσ_Iterable(body);
27821
+ for (var ρσ_Index184 = 0; ρσ_Index184 < ρσ_Iter184.length; ρσ_Index184++) {
27822
+ stmt = ρσ_Iter184[ρσ_Index184];
27307
27823
  name = get_top_level_name(stmt);
27308
27824
  if (name === null || has_prop(needed, name)) {
27309
27825
  result.push(stmt);
@@ -27319,9 +27835,9 @@ return this.__repr__();
27319
27835
  function filter_exports_for_tree_shaking(exports, needed) {
27320
27836
  var result, sym;
27321
27837
  result = ρσ_list_decorate([]);
27322
- var ρσ_Iter176 = ρσ_Iterable(exports);
27323
- for (var ρσ_Index176 = 0; ρσ_Index176 < ρσ_Iter176.length; ρσ_Index176++) {
27324
- sym = ρσ_Iter176[ρσ_Index176];
27838
+ var ρσ_Iter185 = ρσ_Iterable(exports);
27839
+ for (var ρσ_Index185 = 0; ρσ_Index185 < ρσ_Iter185.length; ρσ_Index185++) {
27840
+ sym = ρσ_Iter185[ρσ_Index185];
27325
27841
  if (has_prop(needed, sym.name)) {
27326
27842
  result.push(sym);
27327
27843
  }
@@ -27392,9 +27908,9 @@ return this.__repr__();
27392
27908
  ρσ_d["discard_asserts"] = !!output.options.discard_asserts;
27393
27909
  return ρσ_d;
27394
27910
  }).call(this);
27395
- var ρσ_Iter177 = ρσ_Iterable(Object.keys(self.classes));
27396
- for (var ρσ_Index177 = 0; ρσ_Index177 < ρσ_Iter177.length; ρσ_Index177++) {
27397
- cname = ρσ_Iter177[ρσ_Index177];
27911
+ var ρσ_Iter186 = ρσ_Iterable(Object.keys(self.classes));
27912
+ for (var ρσ_Index186 = 0; ρσ_Index186 < ρσ_Iter186.length; ρσ_Index186++) {
27913
+ cname = ρσ_Iter186[ρσ_Index186];
27398
27914
  cobj = (ρσ_expr_temp = self.classes)[(typeof cname === "number" && cname < 0) ? ρσ_expr_temp.length + cname : cname];
27399
27915
  (ρσ_expr_temp = cached.classes)[(typeof cname === "number" && cname < 0) ? ρσ_expr_temp.length + cname : cname] = (function(){
27400
27916
  var ρσ_d = Object.create(null);
@@ -27409,24 +27925,24 @@ return this.__repr__();
27409
27925
  return ρσ_d;
27410
27926
  }).call(this);
27411
27927
  }
27412
- var ρσ_Iter178 = ρσ_Iterable(self.exports);
27413
- for (var ρσ_Index178 = 0; ρσ_Index178 < ρσ_Iter178.length; ρσ_Index178++) {
27414
- symdef = ρσ_Iter178[ρσ_Index178];
27928
+ var ρσ_Iter187 = ρσ_Iterable(self.exports);
27929
+ for (var ρσ_Index187 = 0; ρσ_Index187 < ρσ_Iter187.length; ρσ_Index187++) {
27930
+ symdef = ρσ_Iter187[ρσ_Index187];
27415
27931
  cached.exports.push((function(){
27416
27932
  var ρσ_d = Object.create(null);
27417
27933
  ρσ_d["name"] = symdef.name;
27418
27934
  return ρσ_d;
27419
27935
  }).call(this));
27420
27936
  }
27421
- var ρσ_Iter179 = ρσ_Iterable(ρσ_list_decorate([ true, false ]));
27422
- for (var ρσ_Index179 = 0; ρσ_Index179 < ρσ_Iter179.length; ρσ_Index179++) {
27423
- beautify = ρσ_Iter179[ρσ_Index179];
27424
- var ρσ_Iter180 = ρσ_Iterable(ρσ_list_decorate([ true, false ]));
27425
- for (var ρσ_Index180 = 0; ρσ_Index180 < ρσ_Iter180.length; ρσ_Index180++) {
27426
- keep_docstrings = ρσ_Iter180[ρσ_Index180];
27427
- var ρσ_Iter181 = ρσ_Iterable(ρσ_list_decorate([ 5, 6 ]));
27428
- for (var ρσ_Index181 = 0; ρσ_Index181 < ρσ_Iter181.length; ρσ_Index181++) {
27429
- js_version = ρσ_Iter181[ρσ_Index181];
27937
+ var ρσ_Iter188 = ρσ_Iterable(ρσ_list_decorate([ true, false ]));
27938
+ for (var ρσ_Index188 = 0; ρσ_Index188 < ρσ_Iter188.length; ρσ_Index188++) {
27939
+ beautify = ρσ_Iter188[ρσ_Index188];
27940
+ var ρσ_Iter189 = ρσ_Iterable(ρσ_list_decorate([ true, false ]));
27941
+ for (var ρσ_Index189 = 0; ρσ_Index189 < ρσ_Iter189.length; ρσ_Index189++) {
27942
+ keep_docstrings = ρσ_Iter189[ρσ_Index189];
27943
+ var ρσ_Iter190 = ρσ_Iterable(ρσ_list_decorate([ 5, 6 ]));
27944
+ for (var ρσ_Index190 = 0; ρσ_Index190 < ρσ_Iter190.length; ρσ_Index190++) {
27945
+ js_version = ρσ_Iter190[ρσ_Index190];
27430
27946
  co = new OutputStream((function(){
27431
27947
  var ρσ_d = Object.create(null);
27432
27948
  ρσ_d["beautify"] = beautify;
@@ -27513,13 +28029,13 @@ return this.__repr__();
27513
28029
  __module__ : {value: "output.modules"}
27514
28030
  });
27515
28031
 
27516
- var ρσ_Iter182 = ρσ_Iterable(container.imports);
27517
- for (var ρσ_Index182 = 0; ρσ_Index182 < ρσ_Iter182.length; ρσ_Index182++) {
27518
- self = ρσ_Iter182[ρσ_Index182];
28032
+ var ρσ_Iter191 = ρσ_Iterable(container.imports);
28033
+ for (var ρσ_Index191 = 0; ρσ_Index191 < ρσ_Iter191.length; ρσ_Index191++) {
28034
+ self = ρσ_Iter191[ρσ_Index191];
27519
28035
  if (self.argnames) {
27520
- var ρσ_Iter183 = ρσ_Iterable(self.argnames);
27521
- for (var ρσ_Index183 = 0; ρσ_Index183 < ρσ_Iter183.length; ρσ_Index183++) {
27522
- argname = ρσ_Iter183[ρσ_Index183];
28036
+ var ρσ_Iter192 = ρσ_Iterable(self.argnames);
28037
+ for (var ρσ_Index192 = 0; ρσ_Index192 < ρσ_Iter192.length; ρσ_Index192++) {
28038
+ argname = ρσ_Iter192[ρσ_Index192];
27523
28039
  akey = (argname.alias) ? argname.alias.name : argname.name;
27524
28040
  add_aname(akey, self.key, argname.name);
27525
28041
  }
@@ -27528,9 +28044,9 @@ return this.__repr__();
27528
28044
  add_aname(self.alias.name, self.key, false);
27529
28045
  } else {
27530
28046
  parts = self.key.split(".");
27531
- var ρσ_Iter184 = ρσ_Iterable(enumerate(parts));
27532
- for (var ρσ_Index184 = 0; ρσ_Index184 < ρσ_Iter184.length; ρσ_Index184++) {
27533
- ρσ_unpack = ρσ_Iter184[ρσ_Index184];
28047
+ var ρσ_Iter193 = ρσ_Iterable(enumerate(parts));
28048
+ for (var ρσ_Index193 = 0; ρσ_Index193 < ρσ_Iter193.length; ρσ_Index193++) {
28049
+ ρσ_unpack = ρσ_Iter193[ρσ_Index193];
27534
28050
  i = ρσ_unpack[0];
27535
28051
  part = ρσ_unpack[1];
27536
28052
  if (i === 0) {
@@ -27636,15 +28152,15 @@ return this.__repr__();
27636
28152
  var lines, last_non_empty, i, result, line, is_first, is_last;
27637
28153
  lines = text.split("\n");
27638
28154
  last_non_empty = -1;
27639
- for (var ρσ_Index185 = 0; ρσ_Index185 < lines.length; ρσ_Index185++) {
27640
- i = ρσ_Index185;
28155
+ for (var ρσ_Index194 = 0; ρσ_Index194 < lines.length; ρσ_Index194++) {
28156
+ i = ρσ_Index194;
27641
28157
  if (/[^ \t]/.test(lines[(typeof i === "number" && i < 0) ? lines.length + i : i])) {
27642
28158
  last_non_empty = i;
27643
28159
  }
27644
28160
  }
27645
28161
  result = "";
27646
- for (var ρσ_Index186 = 0; ρσ_Index186 < lines.length; ρσ_Index186++) {
27647
- i = ρσ_Index186;
28162
+ for (var ρσ_Index195 = 0; ρσ_Index195 < lines.length; ρσ_Index195++) {
28163
+ i = ρσ_Index195;
27648
28164
  line = lines[(typeof i === "number" && i < 0) ? lines.length + i : i].replace(/\t/g, " ");
27649
28165
  is_first = i === 0;
27650
28166
  is_last = i === lines.length - 1;
@@ -27702,9 +28218,9 @@ return this.__repr__();
27702
28218
  }
27703
28219
  output.print("{");
27704
28220
  first = true;
27705
- var ρσ_Iter187 = ρσ_Iterable(props);
27706
- for (var ρσ_Index187 = 0; ρσ_Index187 < ρσ_Iter187.length; ρσ_Index187++) {
27707
- prop = ρσ_Iter187[ρσ_Index187];
28221
+ var ρσ_Iter196 = ρσ_Iterable(props);
28222
+ for (var ρσ_Index196 = 0; ρσ_Index196 < ρσ_Iter196.length; ρσ_Index196++) {
28223
+ prop = ρσ_Iter196[ρσ_Index196];
27708
28224
  if (!first) {
27709
28225
  output.print(", ");
27710
28226
  }
@@ -27739,9 +28255,9 @@ return this.__repr__();
27739
28255
 
27740
28256
  function _print_children(children, output) {
27741
28257
  var text, child;
27742
- var ρσ_Iter188 = ρσ_Iterable(children);
27743
- for (var ρσ_Index188 = 0; ρσ_Index188 < ρσ_Iter188.length; ρσ_Index188++) {
27744
- child = ρσ_Iter188[ρσ_Index188];
28258
+ var ρσ_Iter197 = ρσ_Iterable(children);
28259
+ for (var ρσ_Index197 = 0; ρσ_Index197 < ρσ_Iter197.length; ρσ_Index197++) {
28260
+ child = ρσ_Iter197[ρσ_Index197];
27745
28261
  if (is_node_type(child, AST_JSXText)) {
27746
28262
  text = _process_jsx_text(child.value);
27747
28263
  if (text) {
@@ -28347,9 +28863,9 @@ return this.__repr__();
28347
28863
  output.with_block((function() {
28348
28864
  var ρσ_anonfunc = function () {
28349
28865
  var stmt;
28350
- var ρσ_Iter189 = ρσ_Iterable(self.body.body);
28351
- for (var ρσ_Index189 = 0; ρσ_Index189 < ρσ_Iter189.length; ρσ_Index189++) {
28352
- stmt = ρσ_Iter189[ρσ_Index189];
28866
+ var ρσ_Iter198 = ρσ_Iterable(self.body.body);
28867
+ for (var ρσ_Index198 = 0; ρσ_Index198 < ρσ_Iter198.length; ρσ_Index198++) {
28868
+ stmt = ρσ_Iter198[ρσ_Index198];
28353
28869
  output.indent();
28354
28870
  stmt.print(output);
28355
28871
  output.newline();
@@ -28623,9 +29139,9 @@ return this.__repr__();
28623
29139
  var ρσ_unpack, i, def_, p, in_for, avoid_semicolon;
28624
29140
  output.print(kind);
28625
29141
  output.space();
28626
- var ρσ_Iter190 = ρσ_Iterable(enumerate(this.definitions));
28627
- for (var ρσ_Index190 = 0; ρσ_Index190 < ρσ_Iter190.length; ρσ_Index190++) {
28628
- ρσ_unpack = ρσ_Iter190[ρσ_Index190];
29142
+ var ρσ_Iter199 = ρσ_Iterable(enumerate(this.definitions));
29143
+ for (var ρσ_Index199 = 0; ρσ_Index199 < ρσ_Iter199.length; ρσ_Index199++) {
29144
+ ρσ_unpack = ρσ_Iter199[ρσ_Index199];
28629
29145
  i = ρσ_unpack[0];
28630
29146
  def_ = ρσ_unpack[1];
28631
29147
  if (i) {
@@ -28968,17 +29484,17 @@ return this.__repr__();
28968
29484
  var nonlocal_set, nv, name_map, unnamed_stmts, name, stmt, top_level_set, needed, queue, always_refs, ref_name, current, refs;
28969
29485
  nonlocal_set = Object.create(null);
28970
29486
  if (nonlocalvars) {
28971
- var ρσ_Iter191 = ρσ_Iterable(nonlocalvars);
28972
- for (var ρσ_Index191 = 0; ρσ_Index191 < ρσ_Iter191.length; ρσ_Index191++) {
28973
- nv = ρσ_Iter191[ρσ_Index191];
29487
+ var ρσ_Iter200 = ρσ_Iterable(nonlocalvars);
29488
+ for (var ρσ_Index200 = 0; ρσ_Index200 < ρσ_Iter200.length; ρσ_Index200++) {
29489
+ nv = ρσ_Iter200[ρσ_Index200];
28974
29490
  nonlocal_set[(typeof nv === "number" && nv < 0) ? nonlocal_set.length + nv : nv] = true;
28975
29491
  }
28976
29492
  }
28977
29493
  name_map = Object.create(null);
28978
29494
  unnamed_stmts = ρσ_list_decorate([]);
28979
- var ρσ_Iter192 = ρσ_Iterable(body);
28980
- for (var ρσ_Index192 = 0; ρσ_Index192 < ρσ_Iter192.length; ρσ_Index192++) {
28981
- stmt = ρσ_Iter192[ρσ_Index192];
29495
+ var ρσ_Iter201 = ρσ_Iterable(body);
29496
+ for (var ρσ_Index201 = 0; ρσ_Index201 < ρσ_Iter201.length; ρσ_Index201++) {
29497
+ stmt = ρσ_Iter201[ρσ_Index201];
28982
29498
  name = get_top_level_name(stmt);
28983
29499
  if (name !== null) {
28984
29500
  name_map[(typeof name === "number" && name < 0) ? name_map.length + name : name] = stmt;
@@ -28987,38 +29503,38 @@ return this.__repr__();
28987
29503
  }
28988
29504
  }
28989
29505
  top_level_set = Object.create(null);
28990
- var ρσ_Iter193 = ρσ_Iterable(Object.keys(name_map));
28991
- for (var ρσ_Index193 = 0; ρσ_Index193 < ρσ_Iter193.length; ρσ_Index193++) {
28992
- name = ρσ_Iter193[ρσ_Index193];
29506
+ var ρσ_Iter202 = ρσ_Iterable(Object.keys(name_map));
29507
+ for (var ρσ_Index202 = 0; ρσ_Index202 < ρσ_Iter202.length; ρσ_Index202++) {
29508
+ name = ρσ_Iter202[ρσ_Index202];
28993
29509
  top_level_set[(typeof name === "number" && name < 0) ? top_level_set.length + name : name] = true;
28994
29510
  }
28995
29511
  needed = Object.create(null);
28996
29512
  queue = ρσ_list_decorate([]);
28997
- var ρσ_Iter194 = ρσ_Iterable(Object.keys(name_map));
28998
- for (var ρσ_Index194 = 0; ρσ_Index194 < ρσ_Iter194.length; ρσ_Index194++) {
28999
- name = ρσ_Iter194[ρσ_Index194];
29513
+ var ρσ_Iter203 = ρσ_Iterable(Object.keys(name_map));
29514
+ for (var ρσ_Index203 = 0; ρσ_Index203 < ρσ_Iter203.length; ρσ_Index203++) {
29515
+ name = ρσ_Iter203[ρσ_Index203];
29000
29516
  if (has_prop(nonlocal_set, name)) {
29001
29517
  needed[(typeof name === "number" && name < 0) ? needed.length + name : name] = true;
29002
29518
  queue.push(name);
29003
29519
  }
29004
29520
  }
29005
- var ρσ_Iter195 = ρσ_Iterable(Object.keys(direct_names));
29006
- for (var ρσ_Index195 = 0; ρσ_Index195 < ρσ_Iter195.length; ρσ_Index195++) {
29007
- name = ρσ_Iter195[ρσ_Index195];
29521
+ var ρσ_Iter204 = ρσ_Iterable(Object.keys(direct_names));
29522
+ for (var ρσ_Index204 = 0; ρσ_Index204 < ρσ_Iter204.length; ρσ_Index204++) {
29523
+ name = ρσ_Iter204[ρσ_Index204];
29008
29524
  if (!has_prop(needed, name)) {
29009
29525
  needed[(typeof name === "number" && name < 0) ? needed.length + name : name] = true;
29010
29526
  queue.push(name);
29011
29527
  }
29012
29528
  }
29013
29529
  always_refs = Object.create(null);
29014
- var ρσ_Iter196 = ρσ_Iterable(unnamed_stmts);
29015
- for (var ρσ_Index196 = 0; ρσ_Index196 < ρσ_Iter196.length; ρσ_Index196++) {
29016
- stmt = ρσ_Iter196[ρσ_Index196];
29530
+ var ρσ_Iter205 = ρσ_Iterable(unnamed_stmts);
29531
+ for (var ρσ_Index205 = 0; ρσ_Index205 < ρσ_Iter205.length; ρσ_Index205++) {
29532
+ stmt = ρσ_Iter205[ρσ_Index205];
29017
29533
  collect_refs_in_node(stmt, top_level_set, always_refs);
29018
29534
  }
29019
- var ρσ_Iter197 = ρσ_Iterable(Object.keys(always_refs));
29020
- for (var ρσ_Index197 = 0; ρσ_Index197 < ρσ_Iter197.length; ρσ_Index197++) {
29021
- ref_name = ρσ_Iter197[ρσ_Index197];
29535
+ var ρσ_Iter206 = ρσ_Iterable(Object.keys(always_refs));
29536
+ for (var ρσ_Index206 = 0; ρσ_Index206 < ρσ_Iter206.length; ρσ_Index206++) {
29537
+ ref_name = ρσ_Iter206[ρσ_Index206];
29022
29538
  if (!has_prop(needed, ref_name)) {
29023
29539
  needed[(typeof ref_name === "number" && ref_name < 0) ? needed.length + ref_name : ref_name] = true;
29024
29540
  queue.push(ref_name);
@@ -29031,9 +29547,9 @@ return this.__repr__();
29031
29547
  }
29032
29548
  refs = Object.create(null);
29033
29549
  collect_refs_in_node(name_map[(typeof current === "number" && current < 0) ? name_map.length + current : current], top_level_set, refs);
29034
- var ρσ_Iter198 = ρσ_Iterable(Object.keys(refs));
29035
- for (var ρσ_Index198 = 0; ρσ_Index198 < ρσ_Iter198.length; ρσ_Index198++) {
29036
- ref_name = ρσ_Iter198[ρσ_Index198];
29550
+ var ρσ_Iter207 = ρσ_Iterable(Object.keys(refs));
29551
+ for (var ρσ_Index207 = 0; ρσ_Index207 < ρσ_Iter207.length; ρσ_Index207++) {
29552
+ ref_name = ρσ_Iter207[ρσ_Index207];
29037
29553
  if (!has_prop(needed, ref_name)) {
29038
29554
  needed[(typeof ref_name === "number" && ref_name < 0) ? needed.length + ref_name : ref_name] = true;
29039
29555
  queue.push(ref_name);
@@ -29070,9 +29586,9 @@ return this.__repr__();
29070
29586
  __module__ : {value: "output.treeshake"}
29071
29587
  });
29072
29588
 
29073
- var ρσ_Iter199 = ρσ_Iterable(main_body);
29074
- for (var ρσ_Index199 = 0; ρσ_Index199 < ρσ_Iter199.length; ρσ_Index199++) {
29075
- stmt = ρσ_Iter199[ρσ_Index199];
29589
+ var ρσ_Iter208 = ρσ_Iterable(main_body);
29590
+ for (var ρσ_Index208 = 0; ρσ_Index208 < ρσ_Iter208.length; ρσ_Index208++) {
29591
+ stmt = ρσ_Iter208[ρσ_Index208];
29076
29592
  stmt.walk(new TreeWalker(visit_fn));
29077
29593
  }
29078
29594
  };
@@ -29087,9 +29603,9 @@ return this.__repr__();
29087
29603
  function visit_from_imports(node, descend) {
29088
29604
  var key, argname, imp;
29089
29605
  if (is_node_type(node, AST_Imports)) {
29090
- var ρσ_Iter200 = ρσ_Iterable(node.imports);
29091
- for (var ρσ_Index200 = 0; ρσ_Index200 < ρσ_Iter200.length; ρσ_Index200++) {
29092
- imp = ρσ_Iter200[ρσ_Index200];
29606
+ var ρσ_Iter209 = ρσ_Iterable(node.imports);
29607
+ for (var ρσ_Index209 = 0; ρσ_Index209 < ρσ_Iter209.length; ρσ_Index209++) {
29608
+ imp = ρσ_Iter209[ρσ_Index209];
29093
29609
  if (imp.argnames) {
29094
29610
  key = imp.key;
29095
29611
  if (!has_prop(result, key)) {
@@ -29100,9 +29616,9 @@ return this.__repr__();
29100
29616
  return ρσ_d;
29101
29617
  }).call(this);
29102
29618
  }
29103
- var ρσ_Iter201 = ρσ_Iterable(imp.argnames);
29104
- for (var ρσ_Index201 = 0; ρσ_Index201 < ρσ_Iter201.length; ρσ_Index201++) {
29105
- argname = ρσ_Iter201[ρσ_Index201];
29619
+ var ρσ_Iter210 = ρσ_Iterable(imp.argnames);
29620
+ for (var ρσ_Index210 = 0; ρσ_Index210 < ρσ_Iter210.length; ρσ_Index210++) {
29621
+ argname = ρσ_Iter210[ρσ_Index210];
29106
29622
  (ρσ_expr_temp = result[(typeof key === "number" && key < 0) ? result.length + key : key].direct_names)[ρσ_bound_index(argname.name, ρσ_expr_temp)] = true;
29107
29623
  }
29108
29624
  }
@@ -29114,20 +29630,20 @@ return this.__repr__();
29114
29630
  __module__ : {value: "output.treeshake"}
29115
29631
  });
29116
29632
 
29117
- var ρσ_Iter202 = ρσ_Iterable(main_body);
29118
- for (var ρσ_Index202 = 0; ρσ_Index202 < ρσ_Iter202.length; ρσ_Index202++) {
29119
- stmt = ρσ_Iter202[ρσ_Index202];
29633
+ var ρσ_Iter211 = ρσ_Iterable(main_body);
29634
+ for (var ρσ_Index211 = 0; ρσ_Index211 < ρσ_Iter211.length; ρσ_Index211++) {
29635
+ stmt = ρσ_Iter211[ρσ_Index211];
29120
29636
  stmt.walk(new TreeWalker(visit_from_imports));
29121
29637
  }
29122
- var ρσ_Iter203 = ρσ_Iterable(main_body);
29123
- for (var ρσ_Index203 = 0; ρσ_Index203 < ρσ_Iter203.length; ρσ_Index203++) {
29124
- stmt = ρσ_Iter203[ρσ_Index203];
29638
+ var ρσ_Iter212 = ρσ_Iterable(main_body);
29639
+ for (var ρσ_Index212 = 0; ρσ_Index212 < ρσ_Iter212.length; ρσ_Index212++) {
29640
+ stmt = ρσ_Iter212[ρσ_Index212];
29125
29641
  if (!is_node_type(stmt, AST_Imports)) {
29126
29642
  continue;
29127
29643
  }
29128
- var ρσ_Iter204 = ρσ_Iterable(stmt.imports);
29129
- for (var ρσ_Index204 = 0; ρσ_Index204 < ρσ_Iter204.length; ρσ_Index204++) {
29130
- imp = ρσ_Iter204[ρσ_Index204];
29644
+ var ρσ_Iter213 = ρσ_Iterable(stmt.imports);
29645
+ for (var ρσ_Index213 = 0; ρσ_Index213 < ρσ_Iter213.length; ρσ_Index213++) {
29646
+ imp = ρσ_Iter213[ρσ_Index213];
29131
29647
  if (imp.argnames) {
29132
29648
  continue;
29133
29649
  }
@@ -29167,9 +29683,9 @@ return this.__repr__();
29167
29683
  function tree_shake(ast, context) {
29168
29684
  var import_infos, info, mod, parsed, needed, mod_key;
29169
29685
  import_infos = analyze_imports(ast.body);
29170
- var ρσ_Iter205 = ρσ_Iterable(Object.keys(import_infos));
29171
- for (var ρσ_Index205 = 0; ρσ_Index205 < ρσ_Iter205.length; ρσ_Index205++) {
29172
- mod_key = ρσ_Iter205[ρσ_Index205];
29686
+ var ρσ_Iter214 = ρσ_Iterable(Object.keys(import_infos));
29687
+ for (var ρσ_Index214 = 0; ρσ_Index214 < ρσ_Iter214.length; ρσ_Index214++) {
29688
+ mod_key = ρσ_Iter214[ρσ_Index214];
29173
29689
  info = import_infos[(typeof mod_key === "number" && mod_key < 0) ? import_infos.length + mod_key : mod_key];
29174
29690
  if (!info.can_tree_shake) {
29175
29691
  continue;
@@ -29256,9 +29772,9 @@ return this.__repr__();
29256
29772
  exports.tokenizer = tokenizer;
29257
29773
  exports.tree_shake = tree_shake;
29258
29774
  ast = ρσ_modules["ast"];
29259
- var ρσ_Iter206 = ρσ_Iterable(ast);
29260
- for (var ρσ_Index206 = 0; ρσ_Index206 < ρσ_Iter206.length; ρσ_Index206++) {
29261
- ast_node = ρσ_Iter206[ρσ_Index206];
29775
+ var ρσ_Iter215 = ρσ_Iterable(ast);
29776
+ for (var ρσ_Index215 = 0; ρσ_Index215 < ρσ_Iter215.length; ρσ_Index215++) {
29777
+ ast_node = ρσ_Iter215[ρσ_Index215];
29262
29778
  if (ast_node.substr(0, 4) === "AST_") {
29263
29779
  exports[(typeof ast_node === "number" && ast_node < 0) ? exports.length + ast_node : ast_node] = ast[(typeof ast_node === "number" && ast_node < 0) ? ast.length + ast_node : ast_node];
29264
29780
  }