@ball-lang/engine 1.4.3 → 1.4.5
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/dist/compiled_engine.d.ts +1 -0
- package/dist/compiled_engine.d.ts.map +1 -1
- package/dist/compiled_engine.js +56 -16
- package/dist/compiled_engine.js.map +1 -1
- package/dist/engine_setup.d.ts.map +1 -1
- package/dist/engine_setup.js +35 -4
- package/dist/engine_setup.js.map +1 -1
- package/package.json +4 -2
- package/src/compiled_engine.ts +57 -16
- package/src/engine_setup.ts +34 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine_setup.d.ts","sourceRoot":"","sources":["../src/engine_setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,GAAG,CAAC;IAChB,gBAAgB,EAAE,GAAG,CAAC;IACtB,aAAa,EAAE,GAAG,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC;IACjB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY;qBAoUzB,GAAG,2BAAuB,GAAG;qBA6E7B,GAAG,KAAG,GAAG;eAqCf,GAAG,KAAG,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"engine_setup.d.ts","sourceRoot":"","sources":["../src/engine_setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,GAAG,CAAC;IAChB,gBAAgB,EAAE,GAAG,CAAC;IACtB,aAAa,EAAE,GAAG,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC;IACjB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY;qBAoUzB,GAAG,2BAAuB,GAAG;qBA6E7B,GAAG,KAAG,GAAG;eAqCf,GAAG,KAAG,MAAM;;;;4BAsDZ,GAAG,GAAG,OAAO;0BACf,GAAG,GAAG,IAAI;qBACf,MAAM,SAAS,GAAG,WAAW,GAAG,GAAG,GAAG;;;yDAkJkB,GAAG,KAAG,IAAI;0CAikBvB,IAAI;sCAshBR,IAAI;sCA0Bb,GAAG,KAAG,IAAI;uBAptDzB,GAAG,KAAG,OAAO;0BA0pCV,GAAG,KAAG,GAAG;EAgmBvC"}
|
package/dist/engine_setup.js
CHANGED
|
@@ -496,8 +496,16 @@ export function createEngineSetup(mod) {
|
|
|
496
496
|
if (Array.isArray(v))
|
|
497
497
|
return '[' + v.map(__bts).join(', ') + ']';
|
|
498
498
|
if (v instanceof Map) {
|
|
499
|
+
// NOT `v.entries()` — the compiled engine's own preamble shadows
|
|
500
|
+
// `Map.prototype.entries` with a Dart-style GETTER (returning an array
|
|
501
|
+
// of {key,value} objects, matching Dart's `Map.entries` property) so
|
|
502
|
+
// Ball's `.entries` field access works. That shadow makes `v.entries`
|
|
503
|
+
// non-callable, so `v.entries()` throws "not a function" for any real
|
|
504
|
+
// Map value. Iterate the Map directly instead — a Map's default
|
|
505
|
+
// iterator already yields [key, value] pairs and is unaffected by the
|
|
506
|
+
// entries/keys/values property shadowing.
|
|
499
507
|
const parts = [];
|
|
500
|
-
for (const [k, val] of v
|
|
508
|
+
for (const [k, val] of v)
|
|
501
509
|
parts.push(__bts(k) + ': ' + __bts(val));
|
|
502
510
|
return '{' + parts.join(', ') + '}';
|
|
503
511
|
}
|
|
@@ -1164,8 +1172,17 @@ export function createEngineSetup(mod) {
|
|
|
1164
1172
|
_r('string_to_int', (i) => {
|
|
1165
1173
|
const m = _m(i);
|
|
1166
1174
|
const s = String(m['value'] ?? m['string'] ?? i ?? '').trim();
|
|
1175
|
+
// `.message` must be the bare invalid text (Dart's `FormatException.message`
|
|
1176
|
+
// is never prefixed with the type name — only `.toString()` adds that).
|
|
1177
|
+
// Setting `name: 'FormatException'` (not just a `message` override) lets
|
|
1178
|
+
// the default `Error.prototype.toString()` ("name: message") produce the
|
|
1179
|
+
// Dart-correct "FormatException: <text>" for anything that prints the
|
|
1180
|
+
// caught exception itself rather than `.message`. Previously the message
|
|
1181
|
+
// override clobbered the "FormatException: " prefix right back out,
|
|
1182
|
+
// leaving `.name` as the native "Error" — undetected because no
|
|
1183
|
+
// conformance fixture prints a caught FormatException directly.
|
|
1167
1184
|
if (!/^-?\d+$/.test(s))
|
|
1168
|
-
throw Object.assign(new Error(
|
|
1185
|
+
throw Object.assign(new Error(s), { name: 'FormatException', __type__: 'FormatException' });
|
|
1169
1186
|
return parseInt(s, 10);
|
|
1170
1187
|
});
|
|
1171
1188
|
_r('writeCharCode', (i) => { const m = _m(i); const self = m['self']; if (typeof self === 'object' && self !== null) {
|
|
@@ -1234,8 +1251,22 @@ export function createEngineSetup(mod) {
|
|
|
1234
1251
|
return true;
|
|
1235
1252
|
});
|
|
1236
1253
|
_r('concat', (i) => { const m = _m(i); return String(m['left'] ?? '') + String(m['right'] ?? ''); });
|
|
1237
|
-
|
|
1238
|
-
|
|
1254
|
+
// `?? i` (used by most unary helpers below) can't distinguish "no `value`
|
|
1255
|
+
// field" from "`value` is explicitly null" — for every OTHER helper that's
|
|
1256
|
+
// harmless (a null numeric/string arg just coerces away), but for
|
|
1257
|
+
// null_check it inverts the function's entire purpose: `x!` where `x` is
|
|
1258
|
+
// null must throw (matches the Dart engine's `_extractUnaryArg` + null
|
|
1259
|
+
// check — see engine_std.dart's 'null_check' and its
|
|
1260
|
+
// "throws BallRuntimeError on null" test), yet `m['value'] ?? i` silently
|
|
1261
|
+
// fell back to the (truthy) input map and returned it instead of
|
|
1262
|
+
// throwing. hasOwnProperty-gate so an explicit null is honored.
|
|
1263
|
+
_r('null_check', (i) => {
|
|
1264
|
+
const m = _m(i);
|
|
1265
|
+
const v = Object.prototype.hasOwnProperty.call(m, 'value') ? m['value'] : i;
|
|
1266
|
+
if (v == null)
|
|
1267
|
+
throw new Error('Null check operator used on a null value');
|
|
1268
|
+
return v;
|
|
1269
|
+
});
|
|
1239
1270
|
_r('compare_to', (i) => {
|
|
1240
1271
|
const m = _m(i);
|
|
1241
1272
|
const l = m['left'] ?? m['value'] ?? m['self'] ?? m['a'] ?? 0;
|