marijnh/acorn — pull request #79 by btmills (2013-11-14 03:00:08+00:00)
Title: Rest parameters

This was prompted by the comment in #78 regarding ES6 support. I have implemented rest parameters in my fork following Mozilla's [AST format for rest parameters](https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API#Functions), so when `ecmaVersion >= 6`, `function foo(a, ...b)` is parsed as

```JavaScript
{
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo'
},
params: [
{
type: 'Identifier',
name: 'a'
}
],
rest: {
type: 'Identifier',
name: 'b'
},
body: {
type: 'BlockStatement',
body: []
}
}
```

One thing I wasn't sure about and will need to change is the [argument naming check](https://github.com/btmills/acorn/blob/master/acorn.js#L1740) and the rules for that. How should that work?