Skip to content
Merged
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
Expand Up @@ -11,6 +11,8 @@
- `Uri:encode_full`, `Uri:encode_component`, `Uri:decode_full`, `Uri:decode_component`を追加
- `str.starts_with`,`str.ends_with`を追加
- `arr.splice`を追加
- 関数の省略された引数にNULLを格納するように
- 一時的な措置であり、省略可能引数構文の実装と同時に廃止予定です。依存し過ぎないようにしてください

# 0.18.0
- `Core:abort`でプログラムを緊急停止できるように
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class Interpreter {
for (let i = 0; i < (fn.args ?? []).length; i++) {
_args.set(fn.args![i]!, {
isMutable: true,
value: args[i]!,
value: args[i] ?? NULL,
});
}
const fnScope = fn.scope!.createChildScope(_args);
Expand Down
10 changes: 10 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,16 @@ describe('Function call', () => {
}
assert.fail();
});

test.concurrent('omitted args', async () => {
const res = await exe(`
@f(x, y) {
[x, y]
}
<: f(1)
`);
eq(res, ARR([NUM(1), NULL]));
});
});

describe('Return', () => {
Expand Down