allow array as callexpression argument

This commit is contained in:
Kurt Hutten IrevDev
2023-01-01 13:44:48 +11:00
parent d80d487d08
commit 84d76b5763
2 changed files with 28 additions and 0 deletions

View File

@ -181,6 +181,23 @@ function makeArguments(
const isIdentifierOrLiteral =
nextBraceOrCommaToken.token.type === 'comma' ||
nextBraceOrCommaToken.token.type === 'brace'
if (
argumentToken.token.type === 'brace' &&
argumentToken.token.value === '['
) {
const { expression, lastIndex } = makeArrayExpression(
tokens,
argumentToken.index
)
const nextCommarOrBraceTokenIndex = nextMeaningfulToken(
tokens,
lastIndex
).index
return makeArguments(tokens, nextCommarOrBraceTokenIndex, [
...previousArgs,
expression,
])
}
if (!isIdentifierOrLiteral) {
const { expression, lastIndex } = makeBinaryExpression(tokens, index)
return makeArguments(tokens, lastIndex, [...previousArgs, expression])