I couldn't find any information about this in the AssemblyScript docs.
Is the spread operator available in AssemblyScript? I would like to define an object like so:
{ ...params, category: "LockupDynamic" }
Checking the current master branch shows that the feature is unimplemented. The compiler throws an error inside compileUnaryPrefixExpression
if it encounters a ...
token:
case Token.Dot_Dot_Dot: {
this.error(
DiagnosticCode.Not_implemented_0,
expression.range, "Spread operator"
);
return module.unreachable();
}
However, rest parameters do seem to be supported, in both the parser and compiler. So you should be able to define a function with a ...
parameter, but you cannot use ...
to pass arguments to a function.