tc39 / ecmarkup

An HTML superset/Markdown subset source format for ECMAScript and related specifications
https://tc39.es/ecmarkup/
MIT License
221 stars 63 forks source link

Allow rest argument list in abstract closures #572

Closed legendecas closed 9 months ago

legendecas commented 9 months ago

ecmarkup complains about a rest arguments list in an abstract closure declaration, such as:

<emu-alg>
  1. If IsCallable(_fn_) is false, throw a TypeError exception.
  1. Let _closure_ be a new Abstract Closure with parameters (..._args_) that captures _fn_ and performs the following steps when called:
    1. Let _thisArgument_ be the *this* value.
    1. Let _result_ be Completion(Call(_fn_, _thisArgument_, _args_)).
    1. Return _result_.
  1. Let _length_ be ? LengthOfArrayLike(_fn_).
  1. Let _name_ be ? Get(_fn_, *"name"*).
  1. If _name_ is not a String, set _name_ to the empty String.
  1. Return CreateBuiltinFunction(_closure_, _length_, _name_, &laquo; &raquo;).
</emu-alg>

Run with command ecmarkup --verbose --lint-spec spec.html build/index.html, and it outputs errors:

[2024-02-20T16:42:00.406Z] Error: spec.html:903:71: expected to find a parameter name here
[2024-02-20T16:42:01.873Z] Completed with errors.
error: expected to find a parameter name here (bad-ac) at spec.html:903:71:
> 903 |           1. Let _closure_ be a new Abstract Closure with parameters (..._args_) that captures _fn_ and performs the following steps when called:

This pattern can be handy compared to the exotic function object language.

Refs: https://github.com/tc39/proposal-async-context/pull/68#discussion_r1493400361