Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[Read translated version (en)](./translations/en/CHANGELOG.md)

- インタプリタがreturn文を文字列化できるように

# 0.13.2
- `Date:year`,`Date:month`,`Date:day`,`Date:hour`,`Date:minute`,`Date:second`に時間数値の引数を渡して時刻指定可能に
- array.sortとString用比較関数Str:lt, Str:gtの追加
Expand Down
2 changes: 2 additions & 0 deletions src/interpreter/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export function valToString(val: Value, simple = false): string {
if (val.type === 'str') return `"${val.value}"`;
if (val.type === 'arr') return `[${val.value.map(item => valToString(item, true)).join(', ')}]`;
if (val.type === 'null') return '(null)';
if (val.type === 'return') return valToString(val.value, true);
}
const label =
val.type === 'num' ? val.value :
Expand All @@ -108,6 +109,7 @@ export function valToString(val: Value, simple = false): string {
val.type === 'fn' ? '...' :
val.type === 'obj' ? '...' :
val.type === 'null' ? '' :
val.type === 'return' ? valToString(val.value) :
null;
return `${val.type}<${label}>`;
}
Expand Down