Add SingleMethodDefinition top rule #17

Closed
bmeurer wants to merge 1 commit from bug/1402163_MethodDeclaration into main
bmeurer commented 2022-12-19 08:16:58 +01:00 (Migrated from github.com)

FEATURE: The grammar now supports top: "SingleMethodDefinition" to parse a method definition according to the ECMAScript specification1 rather than a script or a single expression.

Bug: crbug/1402163

FEATURE: The grammar now supports `top: "SingleMethodDefinition"` to parse a method definition according to the ECMAScript specification[^1] rather than a script or a single expression. Bug: [crbug/1402163](https://crbug.com/1402163) [^1]: https://tc39.es/ecma262/#prod-MethodDefinition
marijnh commented 2022-12-19 08:21:25 +01:00 (Migrated from github.com)

Why aren't static/abstract part of this? And wouldn't it be useful in more situations if we include any class item in the exported rule?

Why aren't `static`/`abstract` part of this? And wouldn't it be useful in more situations if we include any class item in the exported rule?
bmeurer commented 2022-12-19 08:53:11 +01:00 (Migrated from github.com)

The use case is to parse what falls out of Function.prototype.toString() for the purpose of extracting the arguments list in DevTools. For that we need exactly MethodDefinition per spec (although it wouldn't hurt to allow for more).

You can checkout my devtools-frontend CL to see how I'm using this.

The use case is to parse what falls out of `Function.prototype.toString()` for the purpose of extracting the arguments list in DevTools. For that we need exactly *MethodDefinition* per spec (although it wouldn't hurt to allow for more). You can checkout [my devtools-frontend CL](https://crrev.com/c/4115740) to see how I'm using this.
marijnh commented 2022-12-19 12:28:00 +01:00 (Migrated from github.com)

Does patch bf8d1f7 look like it would cover your need?

Does patch bf8d1f7 look like it would cover your need?
bmeurer commented 2022-12-19 12:43:21 +01:00 (Migrated from github.com)

That works, thanks!

That works, thanks!

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/javascript!17
No description provided.