eliscript 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -8
- package/bootstrap/compiler/emitter.eli +161 -63
- package/bootstrap/host/check-cli.mjs +0 -1
- package/bootstrap/host/check-cli.mjs.map +1 -1
- package/bootstrap/host/compiler-session.eli +2 -1
- package/bootstrap/host/eliscript-cli.mjs +2 -9
- package/bootstrap/host/eliscript-cli.mjs.map +1 -1
- package/bootstrap/host/project-cli.mjs +1 -11
- package/bootstrap/host/project-cli.mjs.map +1 -1
- package/bootstrap/host/project.mjs +2 -8
- package/bootstrap/host/project.mjs.map +1 -1
- package/browser/README.md +1 -1
- package/compiler/README.md +2 -2
- package/compiler/eliscript-emitter.el +229 -85
- package/compiler/eliscript-ir-emitter.el +64 -34
- package/compiler/eliscript-project.el +20 -5
- package/dist/backends/async.mjs +1 -90
- package/dist/backends/async.mjs.map +1 -1
- package/dist/backends/binary.mjs +1 -91
- package/dist/backends/binary.mjs.map +1 -1
- package/dist/backends/capabilities.mjs +1 -90
- package/dist/backends/capabilities.mjs.map +1 -1
- package/dist/backends/elf.mjs +1 -90
- package/dist/backends/elf.mjs.map +1 -1
- package/dist/backends/managed.mjs +1 -94
- package/dist/backends/managed.mjs.map +1 -1
- package/dist/backends/memory.mjs +1 -90
- package/dist/backends/memory.mjs.map +1 -1
- package/dist/backends/native.mjs +1 -91
- package/dist/backends/native.mjs.map +1 -1
- package/dist/backends/numeric.mjs +1 -90
- package/dist/backends/numeric.mjs.map +1 -1
- package/dist/backends/optimize.mjs +1 -90
- package/dist/backends/optimize.mjs.map +1 -1
- package/dist/backends/regexp.mjs +1 -91
- package/dist/backends/regexp.mjs.map +1 -1
- package/dist/backends/sha256.mjs +2 -96
- package/dist/backends/sha256.mjs.map +1 -1
- package/dist/backends/wasm.mjs +1 -90
- package/dist/backends/wasm.mjs.map +1 -1
- package/dist/bootstrap/analyzer.mjs +1 -95
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +1 -105
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +848 -807
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +1 -96
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/formatter.mjs +1 -104
- package/dist/bootstrap/formatter.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +18 -172
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/lower.mjs +1 -92
- package/dist/bootstrap/lower.mjs.map +1 -1
- package/dist/bootstrap/project.mjs +23 -209
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +1 -96
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/source-map.mjs +7 -112
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/symbol.mjs +7 -114
- package/dist/bootstrap/symbol.mjs.map +1 -1
- package/dist/bootstrap/syntax.mjs +10 -176
- package/dist/bootstrap/syntax.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +1 -93
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +105 -104
- package/dist/browser/loader.js +1 -1
- package/dist/browser/loader.mjs +5 -124
- package/dist/compiler-artifact.json +1 -1
- package/dist/host/compiler-session.mjs +205 -297
- package/dist/host/compiler-session.mjs.map +1 -1
- package/dist/host/compiler-tools.mjs +1 -91
- package/dist/host/compiler-tools.mjs.map +1 -1
- package/dist/literal-sources/runtime/core/order.eli +32 -10
- package/dist/literal-sources/runtime/core/sequence.eli +69 -28
- package/dist/literal-sources/runtime/core/vector.eli +2 -4
- package/dist/literal-sources/stdlib/managed-literal-protocols.eli +5 -5
- package/dist/literal-sources/stdlib/managed-literals.eli +1 -1
- package/dist/package.json +1 -0
- package/dist/runtime/math.mjs +62 -252
- package/dist/runtime/math.mjs.map +1 -1
- package/dist/runtime/prelude.mjs +95 -0
- package/dist/runtime/prelude.mjs.macro-origins.json +1 -0
- package/dist/runtime/prelude.mjs.map +1 -0
- package/dist/runtime/unicode-case-data.mjs +1 -95
- package/dist/runtime/unicode-case-data.mjs.map +1 -1
- package/dist/runtime/unicode-case.mjs +3 -97
- package/dist/runtime/unicode-case.mjs.map +1 -1
- package/dist/stage3-release.json +1 -1
- package/editor/README.md +9 -4
- package/editor/eliscript-compat.el +164 -2
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-repl.el +1 -1
- package/package.json +2 -1
- package/runtime/README.md +21 -1
- package/runtime/core/protocol-impl.mjs +1 -115
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/text-impl.mjs +1 -90
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/vector.eli +1 -1
- package/runtime/core/vector.mjs +0 -9
- package/runtime/emacs-compat.eli +5957 -2
- package/runtime/emacs-compat.mjs +13522 -2295
- package/runtime/emacs-compat.mjs.map +1 -0
- package/runtime/math.mjs +62 -252
- package/runtime/math.mjs.map +1 -1
- package/runtime/prelude.eli +4 -0
- package/runtime/prelude.mjs +95 -0
- package/runtime/prelude.mjs.map +1 -0
- package/runtime/unicode-case-data.mjs +1 -95
- package/runtime/unicode-case-data.mjs.map +1 -1
- package/runtime/unicode-case.mjs +3 -97
- package/runtime/unicode-case.mjs.map +1 -1
- package/stdlib/managed-literals.eli +1 -1
- package/stdlib/managed-runtime-vector.eli +2 -4
- package/tools/backends/compiler-build.mjs +3 -93
- package/tools/backends/compiler-cli.mjs +2 -15
- package/tools/backends/compiler-corpus-bit.mjs +2 -95
- package/tools/backends/compiler-corpus-cli-adapters.mjs +1 -97
- package/tools/backends/compiler-corpus-debugging.mjs +2 -95
- package/tools/backends/compiler-corpus-emitter.mjs +1 -97
- package/tools/backends/compiler-corpus-execution.mjs +2 -108
- package/tools/backends/compiler-corpus-fuzz.mjs +2 -95
- package/tools/backends/compiler-corpus-host-context.mjs +2 -99
- package/tools/backends/compiler-corpus-identity-host.mjs +18 -123
- package/tools/backends/compiler-corpus-identity-value-adapters.mjs +0 -9
- package/tools/backends/compiler-corpus-literal-provider.mjs +1 -91
- package/tools/backends/compiler-corpus-managed-adapters.mjs +1 -99
- package/tools/backends/compiler-corpus-managed-fixtures.mjs +2 -113
- package/tools/backends/compiler-corpus-matchers.mjs +3 -106
- package/tools/backends/compiler-corpus-original-program.mjs +1 -91
- package/tools/backends/compiler-corpus-process.mjs +1 -92
- package/tools/backends/compiler-corpus-program-driver.mjs +1 -3
- package/tools/backends/compiler-corpus-project-adapters.mjs +1 -95
- package/tools/backends/compiler-corpus-project-entry-host.mjs +2 -92
- package/tools/backends/compiler-corpus-project-transport.mjs +1 -90
- package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1 -91
- package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1 -92
- package/tools/backends/compiler-corpus-raw-math-fixture.mjs +1 -91
- package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +1 -91
- package/tools/backends/compiler-corpus-reference.mjs +1 -90
- package/tools/backends/compiler-corpus-runtime-adapters.mjs +2 -110
- package/tools/backends/compiler-corpus-tools-cli.mjs +1 -95
- package/tools/backends/compiler-corpus-tools-reference.mjs +22 -163
- package/tools/backends/compiler-corpus.mjs +3 -125
- package/tools/backends/compiler-matrix.mjs +1 -92
- package/tools/backends/compiler-package-browser.mjs +1 -90
- package/tools/backends/compiler-package.mjs +3 -95
- package/tools/backends/compiler-unicode-profile-host.mjs +1 -91
- package/tools/backends/dist/bootstrap-js-stages.mjs +1 -91
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs +1 -91
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
- package/tools/backends/dist/record-grid.mjs +1 -91
- package/tools/backends/dist/record-grid.mjs.map +1 -1
- package/tools/backends/dist/release-cli.mjs +4 -94
- package/tools/backends/dist/release-cli.mjs.map +1 -1
- package/tools/backends/dist/run-artifact.mjs +1 -91
- package/tools/backends/dist/run-artifact.mjs.map +1 -1
- package/tools/backends/eliscript/compiler-corpus-bit.eli +1 -0
- package/tools/backends/managed-foreign-binding.mjs +1 -95
- package/tools/backends/managed-host-lifecycle.mjs +1 -91
- package/tools/backends/managed-host-object-provider.mjs +18 -59
- package/tools/backends/managed-host-object-realm.mjs +1 -91
- package/tools/backends/managed-host-proxy.mjs +9 -18
- package/tools/backends/managed-host-runtime.mjs +3 -105
- package/tools/backends/managed-host.mjs +1 -104
- package/tools/backends/managed-module-graph.mjs +1 -97
- package/tools/backends/managed-runtime.mjs +1 -96
- package/tools/backends/managed-source-view.mjs +13 -108
- package/tools/backends/native-managed-runtime.mjs +1 -91
- package/tools/backends/native-memory.mjs +1 -91
- package/tools/backends/stage3-targets.mjs +1 -91
- package/tools/bootstrap-runtime.el +3 -2
- package/tools/project/project.eli +1 -1
- package/tools/testing/stdlib-bit-corpus-host.mjs +1 -90
- package/tools/testing/stdlib-bit.mjs +1 -90
- package/dist/bootstrap/package.json +0 -1
- package/dist/bootstrap/runtime/math.mjs +0 -1117
- package/dist/bootstrap/runtime/math.mjs.map +0 -1
- package/dist/bootstrap/runtime/unicode-case-data.mjs +0 -10125
- package/dist/bootstrap/runtime/unicode-case-data.mjs.map +0 -1
- package/dist/bootstrap/runtime/unicode-case.mjs +0 -281
- package/dist/bootstrap/runtime/unicode-case.mjs.map +0 -1
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
|
|
3
3
|
var __eliscript_tdz_ready_0;
|
|
4
4
|
function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("host_literal_prototype"); return host_literal_prototype; }
|
|
5
|
-
function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("host_literal_prototype"); return __eliscript_const_error(); }
|
|
6
5
|
var __eliscript_tdz_ready_1;
|
|
7
6
|
function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("source_boundaries"); return source_boundaries; }
|
|
8
|
-
function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("source_boundaries"); return __eliscript_const_error(); }
|
|
9
7
|
var __eliscript_tdz_ready_2;
|
|
10
8
|
function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("decode_realms"); return decode_realms; }
|
|
11
|
-
function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("decode_realms"); return __eliscript_const_error(); }
|
|
12
9
|
var __eliscript_tdz_ready_3;
|
|
13
10
|
function __eliscript_tdz_read_3() { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("current_boundary"); return current_boundary; }
|
|
14
11
|
function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("current_boundary"); return (current_boundary = __eliscript_tdz_value_3); }
|
|
@@ -26,103 +23,11 @@ function __eliscript_tdz_read_7() { if (__eliscript_tdz_ready_7 !== true) __elis
|
|
|
26
23
|
function __eliscript_tdz_write_7(__eliscript_tdz_value_7) { if (__eliscript_tdz_ready_7 !== true) __eliscript_tdz_error("current_source_realm"); return (current_source_realm = __eliscript_tdz_value_7); }
|
|
27
24
|
var __eliscript_tdz_ready_8;
|
|
28
25
|
function __eliscript_tdz_read_8() { if (__eliscript_tdz_ready_8 !== true) __eliscript_tdz_error("decoded_source_records"); return decoded_source_records; }
|
|
29
|
-
function __eliscript_tdz_write_8(__eliscript_tdz_value_8) { if (__eliscript_tdz_ready_8 !== true) __eliscript_tdz_error("decoded_source_records"); return __eliscript_const_error(); }
|
|
30
26
|
var __eliscript_tdz_ready_9;
|
|
31
27
|
function __eliscript_tdz_read_9() { if (__eliscript_tdz_ready_9 !== true) __eliscript_tdz_error("decoded_source_handler"); return decoded_source_handler; }
|
|
32
|
-
function __eliscript_tdz_write_9(__eliscript_tdz_value_9) { if (__eliscript_tdz_ready_9 !== true) __eliscript_tdz_error("decoded_source_handler"); return __eliscript_const_error(); }
|
|
33
28
|
import "eliscript/runtime/unicode-case.mjs";
|
|
34
|
-
import {
|
|
29
|
+
import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
|
|
35
30
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
36
|
-
const __eliscript_number_intrinsic = globalThis.Number;
|
|
37
|
-
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
38
|
-
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
39
|
-
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
40
|
-
const __eliscript_numeric_error = globalThis.TypeError;
|
|
41
|
-
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
42
|
-
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
43
|
-
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
44
|
-
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
45
|
-
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
46
|
-
const __eliscript_numeric_primitive = (value) => {
|
|
47
|
-
if (!__eliscript_numeric_object(value)) return value;
|
|
48
|
-
const exotic = value[__eliscript_numeric_symbol];
|
|
49
|
-
if (exotic !== void 0 && exotic !== null) {
|
|
50
|
-
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
51
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
52
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
53
|
-
}
|
|
54
|
-
for (let index = 0; index < 2; index++) {
|
|
55
|
-
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
56
|
-
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
57
|
-
const result = __eliscript_numeric_apply(method, value, []);
|
|
58
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
62
|
-
};
|
|
63
|
-
const __eliscript_to_number = (value) => {
|
|
64
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
65
|
-
if (typeof primitive === "string") {
|
|
66
|
-
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
67
|
-
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
68
|
-
let first = 2;
|
|
69
|
-
while (first < text.length && text[first] === "0") first++;
|
|
70
|
-
if (first === text.length) return 0;
|
|
71
|
-
const prefix = text[1];
|
|
72
|
-
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
73
|
-
if (text.length - first > limit) return 1 / 0;
|
|
74
|
-
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
75
|
-
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return __eliscript_number_intrinsic(primitive);
|
|
79
|
-
};
|
|
80
|
-
const __eliscript_numeric = (value) => {
|
|
81
|
-
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
82
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
83
|
-
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
84
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
85
|
-
};
|
|
86
|
-
const __eliscript_implicit_number = (value) => {
|
|
87
|
-
if (typeof value === "number") return value;
|
|
88
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
89
|
-
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
90
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
91
|
-
};
|
|
92
|
-
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
93
|
-
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
94
|
-
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
95
|
-
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
96
|
-
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
97
|
-
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
98
|
-
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
99
|
-
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
100
|
-
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
101
|
-
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
102
|
-
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
103
|
-
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
104
|
-
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
105
|
-
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
106
|
-
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
107
|
-
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
108
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
109
|
-
if (operator === "<") return left < right;
|
|
110
|
-
if (operator === "<=") return left <= right;
|
|
111
|
-
if (operator === ">") return left > right;
|
|
112
|
-
return left >= right;
|
|
113
|
-
}
|
|
114
|
-
let a = __eliscript_numeric_primitive(left);
|
|
115
|
-
let b = __eliscript_numeric_primitive(right);
|
|
116
|
-
const x = typeof a, y = typeof b;
|
|
117
|
-
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
118
|
-
a = __eliscript_numeric(a);
|
|
119
|
-
b = __eliscript_numeric(b);
|
|
120
|
-
}
|
|
121
|
-
if (operator === "<") return a < b;
|
|
122
|
-
if (operator === "<=") return a <= b;
|
|
123
|
-
if (operator === ">") return a > b;
|
|
124
|
-
return a >= b;
|
|
125
|
-
};
|
|
126
31
|
|
|
127
32
|
import * as legacy from "./managed-source-view-legacy.mjs";
|
|
128
33
|
import {isManagedHostProxy, prepareManagedHostProxyClassifierSync} from "./managed-host-proxy.mjs";
|
|
@@ -686,7 +591,7 @@ function decoded_source_mirror(target, key, entry) {
|
|
|
686
591
|
}
|
|
687
592
|
function decoded_source_synchronize(target, all) {
|
|
688
593
|
{
|
|
689
|
-
let record = (
|
|
594
|
+
let record = (decoded_source_records)["get"](target);
|
|
690
595
|
let keys = decoded_source_call(record, "keys", []);
|
|
691
596
|
let seen = new (globalThis.Set)(keys);
|
|
692
597
|
let extensible = decoded_source_call(record, "extensible", []);
|
|
@@ -726,7 +631,7 @@ function decoded_source_synchronize(target, all) {
|
|
|
726
631
|
}
|
|
727
632
|
function decoded_source_get(target, key, receiver) {
|
|
728
633
|
{
|
|
729
|
-
const __eliscript_value_57 = (
|
|
634
|
+
const __eliscript_value_57 = (decoded_source_records)["get"](target);
|
|
730
635
|
{
|
|
731
636
|
let record = __eliscript_value_57;
|
|
732
637
|
if ((!__eliscript_truthy((record)["directGet"]))) {
|
|
@@ -746,7 +651,7 @@ function decoded_source_get(target, key, receiver) {
|
|
|
746
651
|
}
|
|
747
652
|
function decoded_source_set(target, key, value, receiver) {
|
|
748
653
|
{
|
|
749
|
-
let record = (
|
|
654
|
+
let record = (decoded_source_records)["get"](target);
|
|
750
655
|
let changed = decoded_source_call(record, "set", [key, value, receiver]);
|
|
751
656
|
if (__eliscript_truthy(changed)) {
|
|
752
657
|
{
|
|
@@ -763,14 +668,14 @@ function decoded_source_set(target, key, value, receiver) {
|
|
|
763
668
|
}
|
|
764
669
|
}
|
|
765
670
|
function decoded_source_has(target, key) {
|
|
766
|
-
return decoded_source_call((
|
|
671
|
+
return decoded_source_call((decoded_source_records)["get"](target), "has", [key]);
|
|
767
672
|
}
|
|
768
673
|
function decoded_source_own_keys(target) {
|
|
769
674
|
return decoded_source_synchronize(target, false);
|
|
770
675
|
}
|
|
771
676
|
function decoded_source_descriptor(target, key) {
|
|
772
677
|
{
|
|
773
|
-
let record = (
|
|
678
|
+
let record = (decoded_source_records)["get"](target);
|
|
774
679
|
let entry = decoded_source_call(record, "descriptor", [key]);
|
|
775
680
|
if (__eliscript_truthy(((__eliscript_value_63) => (__eliscript_truthy(__eliscript_value_63) ? __eliscript_value_63 : (!__eliscript_truthy(Reflect.isExtensible(target)))))(((__eliscript_value_64) => (__eliscript_truthy(__eliscript_value_64) ? (!__eliscript_truthy((entry)["configurable"])) : __eliscript_value_64))(entry)))) {
|
|
776
681
|
decoded_source_mirror(target, key, entry);
|
|
@@ -780,7 +685,7 @@ function decoded_source_descriptor(target, key) {
|
|
|
780
685
|
}
|
|
781
686
|
function decoded_source_define(target, key, entry) {
|
|
782
687
|
{
|
|
783
|
-
const __eliscript_value_65 = (
|
|
688
|
+
const __eliscript_value_65 = (decoded_source_records)["get"](target);
|
|
784
689
|
{
|
|
785
690
|
let record = __eliscript_value_65;
|
|
786
691
|
if ((!__eliscript_truthy(decoded_source_call(record, "define", [key, entry])))) {
|
|
@@ -793,7 +698,7 @@ function decoded_source_define(target, key, entry) {
|
|
|
793
698
|
}
|
|
794
699
|
}
|
|
795
700
|
function decoded_source_delete(target, key) {
|
|
796
|
-
if ((!__eliscript_truthy(decoded_source_call((
|
|
701
|
+
if ((!__eliscript_truthy(decoded_source_call((decoded_source_records)["get"](target), "delete", [key])))) {
|
|
797
702
|
return false;
|
|
798
703
|
} else {
|
|
799
704
|
decoded_source_mirror(target, key, undefined);
|
|
@@ -802,7 +707,7 @@ function decoded_source_delete(target, key) {
|
|
|
802
707
|
}
|
|
803
708
|
function decoded_source_prototype(target) {
|
|
804
709
|
{
|
|
805
|
-
const __eliscript_value_66 = decoded_source_call((
|
|
710
|
+
const __eliscript_value_66 = decoded_source_call((decoded_source_records)["get"](target), "prototype", []);
|
|
806
711
|
{
|
|
807
712
|
let prototype = __eliscript_value_66;
|
|
808
713
|
if ((!__eliscript_truthy(Reflect.isExtensible(target)))) {
|
|
@@ -813,7 +718,7 @@ function decoded_source_prototype(target) {
|
|
|
813
718
|
}
|
|
814
719
|
}
|
|
815
720
|
function decoded_source_set_prototype(target, prototype) {
|
|
816
|
-
if ((!__eliscript_truthy(decoded_source_call((
|
|
721
|
+
if ((!__eliscript_truthy(decoded_source_call((decoded_source_records)["get"](target), "setPrototype", [prototype])))) {
|
|
817
722
|
return false;
|
|
818
723
|
} else {
|
|
819
724
|
return Reflect.setPrototypeOf(target, prototype);
|
|
@@ -824,7 +729,7 @@ function decoded_source_extensible(target) {
|
|
|
824
729
|
return Reflect.isExtensible(target);
|
|
825
730
|
}
|
|
826
731
|
function decoded_source_prevent_extensions(target) {
|
|
827
|
-
if ((!__eliscript_truthy(decoded_source_call((
|
|
732
|
+
if ((!__eliscript_truthy(decoded_source_call((decoded_source_records)["get"](target), "preventExtensions", [])))) {
|
|
828
733
|
return false;
|
|
829
734
|
} else {
|
|
830
735
|
decoded_source_synchronize(target, true);
|
|
@@ -832,10 +737,10 @@ function decoded_source_prevent_extensions(target) {
|
|
|
832
737
|
}
|
|
833
738
|
}
|
|
834
739
|
function decoded_source_apply(target, receiver, arguments$) {
|
|
835
|
-
return decoded_source_call((
|
|
740
|
+
return decoded_source_call((decoded_source_records)["get"](target), "apply", [receiver, arguments$]);
|
|
836
741
|
}
|
|
837
742
|
function decoded_source_construct(target, arguments$, new_target) {
|
|
838
|
-
return decoded_source_call((
|
|
743
|
+
return decoded_source_call((decoded_source_records)["get"](target), "construct", [arguments$, new_target]);
|
|
839
744
|
}
|
|
840
745
|
const decoded_source_handler = Object.freeze(({"get": decoded_source_get, "set": decoded_source_set, "has": decoded_source_has, "ownKeys": decoded_source_own_keys, "getOwnPropertyDescriptor": decoded_source_descriptor, "defineProperty": decoded_source_define, "deleteProperty": decoded_source_delete, "getPrototypeOf": decoded_source_prototype, "setPrototypeOf": decoded_source_set_prototype, "isExtensible": decoded_source_extensible, "preventExtensions": decoded_source_prevent_extensions, "apply": decoded_source_apply, "construct": decoded_source_construct}));
|
|
841
746
|
__eliscript_tdz_ready_9 = true;
|
|
@@ -1,97 +1,7 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
2
|
import "eliscript/runtime/unicode-case.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
|
|
4
4
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
5
|
-
const __eliscript_number_intrinsic = globalThis.Number;
|
|
6
|
-
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
7
|
-
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
8
|
-
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
9
|
-
const __eliscript_numeric_error = globalThis.TypeError;
|
|
10
|
-
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
11
|
-
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
12
|
-
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
13
|
-
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
14
|
-
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
15
|
-
const __eliscript_numeric_primitive = (value) => {
|
|
16
|
-
if (!__eliscript_numeric_object(value)) return value;
|
|
17
|
-
const exotic = value[__eliscript_numeric_symbol];
|
|
18
|
-
if (exotic !== void 0 && exotic !== null) {
|
|
19
|
-
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
20
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
21
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
22
|
-
}
|
|
23
|
-
for (let index = 0; index < 2; index++) {
|
|
24
|
-
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
25
|
-
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
26
|
-
const result = __eliscript_numeric_apply(method, value, []);
|
|
27
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
31
|
-
};
|
|
32
|
-
const __eliscript_to_number = (value) => {
|
|
33
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
34
|
-
if (typeof primitive === "string") {
|
|
35
|
-
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
36
|
-
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
37
|
-
let first = 2;
|
|
38
|
-
while (first < text.length && text[first] === "0") first++;
|
|
39
|
-
if (first === text.length) return 0;
|
|
40
|
-
const prefix = text[1];
|
|
41
|
-
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
42
|
-
if (text.length - first > limit) return 1 / 0;
|
|
43
|
-
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
44
|
-
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return __eliscript_number_intrinsic(primitive);
|
|
48
|
-
};
|
|
49
|
-
const __eliscript_numeric = (value) => {
|
|
50
|
-
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
51
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
52
|
-
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
53
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
54
|
-
};
|
|
55
|
-
const __eliscript_implicit_number = (value) => {
|
|
56
|
-
if (typeof value === "number") return value;
|
|
57
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
58
|
-
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
59
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
60
|
-
};
|
|
61
|
-
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
62
|
-
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
63
|
-
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
64
|
-
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
65
|
-
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
66
|
-
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
67
|
-
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
68
|
-
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
69
|
-
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
70
|
-
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
71
|
-
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
72
|
-
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
73
|
-
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
74
|
-
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
75
|
-
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
76
|
-
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
77
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
78
|
-
if (operator === "<") return left < right;
|
|
79
|
-
if (operator === "<=") return left <= right;
|
|
80
|
-
if (operator === ">") return left > right;
|
|
81
|
-
return left >= right;
|
|
82
|
-
}
|
|
83
|
-
let a = __eliscript_numeric_primitive(left);
|
|
84
|
-
let b = __eliscript_numeric_primitive(right);
|
|
85
|
-
const x = typeof a, y = typeof b;
|
|
86
|
-
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
87
|
-
a = __eliscript_numeric(a);
|
|
88
|
-
b = __eliscript_numeric(b);
|
|
89
|
-
}
|
|
90
|
-
if (operator === "<") return a < b;
|
|
91
|
-
if (operator === "<=") return a <= b;
|
|
92
|
-
if (operator === ">") return a > b;
|
|
93
|
-
return a >= b;
|
|
94
|
-
};
|
|
95
5
|
|
|
96
6
|
import {openNativeMemory} from "./native-memory.mjs";
|
|
97
7
|
import {createManagedHostRuntime, createManagedHostCapabilityBridge, failManagedRuntime, validateManagedRuntimeOptions} from "./managed-host.mjs";
|
|
@@ -1,98 +1,8 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
2
|
import "eliscript/runtime/unicode-case.mjs";
|
|
3
3
|
import "eliscript/runtime/math.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
|
|
5
5
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
6
|
-
const __eliscript_number_intrinsic = globalThis.Number;
|
|
7
|
-
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
8
|
-
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
9
|
-
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
10
|
-
const __eliscript_numeric_error = globalThis.TypeError;
|
|
11
|
-
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
12
|
-
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
13
|
-
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
14
|
-
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
15
|
-
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
16
|
-
const __eliscript_numeric_primitive = (value) => {
|
|
17
|
-
if (!__eliscript_numeric_object(value)) return value;
|
|
18
|
-
const exotic = value[__eliscript_numeric_symbol];
|
|
19
|
-
if (exotic !== void 0 && exotic !== null) {
|
|
20
|
-
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
21
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
22
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
23
|
-
}
|
|
24
|
-
for (let index = 0; index < 2; index++) {
|
|
25
|
-
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
26
|
-
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
27
|
-
const result = __eliscript_numeric_apply(method, value, []);
|
|
28
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
32
|
-
};
|
|
33
|
-
const __eliscript_to_number = (value) => {
|
|
34
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
35
|
-
if (typeof primitive === "string") {
|
|
36
|
-
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
37
|
-
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
38
|
-
let first = 2;
|
|
39
|
-
while (first < text.length && text[first] === "0") first++;
|
|
40
|
-
if (first === text.length) return 0;
|
|
41
|
-
const prefix = text[1];
|
|
42
|
-
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
43
|
-
if (text.length - first > limit) return 1 / 0;
|
|
44
|
-
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
45
|
-
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return __eliscript_number_intrinsic(primitive);
|
|
49
|
-
};
|
|
50
|
-
const __eliscript_numeric = (value) => {
|
|
51
|
-
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
52
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
53
|
-
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
54
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
55
|
-
};
|
|
56
|
-
const __eliscript_implicit_number = (value) => {
|
|
57
|
-
if (typeof value === "number") return value;
|
|
58
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
59
|
-
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
60
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
61
|
-
};
|
|
62
|
-
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
63
|
-
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
64
|
-
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
65
|
-
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
66
|
-
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
67
|
-
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
68
|
-
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
69
|
-
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
70
|
-
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
71
|
-
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
72
|
-
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
73
|
-
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
74
|
-
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
75
|
-
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
76
|
-
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
77
|
-
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
78
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
79
|
-
if (operator === "<") return left < right;
|
|
80
|
-
if (operator === "<=") return left <= right;
|
|
81
|
-
if (operator === ">") return left > right;
|
|
82
|
-
return left >= right;
|
|
83
|
-
}
|
|
84
|
-
let a = __eliscript_numeric_primitive(left);
|
|
85
|
-
let b = __eliscript_numeric_primitive(right);
|
|
86
|
-
const x = typeof a, y = typeof b;
|
|
87
|
-
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
88
|
-
a = __eliscript_numeric(a);
|
|
89
|
-
b = __eliscript_numeric(b);
|
|
90
|
-
}
|
|
91
|
-
if (operator === "<") return a < b;
|
|
92
|
-
if (operator === "<=") return a <= b;
|
|
93
|
-
if (operator === ">") return a > b;
|
|
94
|
-
return a >= b;
|
|
95
|
-
};
|
|
96
6
|
|
|
97
7
|
import {createRequire} from "node:module";
|
|
98
8
|
import {createCompilerDebugMap} from "./compiler-debug.mjs";
|
|
@@ -2,99 +2,9 @@
|
|
|
2
2
|
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
|
|
3
3
|
var __eliscript_tdz_ready_0;
|
|
4
4
|
function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("targets"); return targets; }
|
|
5
|
-
function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("targets"); return __eliscript_const_error(); }
|
|
6
5
|
import "eliscript/runtime/unicode-case.mjs";
|
|
6
|
+
import { __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
|
|
7
7
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
8
|
-
const __eliscript_number_intrinsic = globalThis.Number;
|
|
9
|
-
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
10
|
-
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
11
|
-
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
12
|
-
const __eliscript_numeric_error = globalThis.TypeError;
|
|
13
|
-
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
14
|
-
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
15
|
-
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
16
|
-
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
17
|
-
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
18
|
-
const __eliscript_numeric_primitive = (value) => {
|
|
19
|
-
if (!__eliscript_numeric_object(value)) return value;
|
|
20
|
-
const exotic = value[__eliscript_numeric_symbol];
|
|
21
|
-
if (exotic !== void 0 && exotic !== null) {
|
|
22
|
-
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
23
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
24
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
25
|
-
}
|
|
26
|
-
for (let index = 0; index < 2; index++) {
|
|
27
|
-
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
28
|
-
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
29
|
-
const result = __eliscript_numeric_apply(method, value, []);
|
|
30
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
34
|
-
};
|
|
35
|
-
const __eliscript_to_number = (value) => {
|
|
36
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
37
|
-
if (typeof primitive === "string") {
|
|
38
|
-
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
39
|
-
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
40
|
-
let first = 2;
|
|
41
|
-
while (first < text.length && text[first] === "0") first++;
|
|
42
|
-
if (first === text.length) return 0;
|
|
43
|
-
const prefix = text[1];
|
|
44
|
-
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
45
|
-
if (text.length - first > limit) return 1 / 0;
|
|
46
|
-
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
47
|
-
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return __eliscript_number_intrinsic(primitive);
|
|
51
|
-
};
|
|
52
|
-
const __eliscript_numeric = (value) => {
|
|
53
|
-
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
54
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
55
|
-
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
56
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
57
|
-
};
|
|
58
|
-
const __eliscript_implicit_number = (value) => {
|
|
59
|
-
if (typeof value === "number") return value;
|
|
60
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
61
|
-
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
62
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
63
|
-
};
|
|
64
|
-
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
65
|
-
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
66
|
-
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
67
|
-
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
68
|
-
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
69
|
-
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
70
|
-
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
71
|
-
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
72
|
-
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
73
|
-
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
74
|
-
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
75
|
-
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
76
|
-
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
77
|
-
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
78
|
-
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
79
|
-
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
80
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
81
|
-
if (operator === "<") return left < right;
|
|
82
|
-
if (operator === "<=") return left <= right;
|
|
83
|
-
if (operator === ">") return left > right;
|
|
84
|
-
return left >= right;
|
|
85
|
-
}
|
|
86
|
-
let a = __eliscript_numeric_primitive(left);
|
|
87
|
-
let b = __eliscript_numeric_primitive(right);
|
|
88
|
-
const x = typeof a, y = typeof b;
|
|
89
|
-
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
90
|
-
a = __eliscript_numeric(a);
|
|
91
|
-
b = __eliscript_numeric(b);
|
|
92
|
-
}
|
|
93
|
-
if (operator === "<") return a < b;
|
|
94
|
-
if (operator === "<=") return a <= b;
|
|
95
|
-
if (operator === ">") return a > b;
|
|
96
|
-
return a >= b;
|
|
97
|
-
};
|
|
98
8
|
|
|
99
9
|
import {readFile, writeFile, mkdir, realpath} from "node:fs/promises";
|
|
100
10
|
import {existsSync} from "node:fs";
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
(error "Unicode bootstrap requires its maintained generator or derived Eli data"))
|
|
16
16
|
(load generator nil t)
|
|
17
17
|
(eliscript-generate-unicode-case-runtime-data root)))
|
|
18
|
-
(dolist (name '("unicode-case-data" "unicode-case" "math"))
|
|
18
|
+
(dolist (name '("prelude" "unicode-case-data" "unicode-case" "math"))
|
|
19
19
|
(let ((runtime (expand-file-name (concat "runtime/" name ".mjs") output)))
|
|
20
20
|
(make-directory (file-name-directory runtime) t)
|
|
21
21
|
(eliscript-compile-file-with-source-map
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
(insert (json-serialize
|
|
28
28
|
'((name . "eliscript") (type . "module") (private . t)
|
|
29
29
|
(exports . ((./runtime/math.mjs . "./runtime/math.mjs")
|
|
30
|
+
(./runtime/prelude.mjs . "./runtime/prelude.mjs")
|
|
30
31
|
(./runtime/unicode-case.mjs . "./runtime/unicode-case.mjs")
|
|
31
32
|
(./runtime/unicode-case-data.mjs . "./runtime/unicode-case-data.mjs")))))
|
|
32
33
|
"\n"))))
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
(when (file-exists-p (expand-file-name (caar entries) root))
|
|
40
41
|
;; The generated host lives in ROOT, outside the private compiler output
|
|
41
42
|
;; scope. Its bare runtime imports must resolve in this same source tree.
|
|
42
|
-
(dolist (name '("unicode-case-data" "unicode-case" "math"))
|
|
43
|
+
(dolist (name '("prelude" "unicode-case-data" "unicode-case" "math"))
|
|
43
44
|
(let ((module (expand-file-name (concat "runtime/" name ".mjs") root)))
|
|
44
45
|
(unless (and preserve-existing (file-exists-p module)
|
|
45
46
|
(file-exists-p (concat module ".map")))
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
(defconst checkProject (get legacy :checkProject))
|
|
11
11
|
(defconst source-root (resolve (dirname (fileURLToPath (js* "import.meta.url"))) "../.."))
|
|
12
|
-
(defconst capsules (js-array "math" "unicode-case" "unicode-case-data"))
|
|
12
|
+
(defconst capsules (js-array "math" "prelude" "unicode-case" "unicode-case-data"))
|
|
13
13
|
(defun digest (bytes) (js-call (js-call (createHash "sha256") :update bytes) :digest "hex"))
|
|
14
14
|
(defun project-error (message filename)
|
|
15
15
|
(let ((error (new globalThis.Error message)))
|