summaryrefslogtreecommitdiff
path: root/js-runtime
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2024-01-29 21:06:02 -0500
committerDavid Thompson <dthompson2@worcester.edu>2024-01-29 21:06:02 -0500
commit7d23369b60e43193a34d61adfe23930506069a13 (patch)
tree91c7a01d27f488995072f7aa7636816dd3ce97dd /js-runtime
parentf547bc5f707e087af5b3c41519efbaf3e6bbbc87 (diff)
Update to latest hoot.
Diffstat (limited to 'js-runtime')
-rw-r--r--js-runtime/reflect.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/js-runtime/reflect.js b/js-runtime/reflect.js
index b7d88f3..5ee2928 100644
--- a/js-runtime/reflect.js
+++ b/js-runtime/reflect.js
@@ -20,7 +20,8 @@ class Complex {
this.imag = imag;
}
toString() {
- return `${flonum_to_string(this.real)}+${flonum_to_string(this.imag)}i`;
+ const sign = this.imag >= 0 && Number.isFinite(this.imag) ? "+": "";
+ return `${flonum_to_string(this.real)}${sign}${flonum_to_string(this.imag)}i`;
}
}
class Fraction {
@@ -440,9 +441,9 @@ class SchemeModule {
string_downcase: Function.call.bind(String.prototype.toLowerCase),
make_weak_map() { return new WeakMap; },
- weak_map_get(map, k) {
+ weak_map_get(map, k, fail) {
const val = map.get(k);
- return val === undefined ? null: val;
+ return val === undefined ? fail: val;
},
weak_map_set(map, k, v) { return map.set(k, v); },
weak_map_delete(map, k) { return map.delete(k); },