Skip to content

Commit

Permalink
add splat operator #31
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed May 25, 2022
1 parent dd7484c commit 774ead5
Show file tree
Hide file tree
Showing 7 changed files with 636 additions and 433 deletions.
4 changes: 4 additions & 0 deletions __tests__/__fixtures__/function_calls.gs
Expand Up @@ -11,6 +11,10 @@ end

global("hello")

hello(1, *[1,2,3])
hello(*[1,2,3])



list[cmd](10)()
list[cmd](10).foo.bar()
Expand Down
7 changes: 7 additions & 0 deletions __tests__/__fixtures__/functions.gs
Expand Up @@ -20,3 +20,10 @@ def define()

end

def define(*args)

end

def define(a, *args)

end
6 changes: 6 additions & 0 deletions __tests__/__snapshots__/gaiman.spec.js.snap
Expand Up @@ -128,6 +128,8 @@ exports[`functions should compile function calls 1`] = `
gaiman.echo(\`hello\`);
}
await $_global(\`hello\`);
await $_hello(1, ...new GaimanArray(1, 2, 3));
await $_hello(...new GaimanArray(1, 2, 3));
await (await $_list[$_cmd](10))();
await (await $_list[$_cmd](10)).foo.bar();
await $_list[$_cmd][$_cmd]();
Expand Down Expand Up @@ -164,6 +166,10 @@ exports[`functions should compile function definitions 1`] = `
}
async function $_define() {
}
async function $_define(...$_args) {
}
async function $_define($_a, ...$_args) {
}
} catch (e) {
gaiman.error(e);
}
Expand Down

0 comments on commit 774ead5

Please sign in to comment.