Closed
Bug 760304
Opened 12 years ago
Closed 12 years ago
Reflect.parse needs to be updated to support defaults and rest parameters
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla16
People
(Reporter: Benjamin, Assigned: Benjamin)
References
Details
Attachments
(1 file, 1 obsolete file)
14.08 KB,
patch
|
Details | Diff | Splinter Review |
The reflect AST needs to have additions for rest parameters and defaults. I need bug 759498 first, since it alters the parse tree for defaults.
Assignee | ||
Comment 1•12 years ago
|
||
Attachment #629676 -
Flags: review?(dherman)
Comment 2•12 years ago
|
||
Comment on attachment 629676 [details] [diff] [review] support rest and defaults > return newNode(type, pos, > "id", id, > "params", array, >+ "defaults", defarray, > "body", body, >+ "rest", BooleanValue(hasRest), The rest-argument has a name -- are you including the name in the params list and this just indicates whether the last name is a rest-arg? Would it be a nicer API to have the params array only have the non-rest params, and the .rest field to be either a string or null? > "generator", BooleanValue(isGenerator), > "expression", BooleanValue(isExpression), > dst); > } >diff --git a/js/src/tests/js1_8_5/extensions/reflect-parse.js b/js/src/tests/js1_8_5/extensions/reflect-parse.js >--- a/js/src/tests/js1_8_5/extensions/reflect-parse.js >+++ b/js/src/tests/js1_8_5/extensions/reflect-parse.js >@@ -20,24 +20,28 @@ var _ = Pattern.ANY; ... >+assertDecl("function foo(...rest) { }", >+ funDecl(ident("foo"), [ident("rest")], blockStmt([]), [], true)); Yeah, so I was thinking it might make more sense for the API to return funDecl(ident("foo"), [], blockStmt([]), [], "rest") But I'm not adamant about this. It just seems a little less error-prone somehow. What do you think? Please update the docs at https://developer.mozilla.org/en/SpiderMonkey/Parser_API if you haven't already. Overall looks good. r=me; it's up to you if you want to make that API change I suggested, or we can discuss in the bug. Thanks, Dave
Attachment #629676 -
Flags: review?(dherman) → review+
Assignee | ||
Comment 3•12 years ago
|
||
I think your suggested API is better.
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #629676 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 5•12 years ago
|
||
The wiki has been updated.
Updated•12 years ago
|
Keywords: checkin-needed
Updated•12 years ago
|
Flags: in-testsuite+
Target Milestone: --- → mozilla16
Comment 7•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/c2ce10a018d8
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•