rapydscript-ns 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/PYTHON_GAPS.md +352 -0
- package/README.md +176 -32
- package/TODO.md +1 -128
- package/bin/rapydscript +70 -70
- package/language-service/index.js +242 -11
- package/memory/project_string_impl.md +43 -0
- package/package.json +1 -1
- package/release/baselib-plain-pretty.js +248 -38
- package/release/baselib-plain-ugly.js +8 -8
- package/release/compiler.js +778 -277
- package/release/signatures.json +30 -30
- package/src/ast.pyj +10 -1
- package/src/baselib-builtins.pyj +56 -2
- package/src/baselib-containers.pyj +25 -1
- package/src/baselib-errors.pyj +7 -3
- package/src/baselib-internal.pyj +51 -6
- package/src/baselib-str.pyj +18 -5
- package/src/lib/asyncio.pyj +534 -0
- package/src/lib/base64.pyj +399 -0
- package/src/lib/bisect.pyj +73 -0
- package/src/lib/collections.pyj +228 -4
- package/src/lib/csv.pyj +494 -0
- package/src/lib/heapq.pyj +98 -0
- package/src/lib/html.pyj +382 -0
- package/src/lib/http/__init__.pyj +98 -0
- package/src/lib/http/client.pyj +304 -0
- package/src/lib/http/cookies.pyj +236 -0
- package/src/lib/logging.pyj +672 -0
- package/src/lib/pprint.pyj +455 -0
- package/src/lib/pythonize.pyj +20 -20
- package/src/lib/statistics.pyj +0 -0
- package/src/lib/string.pyj +357 -0
- package/src/lib/textwrap.pyj +329 -0
- package/src/lib/urllib/__init__.pyj +14 -0
- package/src/lib/urllib/error.pyj +66 -0
- package/src/lib/urllib/parse.pyj +475 -0
- package/src/lib/urllib/request.pyj +86 -0
- package/src/monaco-language-service/analyzer.js +5 -2
- package/src/monaco-language-service/completions.js +26 -0
- package/src/monaco-language-service/diagnostics.js +203 -4
- package/src/monaco-language-service/scope.js +1 -0
- package/src/output/codegen.pyj +4 -1
- package/src/output/functions.pyj +152 -6
- package/src/output/loops.pyj +17 -2
- package/src/output/modules.pyj +1 -1
- package/src/output/operators.pyj +15 -0
- package/src/output/stream.pyj +0 -1
- package/src/parse.pyj +108 -24
- package/src/tokenizer.pyj +19 -3
- package/test/async_generators.pyj +144 -0
- package/test/asyncio.pyj +307 -0
- package/test/base64.pyj +202 -0
- package/test/baselib.pyj +23 -0
- package/test/bisect.pyj +178 -0
- package/test/chainmap.pyj +185 -0
- package/test/csv.pyj +405 -0
- package/test/float_special.pyj +64 -0
- package/test/heapq.pyj +174 -0
- package/test/html.pyj +212 -0
- package/test/http.pyj +259 -0
- package/test/imports.pyj +79 -72
- package/test/logging.pyj +356 -0
- package/test/long.pyj +130 -0
- package/test/parenthesized_with.pyj +141 -0
- package/test/pprint.pyj +232 -0
- package/test/python_compat.pyj +3 -5
- package/test/python_modulo.pyj +76 -0
- package/test/python_modulo_off.pyj +21 -0
- package/test/statistics.pyj +224 -0
- package/test/str.pyj +14 -0
- package/test/string.pyj +245 -0
- package/test/textwrap.pyj +172 -0
- package/test/type_display.pyj +48 -0
- package/test/type_enforcement.pyj +164 -0
- package/test/unit/index.js +94 -6
- package/test/unit/language-service-completions.js +121 -0
- package/test/unit/language-service-scope.js +32 -0
- package/test/unit/language-service.js +190 -5
- package/test/unit/run-language-service.js +17 -3
- package/test/unit/web-repl.js +2401 -13
- package/test/urllib.pyj +193 -0
- package/tools/compile.js +1 -1
- package/tools/embedded_compiler.js +7 -7
- package/tools/export.js +4 -2
- package/web-repl/main.js +1 -1
- package/web-repl/rapydscript.js +7 -5
- package/test/omit_function_metadata.pyj +0 -20
package/release/compiler.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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 = (
|
|
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,
|
|
4843
|
+
ρσ_extends(IndexError, LookupError);
|
|
4715
4844
|
IndexError.prototype.__init__ = function __init__ () {
|
|
4716
|
-
|
|
4845
|
+
LookupError.prototype.__init__ && LookupError.prototype.__init__.apply(this, arguments);
|
|
4717
4846
|
};
|
|
4718
4847
|
IndexError.prototype.__repr__ = function __repr__ () {
|
|
4719
|
-
if(
|
|
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(
|
|
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(
|
|
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: [
|
|
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
|
|
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,
|
|
4873
|
+
ρσ_extends(KeyError, LookupError);
|
|
4745
4874
|
KeyError.prototype.__init__ = function __init__ () {
|
|
4746
|
-
|
|
4875
|
+
LookupError.prototype.__init__ && LookupError.prototype.__init__.apply(this, arguments);
|
|
4747
4876
|
};
|
|
4748
4877
|
KeyError.prototype.__repr__ = function __repr__ () {
|
|
4749
|
-
if(
|
|
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(
|
|
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(
|
|
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: [
|
|
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
|
|
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
|
|
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
|
-
|
|
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 (
|
|
8189
|
+
if (old instanceof RegExp) {
|
|
7980
8190
|
return ρσ_orig_replace(string, old, repl);
|
|
7981
8191
|
}
|
|
7982
|
-
if (count
|
|
8192
|
+
if (count === 0) {
|
|
7983
8193
|
return string;
|
|
7984
8194
|
}
|
|
7985
|
-
count = count
|
|
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
|
|
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
|
|
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
|
|
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 = "
|
|
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
|
-
|
|
17252
|
-
|
|
17253
|
-
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17258
|
-
|
|
17259
|
-
|
|
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
|
-
|
|
17262
|
-
|
|
17263
|
-
|
|
17264
|
-
|
|
17265
|
-
|
|
17266
|
-
|
|
17267
|
-
|
|
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
|
-
|
|
17531
|
+
break;
|
|
17270
17532
|
}
|
|
17271
|
-
|
|
17272
|
-
|
|
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 (
|
|
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);
|
|
@@ -24616,6 +24915,14 @@ return this.__repr__();
|
|
|
24616
24915
|
output.print(")");
|
|
24617
24916
|
return;
|
|
24618
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
|
+
}
|
|
24619
24926
|
if (function_ops[ρσ_bound_index(self.operator, function_ops)]) {
|
|
24620
24927
|
output.print(function_ops[ρσ_bound_index(self.operator, function_ops)]);
|
|
24621
24928
|
output.with_parens((function() {
|
|
@@ -24857,6 +25164,15 @@ return this.__repr__();
|
|
|
24857
25164
|
})());
|
|
24858
25165
|
return;
|
|
24859
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
|
+
}
|
|
24860
25176
|
if (self.operator === "**=") {
|
|
24861
25177
|
output.assign(self.left);
|
|
24862
25178
|
if (output.options.js_version > 6) {
|
|
@@ -25132,17 +25448,84 @@ return this.__repr__();
|
|
|
25132
25448
|
});
|
|
25133
25449
|
|
|
25134
25450
|
function function_preamble(node, output, offset) {
|
|
25135
|
-
var a, fname, kw,
|
|
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;
|
|
25136
25452
|
a = node.argnames;
|
|
25137
|
-
if (a === null || a === undefined
|
|
25453
|
+
if (a === null || a === undefined) {
|
|
25454
|
+
return;
|
|
25455
|
+
}
|
|
25456
|
+
type_enforce = node.type_enforce;
|
|
25457
|
+
if (a.is_simple_func && !type_enforce) {
|
|
25138
25458
|
return;
|
|
25139
25459
|
}
|
|
25140
25460
|
fname = (node.name) ? node.name.name : anonfunc;
|
|
25141
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
|
+
}
|
|
25142
25525
|
positional_count = 0;
|
|
25143
|
-
var ρσ
|
|
25144
|
-
for (var ρσ
|
|
25145
|
-
ρσ_unpack = ρσ
|
|
25526
|
+
var ρσ_Iter141 = ρσ_Iterable(enumerate(a));
|
|
25527
|
+
for (var ρσ_Index141 = 0; ρσ_Index141 < ρσ_Iter141.length; ρσ_Index141++) {
|
|
25528
|
+
ρσ_unpack = ρσ_Iter141[ρσ_Index141];
|
|
25146
25529
|
c = ρσ_unpack[0];
|
|
25147
25530
|
arg = ρσ_unpack[1];
|
|
25148
25531
|
i = c - offset;
|
|
@@ -25180,10 +25563,35 @@ return this.__repr__();
|
|
|
25180
25563
|
output.indent();
|
|
25181
25564
|
output.spaced("if", ρσ_list_add("(", kw), "===", "null", "||", "typeof", kw, "!==", "\"object\"", "||", kw, "[ρσ_kwargs_symbol]", "!==", "true)", kw, "=", "{}");
|
|
25182
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
|
+
}
|
|
25183
25591
|
if (a.has_defaults) {
|
|
25184
|
-
var ρσ
|
|
25185
|
-
for (var ρσ
|
|
25186
|
-
dname = ρσ
|
|
25592
|
+
var ρσ_Iter143 = ρσ_Iterable(Object.keys(a.defaults));
|
|
25593
|
+
for (var ρσ_Index143 = 0; ρσ_Index143 < ρσ_Iter143.length; ρσ_Index143++) {
|
|
25594
|
+
dname = ρσ_Iter143[ρσ_Index143];
|
|
25187
25595
|
is_posonly = false;
|
|
25188
25596
|
for (var qi = 0; qi < (a.posonly_count || 0); qi++) {
|
|
25189
25597
|
if (a[(typeof qi === "number" && qi < 0) ? a.length + qi : qi].name === dname) {
|
|
@@ -25226,9 +25634,9 @@ return this.__repr__();
|
|
|
25226
25634
|
}
|
|
25227
25635
|
}
|
|
25228
25636
|
if (a.bare_star) {
|
|
25229
|
-
var ρσ
|
|
25230
|
-
for (var ρσ
|
|
25231
|
-
arg = ρσ
|
|
25637
|
+
var ρσ_Iter144 = ρσ_Iterable(a);
|
|
25638
|
+
for (var ρσ_Index144 = 0; ρσ_Index144 < ρσ_Iter144.length; ρσ_Index144++) {
|
|
25639
|
+
arg = ρσ_Iter144[ρσ_Index144];
|
|
25232
25640
|
if (!arg.kwonly) {
|
|
25233
25641
|
continue;
|
|
25234
25642
|
}
|
|
@@ -25254,6 +25662,40 @@ return this.__repr__();
|
|
|
25254
25662
|
output.newline();
|
|
25255
25663
|
}
|
|
25256
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
|
+
}
|
|
25257
25699
|
}
|
|
25258
25700
|
if (a.starargs !== undefined) {
|
|
25259
25701
|
nargs = a.length - offset;
|
|
@@ -25270,6 +25712,60 @@ return this.__repr__();
|
|
|
25270
25712
|
output.spaced(kw, "=", ρσ_list_add(ρσ_list_add("ρσ_kwargs_to_dict(", kw), ")"));
|
|
25271
25713
|
output.end_statement();
|
|
25272
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
|
+
}
|
|
25273
25769
|
};
|
|
25274
25770
|
if (!function_preamble.__argnames__) Object.defineProperties(function_preamble, {
|
|
25275
25771
|
__argnames__ : {value: ["node", "output", "offset"]},
|
|
@@ -25281,9 +25777,9 @@ return this.__repr__();
|
|
|
25281
25777
|
if (self.return_annotation) {
|
|
25282
25778
|
return true;
|
|
25283
25779
|
}
|
|
25284
|
-
var ρσ
|
|
25285
|
-
for (var ρσ
|
|
25286
|
-
arg = ρσ
|
|
25780
|
+
var ρσ_Iter150 = ρσ_Iterable(self.argnames);
|
|
25781
|
+
for (var ρσ_Index150 = 0; ρσ_Index150 < ρσ_Iter150.length; ρσ_Index150++) {
|
|
25782
|
+
arg = ρσ_Iter150[ρσ_Index150];
|
|
25287
25783
|
if (arg.annotation) {
|
|
25288
25784
|
return true;
|
|
25289
25785
|
}
|
|
@@ -25297,9 +25793,6 @@ return this.__repr__();
|
|
|
25297
25793
|
|
|
25298
25794
|
function function_annotation(self, output, strip_first, name) {
|
|
25299
25795
|
var fname, props, defaults, dkeys, argnames_entries, ρσ_unpack, i, arg, names;
|
|
25300
|
-
if (output.options.omit_function_metadata) {
|
|
25301
|
-
return;
|
|
25302
|
-
}
|
|
25303
25796
|
fname = name || ((self.name) ? self.name.name : anonfunc);
|
|
25304
25797
|
props = Object.create(null);
|
|
25305
25798
|
if (has_annotations(self)) {
|
|
@@ -25308,9 +25801,9 @@ return this.__repr__();
|
|
|
25308
25801
|
var ρσ_unpack, i, arg;
|
|
25309
25802
|
output.print("{");
|
|
25310
25803
|
if (self.argnames && self.argnames.length) {
|
|
25311
|
-
var ρσ
|
|
25312
|
-
for (var ρσ
|
|
25313
|
-
ρσ_unpack = ρσ
|
|
25804
|
+
var ρσ_Iter151 = ρσ_Iterable(enumerate(self.argnames));
|
|
25805
|
+
for (var ρσ_Index151 = 0; ρσ_Index151 < ρσ_Iter151.length; ρσ_Index151++) {
|
|
25806
|
+
ρσ_unpack = ρσ_Iter151[ρσ_Index151];
|
|
25314
25807
|
i = ρσ_unpack[0];
|
|
25315
25808
|
arg = ρσ_unpack[1];
|
|
25316
25809
|
if (arg.annotation) {
|
|
@@ -25342,9 +25835,9 @@ return this.__repr__();
|
|
|
25342
25835
|
var ρσ_anonfunc = function () {
|
|
25343
25836
|
var ρσ_unpack, i, k;
|
|
25344
25837
|
output.print("{");
|
|
25345
|
-
var ρσ
|
|
25346
|
-
for (var ρσ
|
|
25347
|
-
ρσ_unpack = ρσ
|
|
25838
|
+
var ρσ_Iter152 = ρσ_Iterable(enumerate(dkeys));
|
|
25839
|
+
for (var ρσ_Index152 = 0; ρσ_Index152 < ρσ_Iter152.length; ρσ_Index152++) {
|
|
25840
|
+
ρσ_unpack = ρσ_Iter152[ρσ_Index152];
|
|
25348
25841
|
i = ρσ_unpack[0];
|
|
25349
25842
|
k = ρσ_unpack[1];
|
|
25350
25843
|
[output.print(ρσ_list_add(k, ":")), defaults[(typeof k === "number" && k < 0) ? defaults.length + k : k].print(output)];
|
|
@@ -25372,9 +25865,9 @@ return this.__repr__();
|
|
|
25372
25865
|
})();
|
|
25373
25866
|
}
|
|
25374
25867
|
argnames_entries = [];
|
|
25375
|
-
var ρσ
|
|
25376
|
-
for (var ρσ
|
|
25377
|
-
ρσ_unpack = ρσ
|
|
25868
|
+
var ρσ_Iter153 = ρσ_Iterable(enumerate(self.argnames));
|
|
25869
|
+
for (var ρσ_Index153 = 0; ρσ_Index153 < ρσ_Iter153.length; ρσ_Index153++) {
|
|
25870
|
+
ρσ_unpack = ρσ_Iter153[ρσ_Index153];
|
|
25378
25871
|
i = ρσ_unpack[0];
|
|
25379
25872
|
arg = ρσ_unpack[1];
|
|
25380
25873
|
if (strip_first && i === 0) {
|
|
@@ -25395,9 +25888,9 @@ return this.__repr__();
|
|
|
25395
25888
|
var ρσ_anonfunc = function () {
|
|
25396
25889
|
var ρσ_unpack, ei, entry;
|
|
25397
25890
|
output.print("[");
|
|
25398
|
-
var ρσ
|
|
25399
|
-
for (var ρσ
|
|
25400
|
-
ρσ_unpack = ρσ
|
|
25891
|
+
var ρσ_Iter154 = ρσ_Iterable(enumerate(argnames_entries));
|
|
25892
|
+
for (var ρσ_Index154 = 0; ρσ_Index154 < ρσ_Iter154.length; ρσ_Index154++) {
|
|
25893
|
+
ρσ_unpack = ρσ_Iter154[ρσ_Index154];
|
|
25401
25894
|
ei = ρσ_unpack[0];
|
|
25402
25895
|
entry = ρσ_unpack[1];
|
|
25403
25896
|
if (entry.posonly) {
|
|
@@ -25467,7 +25960,7 @@ return this.__repr__();
|
|
|
25467
25960
|
});
|
|
25468
25961
|
|
|
25469
25962
|
function function_definition(self, output, strip_first, as_expression) {
|
|
25470
|
-
var orig_indent;
|
|
25963
|
+
var orig_indent, inner_decl;
|
|
25471
25964
|
as_expression = as_expression || self.is_expression || self.is_anonymous;
|
|
25472
25965
|
if (as_expression) {
|
|
25473
25966
|
orig_indent = output.indentation();
|
|
@@ -25475,7 +25968,7 @@ return this.__repr__();
|
|
|
25475
25968
|
[output.spaced("(function()", "{"), output.newline()];
|
|
25476
25969
|
[output.indent(), output.spaced("var", anonfunc, "="), output.space()];
|
|
25477
25970
|
}
|
|
25478
|
-
if (self.is_async) {
|
|
25971
|
+
if (self.is_async && !self.is_generator) {
|
|
25479
25972
|
[output.print("async"), output.space()];
|
|
25480
25973
|
}
|
|
25481
25974
|
[output.print("function"), output.space()];
|
|
@@ -25483,11 +25976,12 @@ return this.__repr__();
|
|
|
25483
25976
|
self.name.print(output);
|
|
25484
25977
|
}
|
|
25485
25978
|
if (self.is_generator) {
|
|
25979
|
+
inner_decl = (self.is_async) ? "async function* js_generator" : "function* js_generator";
|
|
25486
25980
|
[output.print("()"), output.space()];
|
|
25487
25981
|
output.with_block((function() {
|
|
25488
25982
|
var ρσ_anonfunc = function () {
|
|
25489
25983
|
output.indent();
|
|
25490
|
-
output.print(
|
|
25984
|
+
output.print(inner_decl);
|
|
25491
25985
|
function_args(self.argnames, output, strip_first);
|
|
25492
25986
|
print_bracketed(self, output, true, function_preamble);
|
|
25493
25987
|
output.newline();
|
|
@@ -25497,6 +25991,11 @@ return this.__repr__();
|
|
|
25497
25991
|
output.indent();
|
|
25498
25992
|
output.spaced("result.send", "=", "result.next");
|
|
25499
25993
|
output.end_statement();
|
|
25994
|
+
if (self.is_async) {
|
|
25995
|
+
output.indent();
|
|
25996
|
+
output.spaced("result.asend", "=", "result.next");
|
|
25997
|
+
output.end_statement();
|
|
25998
|
+
}
|
|
25500
25999
|
output.indent();
|
|
25501
26000
|
output.spaced("return", "result");
|
|
25502
26001
|
output.end_statement();
|
|
@@ -25622,9 +26121,9 @@ return this.__repr__();
|
|
|
25622
26121
|
var ρσ_unpack, i, kwname, pair;
|
|
25623
26122
|
output.print("ρσ_desugar_kwargs(");
|
|
25624
26123
|
if (has_kwarg_items) {
|
|
25625
|
-
var ρσ
|
|
25626
|
-
for (var ρσ
|
|
25627
|
-
ρσ_unpack = ρσ
|
|
26124
|
+
var ρσ_Iter155 = ρσ_Iterable(enumerate(self.args.kwarg_items));
|
|
26125
|
+
for (var ρσ_Index155 = 0; ρσ_Index155 < ρσ_Iter155.length; ρσ_Index155++) {
|
|
26126
|
+
ρσ_unpack = ρσ_Iter155[ρσ_Index155];
|
|
25628
26127
|
i = ρσ_unpack[0];
|
|
25629
26128
|
kwname = ρσ_unpack[1];
|
|
25630
26129
|
if (i > 0) {
|
|
@@ -25640,9 +26139,9 @@ return this.__repr__();
|
|
|
25640
26139
|
}
|
|
25641
26140
|
if (has_kwarg_formals) {
|
|
25642
26141
|
output.print("{");
|
|
25643
|
-
var ρσ
|
|
25644
|
-
for (var ρσ
|
|
25645
|
-
ρσ_unpack = ρσ
|
|
26142
|
+
var ρσ_Iter156 = ρσ_Iterable(enumerate(self.args.kwargs));
|
|
26143
|
+
for (var ρσ_Index156 = 0; ρσ_Index156 < ρσ_Iter156.length; ρσ_Index156++) {
|
|
26144
|
+
ρσ_unpack = ρσ_Iter156[ρσ_Index156];
|
|
25646
26145
|
i = ρσ_unpack[0];
|
|
25647
26146
|
pair = ρσ_unpack[1];
|
|
25648
26147
|
if (i) {
|
|
@@ -25735,9 +26234,9 @@ return this.__repr__();
|
|
|
25735
26234
|
output.with_parens((function() {
|
|
25736
26235
|
var ρσ_anonfunc = function () {
|
|
25737
26236
|
var ρσ_unpack, i, a;
|
|
25738
|
-
var ρσ
|
|
25739
|
-
for (var ρσ
|
|
25740
|
-
ρσ_unpack = ρσ
|
|
26237
|
+
var ρσ_Iter157 = ρσ_Iterable(enumerate(self.args));
|
|
26238
|
+
for (var ρσ_Index157 = 0; ρσ_Index157 < ρσ_Iter157.length; ρσ_Index157++) {
|
|
26239
|
+
ρσ_unpack = ρσ_Iter157[ρσ_Index157];
|
|
25741
26240
|
i = ρσ_unpack[0];
|
|
25742
26241
|
a = ρσ_unpack[1];
|
|
25743
26242
|
if (i) {
|
|
@@ -25756,15 +26255,17 @@ return this.__repr__();
|
|
|
25756
26255
|
output.with_parens((function() {
|
|
25757
26256
|
var ρσ_anonfunc = function () {
|
|
25758
26257
|
var ρσ_unpack, i, a;
|
|
25759
|
-
var ρσ
|
|
25760
|
-
for (var ρσ
|
|
25761
|
-
ρσ_unpack = ρσ
|
|
26258
|
+
var ρσ_Iter158 = ρσ_Iterable(enumerate(self.args));
|
|
26259
|
+
for (var ρσ_Index158 = 0; ρσ_Index158 < ρσ_Iter158.length; ρσ_Index158++) {
|
|
26260
|
+
ρσ_unpack = ρσ_Iter158[ρσ_Index158];
|
|
25762
26261
|
i = ρσ_unpack[0];
|
|
25763
26262
|
a = ρσ_unpack[1];
|
|
25764
26263
|
if (i) {
|
|
25765
26264
|
output.comma();
|
|
25766
26265
|
}
|
|
26266
|
+
output.print("ρσ_str(");
|
|
25767
26267
|
a.print(output);
|
|
26268
|
+
output.print(")");
|
|
25768
26269
|
}
|
|
25769
26270
|
};
|
|
25770
26271
|
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
@@ -25808,9 +26309,9 @@ return this.__repr__();
|
|
|
25808
26309
|
compiled_js = inner_os.get().trim();
|
|
25809
26310
|
function _print_extra_args() {
|
|
25810
26311
|
var a;
|
|
25811
|
-
var ρσ
|
|
25812
|
-
for (var ρσ
|
|
25813
|
-
a = ρσ
|
|
26312
|
+
var ρσ_Iter159 = ρσ_Iterable(self.args.slice(1));
|
|
26313
|
+
for (var ρσ_Index159 = 0; ρσ_Index159 < ρσ_Iter159.length; ρσ_Index159++) {
|
|
26314
|
+
a = ρσ_Iter159[ρσ_Index159];
|
|
25814
26315
|
output.comma();
|
|
25815
26316
|
a.print(output);
|
|
25816
26317
|
}
|
|
@@ -25860,9 +26361,9 @@ return this.__repr__();
|
|
|
25860
26361
|
output.with_parens((function() {
|
|
25861
26362
|
var ρσ_anonfunc = function () {
|
|
25862
26363
|
var ρσ_unpack, i, a;
|
|
25863
|
-
var ρσ
|
|
25864
|
-
for (var ρσ
|
|
25865
|
-
ρσ_unpack = ρσ
|
|
26364
|
+
var ρσ_Iter160 = ρσ_Iterable(enumerate(self.args));
|
|
26365
|
+
for (var ρσ_Index160 = 0; ρσ_Index160 < ρσ_Iter160.length; ρσ_Index160++) {
|
|
26366
|
+
ρσ_unpack = ρσ_Iter160[ρσ_Index160];
|
|
25866
26367
|
i = ρσ_unpack[0];
|
|
25867
26368
|
a = ρσ_unpack[1];
|
|
25868
26369
|
if (i) {
|
|
@@ -25879,9 +26380,9 @@ return this.__repr__();
|
|
|
25879
26380
|
} else if (is_node_type(self.expression, AST_SymbolRef) && self.python_truthiness) {
|
|
25880
26381
|
output.print("ρσ_callable_call(");
|
|
25881
26382
|
print_function_name();
|
|
25882
|
-
var ρσ
|
|
25883
|
-
for (var ρσ
|
|
25884
|
-
ρσ_unpack = ρσ
|
|
26383
|
+
var ρσ_Iter161 = ρσ_Iterable(enumerate(self.args));
|
|
26384
|
+
for (var ρσ_Index161 = 0; ρσ_Index161 < ρσ_Iter161.length; ρσ_Index161++) {
|
|
26385
|
+
ρσ_unpack = ρσ_Iter161[ρσ_Index161];
|
|
25885
26386
|
i = ρσ_unpack[0];
|
|
25886
26387
|
a = ρσ_unpack[1];
|
|
25887
26388
|
output.comma();
|
|
@@ -25896,9 +26397,9 @@ return this.__repr__();
|
|
|
25896
26397
|
if (is_node_type(self.expression, AST_Dot) && self.expression.property === "split" && !self.args.length) {
|
|
25897
26398
|
output.print("\" \"");
|
|
25898
26399
|
} else {
|
|
25899
|
-
var ρσ
|
|
25900
|
-
for (var ρσ
|
|
25901
|
-
ρσ_unpack = ρσ
|
|
26400
|
+
var ρσ_Iter162 = ρσ_Iterable(enumerate(self.args));
|
|
26401
|
+
for (var ρσ_Index162 = 0; ρσ_Index162 < ρσ_Iter162.length; ρσ_Index162++) {
|
|
26402
|
+
ρσ_unpack = ρσ_Iter162[ρσ_Index162];
|
|
25902
26403
|
i = ρσ_unpack[0];
|
|
25903
26404
|
a = ρσ_unpack[1];
|
|
25904
26405
|
if (i) {
|
|
@@ -26220,8 +26721,8 @@ return this.__repr__();
|
|
|
26220
26721
|
self.name.print(output);
|
|
26221
26722
|
output.spaced(".ρσ_decorators", "=", "[");
|
|
26222
26723
|
num = decorators.length;
|
|
26223
|
-
for (var ρσ
|
|
26224
|
-
i = ρσ
|
|
26724
|
+
for (var ρσ_Index163 = 0; ρσ_Index163 < num; ρσ_Index163++) {
|
|
26725
|
+
i = ρσ_Index163;
|
|
26225
26726
|
decorators[(typeof i === "number" && i < 0) ? decorators.length + i : i].expression.print(output);
|
|
26226
26727
|
output.spaced((i < num - 1) ? "," : "]");
|
|
26227
26728
|
}
|
|
@@ -26260,9 +26761,9 @@ return this.__repr__();
|
|
|
26260
26761
|
output.end_statement();
|
|
26261
26762
|
}
|
|
26262
26763
|
}
|
|
26263
|
-
var ρσ
|
|
26264
|
-
for (var ρσ
|
|
26265
|
-
bname = ρσ
|
|
26764
|
+
var ρσ_Iter164 = ρσ_Iterable(self.bound);
|
|
26765
|
+
for (var ρσ_Index164 = 0; ρσ_Index164 < ρσ_Iter164.length; ρσ_Index164++) {
|
|
26766
|
+
bname = ρσ_Iter164[ρσ_Index164];
|
|
26266
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]) {
|
|
26267
26768
|
continue;
|
|
26268
26769
|
}
|
|
@@ -26294,9 +26795,9 @@ return this.__repr__();
|
|
|
26294
26795
|
output.with_block((function() {
|
|
26295
26796
|
var ρσ_anonfunc = function () {
|
|
26296
26797
|
var prop, name;
|
|
26297
|
-
var ρσ
|
|
26298
|
-
for (var ρσ
|
|
26299
|
-
name = ρσ
|
|
26798
|
+
var ρσ_Iter165 = ρσ_Iterable(property_names);
|
|
26799
|
+
for (var ρσ_Index165 = 0; ρσ_Index165 < ρσ_Iter165.length; ρσ_Index165++) {
|
|
26800
|
+
name = ρσ_Iter165[ρσ_Index165];
|
|
26300
26801
|
prop = (ρσ_expr_temp = self.dynamic_properties)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name];
|
|
26301
26802
|
[output.indent(), output.print(ρσ_list_add(JSON.stringify(name), ":")), output.space()];
|
|
26302
26803
|
output.with_block((function() {
|
|
@@ -26365,9 +26866,9 @@ return this.__repr__();
|
|
|
26365
26866
|
})());
|
|
26366
26867
|
}
|
|
26367
26868
|
defined_methods = Object.create(null);
|
|
26368
|
-
var ρσ
|
|
26369
|
-
for (var ρσ
|
|
26370
|
-
stmt = ρσ
|
|
26869
|
+
var ρσ_Iter166 = ρσ_Iterable(self.body);
|
|
26870
|
+
for (var ρσ_Index166 = 0; ρσ_Index166 < ρσ_Iter166.length; ρσ_Index166++) {
|
|
26871
|
+
stmt = ρσ_Iter166[ρσ_Index166];
|
|
26371
26872
|
if (is_node_type(stmt, AST_Method)) {
|
|
26372
26873
|
if (stmt.is_getter || stmt.is_setter) {
|
|
26373
26874
|
continue;
|
|
@@ -26376,9 +26877,9 @@ return this.__repr__();
|
|
|
26376
26877
|
defined_methods[ρσ_bound_index(stmt.name.name, defined_methods)] = true;
|
|
26377
26878
|
sname = stmt.name.name;
|
|
26378
26879
|
if (sname === "__init__") {
|
|
26379
|
-
var ρσ
|
|
26380
|
-
for (var ρσ
|
|
26381
|
-
attr = ρσ
|
|
26880
|
+
var ρσ_Iter167 = ρσ_Iterable(ρσ_list_decorate([ ".__argnames__", ".__handles_kwarg_interpolation__" ]));
|
|
26881
|
+
for (var ρσ_Index167 = 0; ρσ_Index167 < ρσ_Iter167.length; ρσ_Index167++) {
|
|
26882
|
+
attr = ρσ_Iter167[ρσ_Index167];
|
|
26382
26883
|
[output.indent(), self.name.print(output), output.assign(attr)];
|
|
26383
26884
|
[self.name.print(output), output.print(ρσ_list_add(".prototype.__init__", attr)),
|
|
26384
26885
|
output.end_statement()];
|
|
@@ -26478,9 +26979,9 @@ return this.__repr__();
|
|
|
26478
26979
|
self.name.print(output);
|
|
26479
26980
|
output.print(".prototype, \"__class__\", {get: function() { return this.constructor; }, configurable: true})");
|
|
26480
26981
|
output.end_statement();
|
|
26481
|
-
var ρσ
|
|
26482
|
-
for (var ρσ
|
|
26483
|
-
stmt = ρσ
|
|
26982
|
+
var ρσ_Iter168 = ρσ_Iterable(self.statements);
|
|
26983
|
+
for (var ρσ_Index168 = 0; ρσ_Index168 < ρσ_Iter168.length; ρσ_Index168++) {
|
|
26984
|
+
stmt = ρσ_Iter168[ρσ_Index168];
|
|
26484
26985
|
if (is_node_type(stmt, AST_Class)) {
|
|
26485
26986
|
output.indent();
|
|
26486
26987
|
stmt.print(output);
|
|
@@ -26501,9 +27002,9 @@ return this.__repr__();
|
|
|
26501
27002
|
}
|
|
26502
27003
|
}
|
|
26503
27004
|
annotated_field_names = ρσ_list_decorate([]);
|
|
26504
|
-
var ρσ
|
|
26505
|
-
for (var ρσ
|
|
26506
|
-
stmt = ρσ
|
|
27005
|
+
var ρσ_Iter169 = ρσ_Iterable(self.statements);
|
|
27006
|
+
for (var ρσ_Index169 = 0; ρσ_Index169 < ρσ_Iter169.length; ρσ_Index169++) {
|
|
27007
|
+
stmt = ρσ_Iter169[ρσ_Index169];
|
|
26507
27008
|
if (is_node_type(stmt, AST_AnnotatedAssign) && is_node_type(stmt.target, AST_SymbolRef)) {
|
|
26508
27009
|
annotated_field_names.push(stmt.target.name);
|
|
26509
27010
|
}
|
|
@@ -26512,8 +27013,8 @@ return this.__repr__();
|
|
|
26512
27013
|
output.indent();
|
|
26513
27014
|
self.name.print(output);
|
|
26514
27015
|
output.print(".__annotations__ = {");
|
|
26515
|
-
for (var ρσ
|
|
26516
|
-
i = ρσ
|
|
27016
|
+
for (var ρσ_Index170 = 0; ρσ_Index170 < annotated_field_names.length; ρσ_Index170++) {
|
|
27017
|
+
i = ρσ_Index170;
|
|
26517
27018
|
if (i > 0) {
|
|
26518
27019
|
output.comma();
|
|
26519
27020
|
}
|
|
@@ -26591,8 +27092,8 @@ return this.__repr__();
|
|
|
26591
27092
|
if (decorators.length) {
|
|
26592
27093
|
output.indent();
|
|
26593
27094
|
output.assign(self.name);
|
|
26594
|
-
for (var ρσ
|
|
26595
|
-
di = ρσ
|
|
27095
|
+
for (var ρσ_Index171 = 0; ρσ_Index171 < decorators.length; ρσ_Index171++) {
|
|
27096
|
+
di = ρσ_Index171;
|
|
26596
27097
|
self.name.print(output);
|
|
26597
27098
|
output.print(ρσ_list_add(ρσ_list_add(".ρσ_decorators[", ρσ_str.format("{}", di)), "]("));
|
|
26598
27099
|
}
|
|
@@ -26636,9 +27137,9 @@ return this.__repr__();
|
|
|
26636
27137
|
if (len_ > 0) {
|
|
26637
27138
|
output.space();
|
|
26638
27139
|
}
|
|
26639
|
-
var ρσ
|
|
26640
|
-
for (var ρσ
|
|
26641
|
-
ρσ_unpack = ρσ
|
|
27140
|
+
var ρσ_Iter172 = ρσ_Iterable(enumerate(a));
|
|
27141
|
+
for (var ρσ_Index172 = 0; ρσ_Index172 < ρσ_Iter172.length; ρσ_Index172++) {
|
|
27142
|
+
ρσ_unpack = ρσ_Iter172[ρσ_Index172];
|
|
26642
27143
|
i = ρσ_unpack[0];
|
|
26643
27144
|
exp = ρσ_unpack[1];
|
|
26644
27145
|
if (i) {
|
|
@@ -26686,9 +27187,9 @@ return this.__repr__();
|
|
|
26686
27187
|
output.spaced("var", "ρσ_d", "=", (self.is_jshash) ? "Object.create(null)" : "{}");
|
|
26687
27188
|
}
|
|
26688
27189
|
output.end_statement();
|
|
26689
|
-
var ρσ
|
|
26690
|
-
for (var ρσ
|
|
26691
|
-
ρσ_unpack = ρσ
|
|
27190
|
+
var ρσ_Iter173 = ρσ_Iterable(enumerate(self.properties));
|
|
27191
|
+
for (var ρσ_Index173 = 0; ρσ_Index173 < ρσ_Iter173.length; ρσ_Index173++) {
|
|
27192
|
+
ρσ_unpack = ρσ_Iter173[ρσ_Index173];
|
|
26692
27193
|
i = ρσ_unpack[0];
|
|
26693
27194
|
prop = ρσ_unpack[1];
|
|
26694
27195
|
output.indent();
|
|
@@ -26792,9 +27293,9 @@ return this.__repr__();
|
|
|
26792
27293
|
function print_set(self, output) {
|
|
26793
27294
|
var has_spread, item;
|
|
26794
27295
|
has_spread = false;
|
|
26795
|
-
var ρσ
|
|
26796
|
-
for (var ρσ
|
|
26797
|
-
item = ρσ
|
|
27296
|
+
var ρσ_Iter174 = ρσ_Iterable(self.items);
|
|
27297
|
+
for (var ρσ_Index174 = 0; ρσ_Index174 < ρσ_Iter174.length; ρσ_Index174++) {
|
|
27298
|
+
item = ρσ_Iter174[ρσ_Index174];
|
|
26798
27299
|
if (is_node_type(item, AST_Spread)) {
|
|
26799
27300
|
has_spread = true;
|
|
26800
27301
|
break;
|
|
@@ -26807,9 +27308,9 @@ return this.__repr__();
|
|
|
26807
27308
|
output.with_square((function() {
|
|
26808
27309
|
var ρσ_anonfunc = function () {
|
|
26809
27310
|
var ρσ_unpack, i, item;
|
|
26810
|
-
var ρσ
|
|
26811
|
-
for (var ρσ
|
|
26812
|
-
ρσ_unpack = ρσ
|
|
27311
|
+
var ρσ_Iter175 = ρσ_Iterable(enumerate(self.items));
|
|
27312
|
+
for (var ρσ_Index175 = 0; ρσ_Index175 < ρσ_Iter175.length; ρσ_Index175++) {
|
|
27313
|
+
ρσ_unpack = ρσ_Iter175[ρσ_Index175];
|
|
26813
27314
|
i = ρσ_unpack[0];
|
|
26814
27315
|
item = ρσ_unpack[1];
|
|
26815
27316
|
if (i) {
|
|
@@ -26849,9 +27350,9 @@ return this.__repr__();
|
|
|
26849
27350
|
output.indent();
|
|
26850
27351
|
output.spaced.apply(output, "var s = ρσ_set()".split(" "));
|
|
26851
27352
|
output.end_statement();
|
|
26852
|
-
var ρσ
|
|
26853
|
-
for (var ρσ
|
|
26854
|
-
item = ρσ
|
|
27353
|
+
var ρσ_Iter176 = ρσ_Iterable(self.items);
|
|
27354
|
+
for (var ρσ_Index176 = 0; ρσ_Index176 < ρσ_Iter176.length; ρσ_Index176++) {
|
|
27355
|
+
item = ρσ_Iter176[ρσ_Index176];
|
|
26855
27356
|
output.indent();
|
|
26856
27357
|
output.print("s.jsset.add");
|
|
26857
27358
|
output.with_parens((function() {
|
|
@@ -26918,9 +27419,9 @@ return this.__repr__();
|
|
|
26918
27419
|
|
|
26919
27420
|
function output_comments(comments, output, nlb) {
|
|
26920
27421
|
var comm;
|
|
26921
|
-
var ρσ
|
|
26922
|
-
for (var ρσ
|
|
26923
|
-
comm = ρσ
|
|
27422
|
+
var ρσ_Iter177 = ρσ_Iterable(comments);
|
|
27423
|
+
for (var ρσ_Index177 = 0; ρσ_Index177 < ρσ_Iter177.length; ρσ_Index177++) {
|
|
27424
|
+
comm = ρσ_Iter177[ρσ_Index177];
|
|
26924
27425
|
if (comm.type === "comment1") {
|
|
26925
27426
|
output.print(ρσ_list_add(ρσ_list_add("//", comm.value), "\n"));
|
|
26926
27427
|
output.indent();
|
|
@@ -27017,9 +27518,9 @@ return this.__repr__();
|
|
|
27017
27518
|
function write_imports(module, output) {
|
|
27018
27519
|
var imports, import_id, nonlocalvars, name, module_, module_id;
|
|
27019
27520
|
imports = ρσ_list_decorate([]);
|
|
27020
|
-
var ρσ
|
|
27021
|
-
for (var ρσ
|
|
27022
|
-
import_id = ρσ
|
|
27521
|
+
var ρσ_Iter178 = ρσ_Iterable(Object.keys(module.imports));
|
|
27522
|
+
for (var ρσ_Index178 = 0; ρσ_Index178 < ρσ_Iter178.length; ρσ_Index178++) {
|
|
27523
|
+
import_id = ρσ_Iter178[ρσ_Index178];
|
|
27023
27524
|
imports.push((ρσ_expr_temp = module.imports)[(typeof import_id === "number" && import_id < 0) ? ρσ_expr_temp.length + import_id : import_id]);
|
|
27024
27525
|
}
|
|
27025
27526
|
imports.jssort((function() {
|
|
@@ -27042,12 +27543,12 @@ return this.__repr__();
|
|
|
27042
27543
|
output.newline();
|
|
27043
27544
|
}
|
|
27044
27545
|
nonlocalvars = Object.create(null);
|
|
27045
|
-
var ρσ
|
|
27046
|
-
for (var ρσ
|
|
27047
|
-
module_ = ρσ
|
|
27048
|
-
var ρσ
|
|
27049
|
-
for (var ρσ
|
|
27050
|
-
name = ρσ
|
|
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];
|
|
27051
27552
|
nonlocalvars[(typeof name === "number" && name < 0) ? nonlocalvars.length + name : name] = true;
|
|
27052
27553
|
}
|
|
27053
27554
|
}
|
|
@@ -27058,9 +27559,9 @@ return this.__repr__();
|
|
|
27058
27559
|
output.semicolon();
|
|
27059
27560
|
output.newline();
|
|
27060
27561
|
}
|
|
27061
|
-
var ρσ
|
|
27062
|
-
for (var ρσ
|
|
27063
|
-
module_ = ρσ
|
|
27562
|
+
var ρσ_Iter181 = ρσ_Iterable(imports);
|
|
27563
|
+
for (var ρσ_Index181 = 0; ρσ_Index181 < ρσ_Iter181.length; ρσ_Index181++) {
|
|
27564
|
+
module_ = ρσ_Iter181[ρσ_Index181];
|
|
27064
27565
|
module_id = module_.module_id;
|
|
27065
27566
|
if (module_id !== "__main__") {
|
|
27066
27567
|
output.indent();
|
|
@@ -27073,9 +27574,9 @@ return this.__repr__();
|
|
|
27073
27574
|
output.end_statement();
|
|
27074
27575
|
}
|
|
27075
27576
|
}
|
|
27076
|
-
var ρσ
|
|
27077
|
-
for (var ρσ
|
|
27078
|
-
module_ = ρσ
|
|
27577
|
+
var ρσ_Iter182 = ρσ_Iterable(imports);
|
|
27578
|
+
for (var ρσ_Index182 = 0; ρσ_Index182 < ρσ_Iter182.length; ρσ_Index182++) {
|
|
27579
|
+
module_ = ρσ_Iter182[ρσ_Index182];
|
|
27079
27580
|
if (module_.module_id !== "__main__") {
|
|
27080
27581
|
print_module(module_, output);
|
|
27081
27582
|
}
|
|
@@ -27125,9 +27626,9 @@ return this.__repr__();
|
|
|
27125
27626
|
output.end_statement();
|
|
27126
27627
|
}
|
|
27127
27628
|
output.newline();
|
|
27128
|
-
var ρσ
|
|
27129
|
-
for (var ρσ
|
|
27130
|
-
symbol = ρσ
|
|
27629
|
+
var ρσ_Iter183 = ρσ_Iterable(exports);
|
|
27630
|
+
for (var ρσ_Index183 = 0; ρσ_Index183 < ρσ_Iter183.length; ρσ_Index183++) {
|
|
27631
|
+
symbol = ρσ_Iter183[ρσ_Index183];
|
|
27131
27632
|
if (!Object.prototype.hasOwnProperty.call(seen, symbol.name)) {
|
|
27132
27633
|
output.indent();
|
|
27133
27634
|
if (module_id.indexOf(".") === -1) {
|
|
@@ -27148,7 +27649,7 @@ return this.__repr__();
|
|
|
27148
27649
|
|
|
27149
27650
|
function _inject_pythonize_strings(output) {
|
|
27150
27651
|
var str_funcs;
|
|
27151
|
-
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(" ");
|
|
27152
27653
|
output.newline();
|
|
27153
27654
|
output.indent();
|
|
27154
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]];})()"));
|
|
@@ -27316,9 +27817,9 @@ return this.__repr__();
|
|
|
27316
27817
|
function filter_body_for_tree_shaking(body, needed) {
|
|
27317
27818
|
var result, name, stmt;
|
|
27318
27819
|
result = ρσ_list_decorate([]);
|
|
27319
|
-
var ρσ
|
|
27320
|
-
for (var ρσ
|
|
27321
|
-
stmt = ρσ
|
|
27820
|
+
var ρσ_Iter184 = ρσ_Iterable(body);
|
|
27821
|
+
for (var ρσ_Index184 = 0; ρσ_Index184 < ρσ_Iter184.length; ρσ_Index184++) {
|
|
27822
|
+
stmt = ρσ_Iter184[ρσ_Index184];
|
|
27322
27823
|
name = get_top_level_name(stmt);
|
|
27323
27824
|
if (name === null || has_prop(needed, name)) {
|
|
27324
27825
|
result.push(stmt);
|
|
@@ -27334,9 +27835,9 @@ return this.__repr__();
|
|
|
27334
27835
|
function filter_exports_for_tree_shaking(exports, needed) {
|
|
27335
27836
|
var result, sym;
|
|
27336
27837
|
result = ρσ_list_decorate([]);
|
|
27337
|
-
var ρσ
|
|
27338
|
-
for (var ρσ
|
|
27339
|
-
sym = ρσ
|
|
27838
|
+
var ρσ_Iter185 = ρσ_Iterable(exports);
|
|
27839
|
+
for (var ρσ_Index185 = 0; ρσ_Index185 < ρσ_Iter185.length; ρσ_Index185++) {
|
|
27840
|
+
sym = ρσ_Iter185[ρσ_Index185];
|
|
27340
27841
|
if (has_prop(needed, sym.name)) {
|
|
27341
27842
|
result.push(sym);
|
|
27342
27843
|
}
|
|
@@ -27407,9 +27908,9 @@ return this.__repr__();
|
|
|
27407
27908
|
ρσ_d["discard_asserts"] = !!output.options.discard_asserts;
|
|
27408
27909
|
return ρσ_d;
|
|
27409
27910
|
}).call(this);
|
|
27410
|
-
var ρσ
|
|
27411
|
-
for (var ρσ
|
|
27412
|
-
cname = ρσ
|
|
27911
|
+
var ρσ_Iter186 = ρσ_Iterable(Object.keys(self.classes));
|
|
27912
|
+
for (var ρσ_Index186 = 0; ρσ_Index186 < ρσ_Iter186.length; ρσ_Index186++) {
|
|
27913
|
+
cname = ρσ_Iter186[ρσ_Index186];
|
|
27413
27914
|
cobj = (ρσ_expr_temp = self.classes)[(typeof cname === "number" && cname < 0) ? ρσ_expr_temp.length + cname : cname];
|
|
27414
27915
|
(ρσ_expr_temp = cached.classes)[(typeof cname === "number" && cname < 0) ? ρσ_expr_temp.length + cname : cname] = (function(){
|
|
27415
27916
|
var ρσ_d = Object.create(null);
|
|
@@ -27424,24 +27925,24 @@ return this.__repr__();
|
|
|
27424
27925
|
return ρσ_d;
|
|
27425
27926
|
}).call(this);
|
|
27426
27927
|
}
|
|
27427
|
-
var ρσ
|
|
27428
|
-
for (var ρσ
|
|
27429
|
-
symdef = ρσ
|
|
27928
|
+
var ρσ_Iter187 = ρσ_Iterable(self.exports);
|
|
27929
|
+
for (var ρσ_Index187 = 0; ρσ_Index187 < ρσ_Iter187.length; ρσ_Index187++) {
|
|
27930
|
+
symdef = ρσ_Iter187[ρσ_Index187];
|
|
27430
27931
|
cached.exports.push((function(){
|
|
27431
27932
|
var ρσ_d = Object.create(null);
|
|
27432
27933
|
ρσ_d["name"] = symdef.name;
|
|
27433
27934
|
return ρσ_d;
|
|
27434
27935
|
}).call(this));
|
|
27435
27936
|
}
|
|
27436
|
-
var ρσ
|
|
27437
|
-
for (var ρσ
|
|
27438
|
-
beautify = ρσ
|
|
27439
|
-
var ρσ
|
|
27440
|
-
for (var ρσ
|
|
27441
|
-
keep_docstrings = ρσ
|
|
27442
|
-
var ρσ
|
|
27443
|
-
for (var ρσ
|
|
27444
|
-
js_version = ρσ
|
|
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];
|
|
27445
27946
|
co = new OutputStream((function(){
|
|
27446
27947
|
var ρσ_d = Object.create(null);
|
|
27447
27948
|
ρσ_d["beautify"] = beautify;
|
|
@@ -27528,13 +28029,13 @@ return this.__repr__();
|
|
|
27528
28029
|
__module__ : {value: "output.modules"}
|
|
27529
28030
|
});
|
|
27530
28031
|
|
|
27531
|
-
var ρσ
|
|
27532
|
-
for (var ρσ
|
|
27533
|
-
self = ρσ
|
|
28032
|
+
var ρσ_Iter191 = ρσ_Iterable(container.imports);
|
|
28033
|
+
for (var ρσ_Index191 = 0; ρσ_Index191 < ρσ_Iter191.length; ρσ_Index191++) {
|
|
28034
|
+
self = ρσ_Iter191[ρσ_Index191];
|
|
27534
28035
|
if (self.argnames) {
|
|
27535
|
-
var ρσ
|
|
27536
|
-
for (var ρσ
|
|
27537
|
-
argname = ρσ
|
|
28036
|
+
var ρσ_Iter192 = ρσ_Iterable(self.argnames);
|
|
28037
|
+
for (var ρσ_Index192 = 0; ρσ_Index192 < ρσ_Iter192.length; ρσ_Index192++) {
|
|
28038
|
+
argname = ρσ_Iter192[ρσ_Index192];
|
|
27538
28039
|
akey = (argname.alias) ? argname.alias.name : argname.name;
|
|
27539
28040
|
add_aname(akey, self.key, argname.name);
|
|
27540
28041
|
}
|
|
@@ -27543,9 +28044,9 @@ return this.__repr__();
|
|
|
27543
28044
|
add_aname(self.alias.name, self.key, false);
|
|
27544
28045
|
} else {
|
|
27545
28046
|
parts = self.key.split(".");
|
|
27546
|
-
var ρσ
|
|
27547
|
-
for (var ρσ
|
|
27548
|
-
ρσ_unpack = ρσ
|
|
28047
|
+
var ρσ_Iter193 = ρσ_Iterable(enumerate(parts));
|
|
28048
|
+
for (var ρσ_Index193 = 0; ρσ_Index193 < ρσ_Iter193.length; ρσ_Index193++) {
|
|
28049
|
+
ρσ_unpack = ρσ_Iter193[ρσ_Index193];
|
|
27549
28050
|
i = ρσ_unpack[0];
|
|
27550
28051
|
part = ρσ_unpack[1];
|
|
27551
28052
|
if (i === 0) {
|
|
@@ -27651,15 +28152,15 @@ return this.__repr__();
|
|
|
27651
28152
|
var lines, last_non_empty, i, result, line, is_first, is_last;
|
|
27652
28153
|
lines = text.split("\n");
|
|
27653
28154
|
last_non_empty = -1;
|
|
27654
|
-
for (var ρσ
|
|
27655
|
-
i = ρσ
|
|
28155
|
+
for (var ρσ_Index194 = 0; ρσ_Index194 < lines.length; ρσ_Index194++) {
|
|
28156
|
+
i = ρσ_Index194;
|
|
27656
28157
|
if (/[^ \t]/.test(lines[(typeof i === "number" && i < 0) ? lines.length + i : i])) {
|
|
27657
28158
|
last_non_empty = i;
|
|
27658
28159
|
}
|
|
27659
28160
|
}
|
|
27660
28161
|
result = "";
|
|
27661
|
-
for (var ρσ
|
|
27662
|
-
i = ρσ
|
|
28162
|
+
for (var ρσ_Index195 = 0; ρσ_Index195 < lines.length; ρσ_Index195++) {
|
|
28163
|
+
i = ρσ_Index195;
|
|
27663
28164
|
line = lines[(typeof i === "number" && i < 0) ? lines.length + i : i].replace(/\t/g, " ");
|
|
27664
28165
|
is_first = i === 0;
|
|
27665
28166
|
is_last = i === lines.length - 1;
|
|
@@ -27717,9 +28218,9 @@ return this.__repr__();
|
|
|
27717
28218
|
}
|
|
27718
28219
|
output.print("{");
|
|
27719
28220
|
first = true;
|
|
27720
|
-
var ρσ
|
|
27721
|
-
for (var ρσ
|
|
27722
|
-
prop = ρσ
|
|
28221
|
+
var ρσ_Iter196 = ρσ_Iterable(props);
|
|
28222
|
+
for (var ρσ_Index196 = 0; ρσ_Index196 < ρσ_Iter196.length; ρσ_Index196++) {
|
|
28223
|
+
prop = ρσ_Iter196[ρσ_Index196];
|
|
27723
28224
|
if (!first) {
|
|
27724
28225
|
output.print(", ");
|
|
27725
28226
|
}
|
|
@@ -27754,9 +28255,9 @@ return this.__repr__();
|
|
|
27754
28255
|
|
|
27755
28256
|
function _print_children(children, output) {
|
|
27756
28257
|
var text, child;
|
|
27757
|
-
var ρσ
|
|
27758
|
-
for (var ρσ
|
|
27759
|
-
child = ρσ
|
|
28258
|
+
var ρσ_Iter197 = ρσ_Iterable(children);
|
|
28259
|
+
for (var ρσ_Index197 = 0; ρσ_Index197 < ρσ_Iter197.length; ρσ_Index197++) {
|
|
28260
|
+
child = ρσ_Iter197[ρσ_Index197];
|
|
27760
28261
|
if (is_node_type(child, AST_JSXText)) {
|
|
27761
28262
|
text = _process_jsx_text(child.value);
|
|
27762
28263
|
if (text) {
|
|
@@ -28362,9 +28863,9 @@ return this.__repr__();
|
|
|
28362
28863
|
output.with_block((function() {
|
|
28363
28864
|
var ρσ_anonfunc = function () {
|
|
28364
28865
|
var stmt;
|
|
28365
|
-
var ρσ
|
|
28366
|
-
for (var ρσ
|
|
28367
|
-
stmt = ρσ
|
|
28866
|
+
var ρσ_Iter198 = ρσ_Iterable(self.body.body);
|
|
28867
|
+
for (var ρσ_Index198 = 0; ρσ_Index198 < ρσ_Iter198.length; ρσ_Index198++) {
|
|
28868
|
+
stmt = ρσ_Iter198[ρσ_Index198];
|
|
28368
28869
|
output.indent();
|
|
28369
28870
|
stmt.print(output);
|
|
28370
28871
|
output.newline();
|
|
@@ -28638,9 +29139,9 @@ return this.__repr__();
|
|
|
28638
29139
|
var ρσ_unpack, i, def_, p, in_for, avoid_semicolon;
|
|
28639
29140
|
output.print(kind);
|
|
28640
29141
|
output.space();
|
|
28641
|
-
var ρσ
|
|
28642
|
-
for (var ρσ
|
|
28643
|
-
ρσ_unpack = ρσ
|
|
29142
|
+
var ρσ_Iter199 = ρσ_Iterable(enumerate(this.definitions));
|
|
29143
|
+
for (var ρσ_Index199 = 0; ρσ_Index199 < ρσ_Iter199.length; ρσ_Index199++) {
|
|
29144
|
+
ρσ_unpack = ρσ_Iter199[ρσ_Index199];
|
|
28644
29145
|
i = ρσ_unpack[0];
|
|
28645
29146
|
def_ = ρσ_unpack[1];
|
|
28646
29147
|
if (i) {
|
|
@@ -28983,17 +29484,17 @@ return this.__repr__();
|
|
|
28983
29484
|
var nonlocal_set, nv, name_map, unnamed_stmts, name, stmt, top_level_set, needed, queue, always_refs, ref_name, current, refs;
|
|
28984
29485
|
nonlocal_set = Object.create(null);
|
|
28985
29486
|
if (nonlocalvars) {
|
|
28986
|
-
var ρσ
|
|
28987
|
-
for (var ρσ
|
|
28988
|
-
nv = ρσ
|
|
29487
|
+
var ρσ_Iter200 = ρσ_Iterable(nonlocalvars);
|
|
29488
|
+
for (var ρσ_Index200 = 0; ρσ_Index200 < ρσ_Iter200.length; ρσ_Index200++) {
|
|
29489
|
+
nv = ρσ_Iter200[ρσ_Index200];
|
|
28989
29490
|
nonlocal_set[(typeof nv === "number" && nv < 0) ? nonlocal_set.length + nv : nv] = true;
|
|
28990
29491
|
}
|
|
28991
29492
|
}
|
|
28992
29493
|
name_map = Object.create(null);
|
|
28993
29494
|
unnamed_stmts = ρσ_list_decorate([]);
|
|
28994
|
-
var ρσ
|
|
28995
|
-
for (var ρσ
|
|
28996
|
-
stmt = ρσ
|
|
29495
|
+
var ρσ_Iter201 = ρσ_Iterable(body);
|
|
29496
|
+
for (var ρσ_Index201 = 0; ρσ_Index201 < ρσ_Iter201.length; ρσ_Index201++) {
|
|
29497
|
+
stmt = ρσ_Iter201[ρσ_Index201];
|
|
28997
29498
|
name = get_top_level_name(stmt);
|
|
28998
29499
|
if (name !== null) {
|
|
28999
29500
|
name_map[(typeof name === "number" && name < 0) ? name_map.length + name : name] = stmt;
|
|
@@ -29002,38 +29503,38 @@ return this.__repr__();
|
|
|
29002
29503
|
}
|
|
29003
29504
|
}
|
|
29004
29505
|
top_level_set = Object.create(null);
|
|
29005
|
-
var ρσ
|
|
29006
|
-
for (var ρσ
|
|
29007
|
-
name = ρσ
|
|
29506
|
+
var ρσ_Iter202 = ρσ_Iterable(Object.keys(name_map));
|
|
29507
|
+
for (var ρσ_Index202 = 0; ρσ_Index202 < ρσ_Iter202.length; ρσ_Index202++) {
|
|
29508
|
+
name = ρσ_Iter202[ρσ_Index202];
|
|
29008
29509
|
top_level_set[(typeof name === "number" && name < 0) ? top_level_set.length + name : name] = true;
|
|
29009
29510
|
}
|
|
29010
29511
|
needed = Object.create(null);
|
|
29011
29512
|
queue = ρσ_list_decorate([]);
|
|
29012
|
-
var ρσ
|
|
29013
|
-
for (var ρσ
|
|
29014
|
-
name = ρσ
|
|
29513
|
+
var ρσ_Iter203 = ρσ_Iterable(Object.keys(name_map));
|
|
29514
|
+
for (var ρσ_Index203 = 0; ρσ_Index203 < ρσ_Iter203.length; ρσ_Index203++) {
|
|
29515
|
+
name = ρσ_Iter203[ρσ_Index203];
|
|
29015
29516
|
if (has_prop(nonlocal_set, name)) {
|
|
29016
29517
|
needed[(typeof name === "number" && name < 0) ? needed.length + name : name] = true;
|
|
29017
29518
|
queue.push(name);
|
|
29018
29519
|
}
|
|
29019
29520
|
}
|
|
29020
|
-
var ρσ
|
|
29021
|
-
for (var ρσ
|
|
29022
|
-
name = ρσ
|
|
29521
|
+
var ρσ_Iter204 = ρσ_Iterable(Object.keys(direct_names));
|
|
29522
|
+
for (var ρσ_Index204 = 0; ρσ_Index204 < ρσ_Iter204.length; ρσ_Index204++) {
|
|
29523
|
+
name = ρσ_Iter204[ρσ_Index204];
|
|
29023
29524
|
if (!has_prop(needed, name)) {
|
|
29024
29525
|
needed[(typeof name === "number" && name < 0) ? needed.length + name : name] = true;
|
|
29025
29526
|
queue.push(name);
|
|
29026
29527
|
}
|
|
29027
29528
|
}
|
|
29028
29529
|
always_refs = Object.create(null);
|
|
29029
|
-
var ρσ
|
|
29030
|
-
for (var ρσ
|
|
29031
|
-
stmt = ρσ
|
|
29530
|
+
var ρσ_Iter205 = ρσ_Iterable(unnamed_stmts);
|
|
29531
|
+
for (var ρσ_Index205 = 0; ρσ_Index205 < ρσ_Iter205.length; ρσ_Index205++) {
|
|
29532
|
+
stmt = ρσ_Iter205[ρσ_Index205];
|
|
29032
29533
|
collect_refs_in_node(stmt, top_level_set, always_refs);
|
|
29033
29534
|
}
|
|
29034
|
-
var ρσ
|
|
29035
|
-
for (var ρσ
|
|
29036
|
-
ref_name = ρσ
|
|
29535
|
+
var ρσ_Iter206 = ρσ_Iterable(Object.keys(always_refs));
|
|
29536
|
+
for (var ρσ_Index206 = 0; ρσ_Index206 < ρσ_Iter206.length; ρσ_Index206++) {
|
|
29537
|
+
ref_name = ρσ_Iter206[ρσ_Index206];
|
|
29037
29538
|
if (!has_prop(needed, ref_name)) {
|
|
29038
29539
|
needed[(typeof ref_name === "number" && ref_name < 0) ? needed.length + ref_name : ref_name] = true;
|
|
29039
29540
|
queue.push(ref_name);
|
|
@@ -29046,9 +29547,9 @@ return this.__repr__();
|
|
|
29046
29547
|
}
|
|
29047
29548
|
refs = Object.create(null);
|
|
29048
29549
|
collect_refs_in_node(name_map[(typeof current === "number" && current < 0) ? name_map.length + current : current], top_level_set, refs);
|
|
29049
|
-
var ρσ
|
|
29050
|
-
for (var ρσ
|
|
29051
|
-
ref_name = ρσ
|
|
29550
|
+
var ρσ_Iter207 = ρσ_Iterable(Object.keys(refs));
|
|
29551
|
+
for (var ρσ_Index207 = 0; ρσ_Index207 < ρσ_Iter207.length; ρσ_Index207++) {
|
|
29552
|
+
ref_name = ρσ_Iter207[ρσ_Index207];
|
|
29052
29553
|
if (!has_prop(needed, ref_name)) {
|
|
29053
29554
|
needed[(typeof ref_name === "number" && ref_name < 0) ? needed.length + ref_name : ref_name] = true;
|
|
29054
29555
|
queue.push(ref_name);
|
|
@@ -29085,9 +29586,9 @@ return this.__repr__();
|
|
|
29085
29586
|
__module__ : {value: "output.treeshake"}
|
|
29086
29587
|
});
|
|
29087
29588
|
|
|
29088
|
-
var ρσ
|
|
29089
|
-
for (var ρσ
|
|
29090
|
-
stmt = ρσ
|
|
29589
|
+
var ρσ_Iter208 = ρσ_Iterable(main_body);
|
|
29590
|
+
for (var ρσ_Index208 = 0; ρσ_Index208 < ρσ_Iter208.length; ρσ_Index208++) {
|
|
29591
|
+
stmt = ρσ_Iter208[ρσ_Index208];
|
|
29091
29592
|
stmt.walk(new TreeWalker(visit_fn));
|
|
29092
29593
|
}
|
|
29093
29594
|
};
|
|
@@ -29102,9 +29603,9 @@ return this.__repr__();
|
|
|
29102
29603
|
function visit_from_imports(node, descend) {
|
|
29103
29604
|
var key, argname, imp;
|
|
29104
29605
|
if (is_node_type(node, AST_Imports)) {
|
|
29105
|
-
var ρσ
|
|
29106
|
-
for (var ρσ
|
|
29107
|
-
imp = ρσ
|
|
29606
|
+
var ρσ_Iter209 = ρσ_Iterable(node.imports);
|
|
29607
|
+
for (var ρσ_Index209 = 0; ρσ_Index209 < ρσ_Iter209.length; ρσ_Index209++) {
|
|
29608
|
+
imp = ρσ_Iter209[ρσ_Index209];
|
|
29108
29609
|
if (imp.argnames) {
|
|
29109
29610
|
key = imp.key;
|
|
29110
29611
|
if (!has_prop(result, key)) {
|
|
@@ -29115,9 +29616,9 @@ return this.__repr__();
|
|
|
29115
29616
|
return ρσ_d;
|
|
29116
29617
|
}).call(this);
|
|
29117
29618
|
}
|
|
29118
|
-
var ρσ
|
|
29119
|
-
for (var ρσ
|
|
29120
|
-
argname = ρσ
|
|
29619
|
+
var ρσ_Iter210 = ρσ_Iterable(imp.argnames);
|
|
29620
|
+
for (var ρσ_Index210 = 0; ρσ_Index210 < ρσ_Iter210.length; ρσ_Index210++) {
|
|
29621
|
+
argname = ρσ_Iter210[ρσ_Index210];
|
|
29121
29622
|
(ρσ_expr_temp = result[(typeof key === "number" && key < 0) ? result.length + key : key].direct_names)[ρσ_bound_index(argname.name, ρσ_expr_temp)] = true;
|
|
29122
29623
|
}
|
|
29123
29624
|
}
|
|
@@ -29129,20 +29630,20 @@ return this.__repr__();
|
|
|
29129
29630
|
__module__ : {value: "output.treeshake"}
|
|
29130
29631
|
});
|
|
29131
29632
|
|
|
29132
|
-
var ρσ
|
|
29133
|
-
for (var ρσ
|
|
29134
|
-
stmt = ρσ
|
|
29633
|
+
var ρσ_Iter211 = ρσ_Iterable(main_body);
|
|
29634
|
+
for (var ρσ_Index211 = 0; ρσ_Index211 < ρσ_Iter211.length; ρσ_Index211++) {
|
|
29635
|
+
stmt = ρσ_Iter211[ρσ_Index211];
|
|
29135
29636
|
stmt.walk(new TreeWalker(visit_from_imports));
|
|
29136
29637
|
}
|
|
29137
|
-
var ρσ
|
|
29138
|
-
for (var ρσ
|
|
29139
|
-
stmt = ρσ
|
|
29638
|
+
var ρσ_Iter212 = ρσ_Iterable(main_body);
|
|
29639
|
+
for (var ρσ_Index212 = 0; ρσ_Index212 < ρσ_Iter212.length; ρσ_Index212++) {
|
|
29640
|
+
stmt = ρσ_Iter212[ρσ_Index212];
|
|
29140
29641
|
if (!is_node_type(stmt, AST_Imports)) {
|
|
29141
29642
|
continue;
|
|
29142
29643
|
}
|
|
29143
|
-
var ρσ
|
|
29144
|
-
for (var ρσ
|
|
29145
|
-
imp = ρσ
|
|
29644
|
+
var ρσ_Iter213 = ρσ_Iterable(stmt.imports);
|
|
29645
|
+
for (var ρσ_Index213 = 0; ρσ_Index213 < ρσ_Iter213.length; ρσ_Index213++) {
|
|
29646
|
+
imp = ρσ_Iter213[ρσ_Index213];
|
|
29146
29647
|
if (imp.argnames) {
|
|
29147
29648
|
continue;
|
|
29148
29649
|
}
|
|
@@ -29182,9 +29683,9 @@ return this.__repr__();
|
|
|
29182
29683
|
function tree_shake(ast, context) {
|
|
29183
29684
|
var import_infos, info, mod, parsed, needed, mod_key;
|
|
29184
29685
|
import_infos = analyze_imports(ast.body);
|
|
29185
|
-
var ρσ
|
|
29186
|
-
for (var ρσ
|
|
29187
|
-
mod_key = ρσ
|
|
29686
|
+
var ρσ_Iter214 = ρσ_Iterable(Object.keys(import_infos));
|
|
29687
|
+
for (var ρσ_Index214 = 0; ρσ_Index214 < ρσ_Iter214.length; ρσ_Index214++) {
|
|
29688
|
+
mod_key = ρσ_Iter214[ρσ_Index214];
|
|
29188
29689
|
info = import_infos[(typeof mod_key === "number" && mod_key < 0) ? import_infos.length + mod_key : mod_key];
|
|
29189
29690
|
if (!info.can_tree_shake) {
|
|
29190
29691
|
continue;
|
|
@@ -29271,9 +29772,9 @@ return this.__repr__();
|
|
|
29271
29772
|
exports.tokenizer = tokenizer;
|
|
29272
29773
|
exports.tree_shake = tree_shake;
|
|
29273
29774
|
ast = ρσ_modules["ast"];
|
|
29274
|
-
var ρσ
|
|
29275
|
-
for (var ρσ
|
|
29276
|
-
ast_node = ρσ
|
|
29775
|
+
var ρσ_Iter215 = ρσ_Iterable(ast);
|
|
29776
|
+
for (var ρσ_Index215 = 0; ρσ_Index215 < ρσ_Iter215.length; ρσ_Index215++) {
|
|
29777
|
+
ast_node = ρσ_Iter215[ρσ_Index215];
|
|
29277
29778
|
if (ast_node.substr(0, 4) === "AST_") {
|
|
29278
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];
|
|
29279
29780
|
}
|