Skip to content

Commit

Permalink
fix repr of delay expression #315
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Feb 20, 2024
1 parent 23edba9 commit 148b26d
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* fix bookmark when hovering over boolean values
* fix quoted cycle in REPL [#313](https://github.com/jcubic/lips/issues/313)
* fix set-repr! on base class [#314](https://github.com/jcubic/lips/issues/314)
* fix `repr` of delay expressions [#315](https://github.com/jcubic/lips/issues/315)

## 1.0.0-beta.18
### Breaking
Expand Down
20 changes: 12 additions & 8 deletions dist/lips.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions dist/lips.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.esm.min.js

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions dist/lips.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.min.js

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -2926,15 +2926,19 @@ function toString(obj, quote, skip_cycles, ...pair_args) {
if ([nil, eof].includes(obj)) {
return obj.toString();
}
if (is_function(obj)) {
return function_to_string(obj);
}
if (obj === root) {
return '#<js:global>';
}
if (obj === null) {
return 'null';
}
if (is_function(obj)) {
if (is_function(obj.toString) && obj.hasOwnProperty('toString')) {
// promises
return obj.toString().valueOf();
}
return function_to_string(obj);
}
if (typeof obj === 'object') {
var constructor = obj.constructor;
if (!constructor) {
Expand All @@ -2957,7 +2961,7 @@ function toString(obj, quote, skip_cycles, ...pair_args) {
name = constructor.name;
}
// user defined representation
if (is_function(obj.toString) && is_lambda(obj.toString)) {
if (is_function(obj.toString) && obj.hasOwnProperty('toString')) {
return obj.toString().valueOf();
}
if (type(obj) === 'instance') {
Expand Down

0 comments on commit 148b26d

Please sign in to comment.