[Pkg-javascript-commits] [acorn] 01/03: New upstream version 5.4.1+ds1

Julien Puydt julien.puydt at laposte.net
Mon Feb 19 22:33:11 UTC 2018


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository acorn.

commit eca18c795fe9ee578d590728fd0312208cf3d9bf
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Mon Feb 19 23:26:22 2018 +0100

    New upstream version 5.4.1+ds1
---
 AUTHORS                              |    2 +
 CHANGELOG.md                         |   20 +
 LICENSE                              |    2 +-
 README.md                            |   13 +-
 bin/run_test262.js                   |    3 -
 bin/test262.whitelist                |   59 +-
 package.json                         |    2 +-
 src/expression.js                    |   31 +-
 src/index.js                         |    2 +-
 src/loose/expression.js              |   16 +-
 src/loose/statement.js               |   16 +-
 src/loose/tokenize.js                |    2 +-
 src/lval.js                          |   14 +-
 src/statement.js                     |   30 +-
 src/tokenize.js                      |   24 +-
 src/walk/index.js                    |    2 +-
 test/run.js                          |    2 +
 test/tests-async-iteration.js        | 1994 ++++++++++++++++++++++++++++++++++
 test/tests-rest-spread-properties.js | 1416 ++++++++++++++++++++++++
 test/tests.js                        |   74 +-
 20 files changed, 3614 insertions(+), 110 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index bdbfea2..59d1d0a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -10,6 +10,7 @@ Angelo
 Aparajita Fishman
 Arian Stolwijk
 Artem Govorov
+Boopesh Mahendran
 Bradley Heinz
 Brandon Mills
 Charles Hughes
@@ -65,6 +66,7 @@ Richard Gibson
 Rich Harris
 Sebastian McKenzie
 Shahar Soel
+Sheel Bedi
 Simen Bekkhus
 Teddy Katz
 Timothy Gu
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fff956a..66a7aad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,23 @@
+## 5.4.1 (2018-02-02)
+
+### Bug fixes
+
+5.4.0 somehow accidentally included an old version of walk.js.
+
+## 5.4.0 (2018-02-01)
+
+### Bug fixes
+
+Disallow duplicate or escaped flags on regular expressions.
+
+Disallow octal escapes in strings in strict mode.
+
+### New features
+
+Add support for async iteration.
+
+Add support for object spread and rest.
+
 ## 5.3.0 (2017-12-28)
 
 ### Bug fixes
diff --git a/LICENSE b/LICENSE
index 3f01865..2c0632b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (C) 2012-2017 by various contributors (see AUTHORS)
+Copyright (C) 2012-2018 by various contributors (see AUTHORS)
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 8855fa7..98c3fe0 100644
--- a/README.md
+++ b/README.md
@@ -447,9 +447,16 @@ looseParser.extend("readToken", function(nextMethod) {
  
  Plugins for ECMAScript proposals:
  
+ - [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
+   - [`acorn-async-iteration`](https://github.com/acornjs/acorn-async-iteration): Parse [async iteration proposal](https://github.com/tc39/proposal-async-iteration)
+   - [`acorn-bigint`](https://github.com/acornjs/acorn-bigint): Parse [BigInt proposal](https://github.com/tc39/proposal-bigint)
+   - [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
+   - [`acorn-dynamic-import`](https://github.com/kesne/acorn-dynamic-import): Parse [import() proposal](https://github.com/tc39/proposal-dynamic-import)
+   - [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
+   - [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator)
+   - [`acorn-optional-catch-binding`](https://github.com/acornjs/acorn-optional-catch-binding): Parse [optional catch binding proposal](https://github.com/tc39/proposal-optional-catch-binding)
+   - [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)
+   - [`acorn5-object-spread`](https://github.com/adrianheine/acorn5-object-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread)
  - [`acorn-object-rest-spread`](https://github.com/victor-homyakov/acorn-object-rest-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread)
- - [`acorn5-object-spread`](https://github.com/adrianheine/acorn5-object-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread)
  - [`acorn-es7`](https://github.com/angelozerr/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators)
  - [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer): Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/06/07/react-on-es6-plus)
- - [`acorn-dynamic-import`](https://github.com/kesne/acorn-dynamic-import): Parse [import() proposal](https://github.com/tc39/proposal-dynamic-import)
- - [`acorn-async-iteration`](https://github.com/adrianheine/acorn-async-iteration): Parse [async iteration proposal](https://github.com/tc39/proposal-async-iteration)
diff --git a/bin/run_test262.js b/bin/run_test262.js
index b0e4e8f..880ffa2 100644
--- a/bin/run_test262.js
+++ b/bin/run_test262.js
@@ -4,13 +4,10 @@ const run = require("test262-parser-runner")
 const parse = require("..").parse
 
 const unsupportedFeatures = [
-  "async-iteration",
   "BigInt",
   "class-fields",
   "class-fields-private",
   "class-fields-public",
-  "object-rest",
-  "object-spread",
   "optional-catch-binding",
   "regexp-lookbehind",
   "regexp-named-groups",
diff --git a/bin/test262.whitelist b/bin/test262.whitelist
index 4524b3b..4eaa642 100644
--- a/bin/test262.whitelist
+++ b/bin/test262.whitelist
@@ -96,6 +96,28 @@ language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-
 language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
 language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
 language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
+language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
 language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
 language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
 language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (default)
@@ -186,11 +208,6 @@ language/global-code/super-call-arrow.js (default)
 language/global-code/super-call-arrow.js (strict mode)
 language/global-code/super-prop-arrow.js (default)
 language/global-code/super-prop-arrow.js (strict mode)
-language/literals/regexp/early-err-dup-flag.js (default)
-language/literals/regexp/early-err-dup-flag.js (strict mode)
-language/literals/regexp/early-err-flags-unicode-escape.js (default)
-language/literals/regexp/early-err-flags-unicode-escape.js (strict mode)
-language/literals/string/legacy-non-octal-escape-sequence-strict.js (strict mode)
 language/module-code/early-export-global.js (default)
 language/module-code/early-export-global.js (strict mode)
 language/module-code/early-export-unresolvable.js (default)
@@ -219,6 +236,14 @@ language/statements/async-function/early-errors-declaration-formals-contains-sup
 language/statements/async-function/early-errors-declaration-formals-contains-super-call.js (strict mode)
 language/statements/async-function/early-errors-declaration-formals-contains-super-property.js (default)
 language/statements/async-function/early-errors-declaration-formals-contains-super-property.js (strict mode)
+language/expressions/async-generator/early-errors-expression-body-contains-super-call.js (default)
+language/expressions/async-generator/early-errors-expression-body-contains-super-call.js (strict mode)
+language/expressions/async-generator/early-errors-expression-body-contains-super-property.js (default)
+language/expressions/async-generator/early-errors-expression-body-contains-super-property.js (strict mode)
+language/expressions/async-generator/early-errors-expression-formals-contains-super-call.js (default)
+language/expressions/async-generator/early-errors-expression-formals-contains-super-call.js (strict mode)
+language/expressions/async-generator/early-errors-expression-formals-contains-super-property.js (default)
+language/expressions/async-generator/early-errors-expression-formals-contains-super-property.js (strict mode)
 language/statements/class/definition/early-errors-class-method-arguments-in-formal-parameters.js (default)
 language/statements/class/definition/early-errors-class-method-body-contains-super-call.js (default)
 language/statements/class/definition/early-errors-class-method-body-contains-super-call.js (strict mode)
@@ -284,6 +309,8 @@ language/statements/for-of/labelled-fn-stmt-lhs.js (default)
 language/statements/for-of/labelled-fn-stmt-var.js (default)
 language/statements/for-of/let-block-with-newline.js (default)
 language/statements/for-of/let-identifier-with-newline.js (default)
+language/statements/for-await-of/let-block-with-newline.js (default)
+language/statements/for-await-of/let-identifier-with-newline.js (default)
 language/statements/function/early-body-super-call.js (default)
 language/statements/function/early-body-super-call.js (strict mode)
 language/statements/function/early-body-super-prop.js (default)
@@ -317,6 +344,28 @@ language/statements/switch/syntax/redeclaration/async-function-declaration-attem
 language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
 language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
 language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
+language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
+language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
+language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
 language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
 language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
 language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (default)
diff --git a/package.json b/package.json
index 4fe2abd..5011ada 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "homepage": "https://github.com/acornjs/acorn",
   "main": "dist/acorn.js",
   "module": "dist/acorn.es.js",
-  "version": "5.3.0",
+  "version": "5.4.1",
   "engines": {
     "node": ">=0.4.0"
   },
diff --git a/src/expression.js b/src/expression.js
index 29f39f4..79cd9b5 100644
--- a/src/expression.js
+++ b/src/expression.js
@@ -29,6 +29,8 @@ const pp = Parser.prototype
 // strict mode, init properties are also not allowed to be repeated.
 
 pp.checkPropClash = function(prop, propHash, refDestructuringErrors) {
+  if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
+    return
   if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
     return
   let {key} = prop, name
@@ -540,7 +542,7 @@ pp.parseTemplate = function({isTagged = false} = {}) {
 
 pp.isAsyncProp = function(prop) {
   return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
-    (this.type === tt.name || this.type === tt.num || this.type === tt.string || this.type === tt.bracketL || this.type.keyword) &&
+    (this.type === tt.name || this.type === tt.num || this.type === tt.string || this.type === tt.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === tt.star)) &&
     !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
 }
 
@@ -565,6 +567,32 @@ pp.parseObj = function(isPattern, refDestructuringErrors) {
 
 pp.parseProperty = function(isPattern, refDestructuringErrors) {
   let prop = this.startNode(), isGenerator, isAsync, startPos, startLoc
+  if (this.options.ecmaVersion >= 9 && this.eat(tt.ellipsis)) {
+    if (isPattern) {
+      prop.argument = this.parseIdent(false)
+      if (this.type === tt.comma) {
+        this.raise(this.start, "Comma is not permitted after the rest element")
+      }
+      return this.finishNode(prop, "RestElement")
+    }
+    // To disallow parenthesized identifier via `this.toAssignable()`.
+    if (this.type === tt.parenL && refDestructuringErrors) {
+      if (refDestructuringErrors.parenthesizedAssign < 0) {
+        refDestructuringErrors.parenthesizedAssign = this.start
+      }
+      if (refDestructuringErrors.parenthesizedBind < 0) {
+        refDestructuringErrors.parenthesizedBind = this.start
+      }
+    }
+    // Parse argument.
+    prop.argument = this.parseMaybeAssign(false, refDestructuringErrors)
+    // To disallow trailing comma via `this.toAssignable()`.
+    if (this.type === tt.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
+      refDestructuringErrors.trailingComma = this.start
+    }
+    // Finish
+    return this.finishNode(prop, "SpreadElement")
+  }
   if (this.options.ecmaVersion >= 6) {
     prop.method = false
     prop.shorthand = false
@@ -579,6 +607,7 @@ pp.parseProperty = function(isPattern, refDestructuringErrors) {
   this.parsePropertyName(prop)
   if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
     isAsync = true
+    isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star)
     this.parsePropertyName(prop, refDestructuringErrors)
   } else {
     isAsync = false
diff --git a/src/index.js b/src/index.js
index 781aa6e..0d9141d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -37,7 +37,7 @@ export {isIdentifierChar, isIdentifierStart} from "./identifier"
 export {Token} from "./tokenize"
 export {isNewLine, lineBreak, lineBreakG, nonASCIIwhitespace} from "./whitespace"
 
-export const version = "5.3.0"
+export const version = "5.4.1"
 
 // The main exported interface (under `self.acorn` when in the
 // browser) is a `parse` function that takes a code string and
diff --git a/src/loose/expression.js b/src/loose/expression.js
index 21c2fd1..b6c5ddb 100644
--- a/src/loose/expression.js
+++ b/src/loose/expression.js
@@ -368,6 +368,12 @@ lp.parseObj = function() {
   if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart }
   while (!this.closes(tt.braceR, indent, line)) {
     let prop = this.startNode(), isGenerator, isAsync, start
+    if (this.options.ecmaVersion >= 9 && this.eat(tt.ellipsis)) {
+      prop.argument = this.parseMaybeAssign()
+      node.properties.push(this.finishNode(prop, "SpreadElement"))
+      this.eat(tt.comma)
+      continue
+    }
     if (this.options.ecmaVersion >= 6) {
       start = this.storeCurrentPos()
       prop.method = false
@@ -376,8 +382,9 @@ lp.parseObj = function() {
     }
     this.parsePropertyName(prop)
     if (this.toks.isAsyncProp(prop)) {
-      this.parsePropertyName(prop)
       isAsync = true
+      isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star)
+      this.parsePropertyName(prop)
     } else {
       isAsync = false
     }
@@ -476,12 +483,13 @@ lp.toAssignable = function(node, binding) {
     return this.dummyIdent()
   } else if (node.type == "ObjectExpression") {
     node.type = "ObjectPattern"
-    let props = node.properties
-    for (let prop of props)
-      this.toAssignable(prop.value, binding)
+    for (let prop of node.properties)
+      this.toAssignable(prop, binding)
   } else if (node.type == "ArrayExpression") {
     node.type = "ArrayPattern"
     this.toAssignableList(node.elements, binding)
+  } else if (node.type == "Property") {
+    this.toAssignable(node.value, binding)
   } else if (node.type == "SpreadElement") {
     node.type = "RestElement"
     this.toAssignable(node.argument, binding)
diff --git a/src/loose/statement.js b/src/loose/statement.js
index 19e96b4..aa30696 100644
--- a/src/loose/statement.js
+++ b/src/loose/statement.js
@@ -49,7 +49,9 @@ lp.parseStatement = function() {
     return this.finishNode(node, "DoWhileStatement")
 
   case tt._for:
-    this.next()
+    this.next() // `for` keyword
+    let isAwait = this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await")
+
     this.pushCx()
     this.expect(tt.parenL)
     if (this.tok.type === tt.semi) return this.parseFor(node, null)
@@ -57,13 +59,20 @@ lp.parseStatement = function() {
     if (isLet || this.tok.type === tt._var || this.tok.type === tt._const) {
       let init = this.parseVar(true, isLet ? "let" : this.tok.value)
       if (init.declarations.length === 1 && (this.tok.type === tt._in || this.isContextual("of"))) {
+        if (this.options.ecmaVersion >= 9 && this.tok.type !== tt._in) {
+          node.await = isAwait
+        }
         return this.parseForIn(node, init)
       }
       return this.parseFor(node, init)
     }
     let init = this.parseExpression(true)
-    if (this.tok.type === tt._in || this.isContextual("of"))
+    if (this.tok.type === tt._in || this.isContextual("of")) {
+      if (this.options.ecmaVersion >= 9 && this.tok.type !== tt._in) {
+        node.await = isAwait
+      }
       return this.parseForIn(node, this.toAssignable(init))
+    }
     return this.parseFor(node, init)
 
   case tt._function:
@@ -282,8 +291,9 @@ lp.parseClass = function(isStatement) {
     if (!method.computed &&
         method.key.type === "Identifier" && method.key.name === "async" && this.tok.type !== tt.parenL &&
         !this.canInsertSemicolon()) {
-      this.parsePropertyName(method)
       isAsync = true
+      isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star)
+      this.parsePropertyName(method)
     } else {
       isAsync = false
     }
diff --git a/src/loose/tokenize.js b/src/loose/tokenize.js
index 2d5130b..619b6ee 100644
--- a/src/loose/tokenize.js
+++ b/src/loose/tokenize.js
@@ -91,7 +91,7 @@ lp.resetTo = function(pos) {
   let ch = this.input.charAt(pos - 1)
   this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) ||
     /[enwfd]/.test(ch) &&
-    /\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos))
+    /\b(case|else|return|throw|new|in|(instance|type)?of|delete|void)$/.test(this.input.slice(pos - 10, pos))
 
   if (this.options.locations) {
     this.toks.curLine = 1
diff --git a/src/lval.js b/src/lval.js
index c5da84a..0fc1bc5 100644
--- a/src/lval.js
+++ b/src/lval.js
@@ -23,8 +23,20 @@ pp.toAssignable = function(node, isBinding, refDestructuringErrors) {
     case "ObjectExpression":
       node.type = "ObjectPattern"
       if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true)
-      for (let prop of node.properties)
+      for (let prop of node.properties) {
         this.toAssignable(prop, isBinding)
+        // Early error:
+        //   AssignmentRestProperty[Yield, Await] :
+        //     `...` DestructuringAssignmentTarget[Yield, Await]
+        //
+        //   It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
+        if (
+          prop.type === "RestElement" &&
+          (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
+        ) {
+          this.raise(prop.argument.start, "Unexpected token")
+        }
+      }
       break
 
     case "Property":
diff --git a/src/statement.js b/src/statement.js
index db2fb8b..2612125 100644
--- a/src/statement.js
+++ b/src/statement.js
@@ -187,10 +187,14 @@ pp.parseDoStatement = function(node) {
 
 pp.parseForStatement = function(node) {
   this.next()
+  let awaitAt = (this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await")) ? this.lastTokStart : -1
   this.labels.push(loopLabel)
   this.enterLexicalScope()
   this.expect(tt.parenL)
-  if (this.type === tt.semi) return this.parseFor(node, null)
+  if (this.type === tt.semi) {
+    if (awaitAt > -1) this.unexpected(awaitAt)
+    return this.parseFor(node, null)
+  }
   let isLet = this.isLet()
   if (this.type === tt._var || this.type === tt._const || isLet) {
     let init = this.startNode(), kind = isLet ? "let" : this.value
@@ -198,19 +202,32 @@ pp.parseForStatement = function(node) {
     this.parseVar(init, true, kind)
     this.finishNode(init, "VariableDeclaration")
     if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1 &&
-        !(kind !== "var" && init.declarations[0].init))
+        !(kind !== "var" && init.declarations[0].init)) {
+      if (this.options.ecmaVersion >= 9) {
+        if (this.type === tt._in) {
+          if (awaitAt > -1) this.unexpected(awaitAt)
+        } else node.await = awaitAt > -1
+      }
       return this.parseForIn(node, init)
+    }
+    if (awaitAt > -1) this.unexpected(awaitAt)
     return this.parseFor(node, init)
   }
   let refDestructuringErrors = new DestructuringErrors
   let init = this.parseExpression(true, refDestructuringErrors)
   if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
+    if (this.options.ecmaVersion >= 9) {
+      if (this.type === tt._in) {
+        if (awaitAt > -1) this.unexpected(awaitAt)
+      } else node.await = awaitAt > -1
+    }
     this.toAssignable(init, false, refDestructuringErrors)
     this.checkLVal(init)
     return this.parseForIn(node, init)
   } else {
     this.checkExpressionErrors(refDestructuringErrors, true)
   }
+  if (awaitAt > -1) this.unexpected(awaitAt)
   return this.parseFor(node, init)
 }
 
@@ -468,7 +485,7 @@ pp.parseVarId = function(decl, kind) {
 
 pp.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {
   this.initFunction(node)
-  if (this.options.ecmaVersion >= 6 && !isAsync)
+  if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync)
     node.generator = this.eat(tt.star)
   if (this.options.ecmaVersion >= 8)
     node.async = !!isAsync
@@ -555,6 +572,7 @@ pp.parseClassMember = function(classBody) {
   if (!isGenerator) {
     if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
       isAsync = true
+      isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star)
     } else if (tryContextual("get")) {
       method.kind = "get"
     } else if (tryContextual("set")) {
@@ -665,13 +683,17 @@ pp.checkPatternExport = function(exports, pat) {
     this.checkExport(exports, pat.name, pat.start)
   else if (type == "ObjectPattern")
     for (let prop of pat.properties)
-      this.checkPatternExport(exports, prop.value)
+      this.checkPatternExport(exports, prop)
   else if (type == "ArrayPattern")
     for (let elt of pat.elements) {
       if (elt) this.checkPatternExport(exports, elt)
     }
+  else if (type == "Property")
+    this.checkPatternExport(exports, pat.value)
   else if (type == "AssignmentPattern")
     this.checkPatternExport(exports, pat.left)
+  else if (type == "RestElement")
+    this.checkPatternExport(exports, pat.argument)
   else if (type == "ParenthesizedExpression")
     this.checkPatternExport(exports, pat.expression)
 }
diff --git a/src/tokenize.js b/src/tokenize.js
index 27d6971..71dd840 100644
--- a/src/tokenize.js
+++ b/src/tokenize.js
@@ -401,15 +401,20 @@ pp.readRegexp = function() {
   }
   let content = this.input.slice(start, this.pos)
   ++this.pos
-  // Need to use `readWord1` because '\uXXXX' sequences are allowed
-  // here (don't ask).
+  let flagsStart = this.pos
   let mods = this.readWord1()
+  if (this.containsEsc) this.unexpected(flagsStart)
+
   let tmp = content, tmpFlags = ""
   if (mods) {
-    let validFlags = /^[gim]*$/
-    if (this.options.ecmaVersion >= 6) validFlags = /^[gimuy]*$/
-    if (this.options.ecmaVersion >= 9) validFlags = /^[gimsuy]*$/
-    if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag")
+    let validFlags = "gim"
+    if (this.options.ecmaVersion >= 6) validFlags += "uy"
+    if (this.options.ecmaVersion >= 9) validFlags += "s"
+    for (let i = 0; i < mods.length; i++) {
+      let mod = mods.charAt(i)
+      if (validFlags.indexOf(mod) == -1) this.raise(start, "Invalid regular expression flag")
+      if (mods.indexOf(mod, i + 1) > -1) this.raise(start, "Duplicate regular expression flag")
+    }
     if (mods.indexOf("u") >= 0) {
       if (regexpUnicodeSupport) {
         tmpFlags = "u"
@@ -665,10 +670,11 @@ pp.readEscapedChar = function(inTemplate) {
         octalStr = octalStr.slice(0, -1)
         octal = parseInt(octalStr, 8)
       }
-      if (octalStr !== "0" && (this.strict || inTemplate)) {
-        this.invalidStringToken(this.pos - 2, "Octal literal in strict mode")
-      }
       this.pos += octalStr.length - 1
+      ch = this.input.charCodeAt(this.pos)
+      if ((octalStr !== "0" || ch == 56 || ch == 57) && (this.strict || inTemplate)) {
+        this.invalidStringToken(this.pos - 1 - octalStr.length, "Octal literal in strict mode")
+      }
       return String.fromCharCode(octal)
     }
     return String.fromCharCode(ch)
diff --git a/src/walk/index.js b/src/walk/index.js
index d644087..ac46692 100644
--- a/src/walk/index.js
+++ b/src/walk/index.js
@@ -355,7 +355,7 @@ base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifi
 
 base.TaggedTemplateExpression = (node, st, c) => {
   c(node.tag, st, "Expression")
-  c(node.quasi, st)
+  c(node.quasi, st, "Expression")
 }
 base.ClassDeclaration = base.ClassExpression = (node, st, c) => c(node, st, "Class")
 base.Class = (node, st, c) => {
diff --git a/test/run.js b/test/run.js
index dce46c6..91ad384 100644
--- a/test/run.js
+++ b/test/run.js
@@ -10,6 +10,8 @@
     require("./tests-trailing-commas-in-func.js");
     require("./tests-template-literal-revision.js");
     require("./tests-directive.js");
+    require("./tests-rest-spread-properties.js");
+    require("./tests-async-iteration.js");
     acorn = require("../dist/acorn")
     require("../dist/acorn_loose")
   } else {
diff --git a/test/tests-async-iteration.js b/test/tests-async-iteration.js
new file mode 100644
index 0000000..9db423f
--- /dev/null
+++ b/test/tests-async-iteration.js
@@ -0,0 +1,1994 @@
+if (typeof exports != "undefined") {
+  var test = require("./driver.js").test
+  var testFail = require("./driver.js").testFail
+}
+
+//------------------------------------------------------------------------------
+// for-await-of
+//------------------------------------------------------------------------------
+
+test("async function f() { for await (x of xs); }", {
+  "type": "Program",
+  "start": 0,
+  "end": 43,
+  "body": [
+    {
+      "type": "FunctionDeclaration",
+      "start": 0,
+      "end": 43,
+      "id": {
+        "type": "Identifier",
+        "start": 15,
+        "end": 16,
+        "name": "f"
+      },
+      "generator": false,
+      "expression": false,
+      "async": true,
+      "params": [],
+      "body": {
+        "type": "BlockStatement",
+        "start": 19,
+        "end": 43,
+        "body": [
+          {
+            "type": "ForOfStatement",
+            "start": 21,
+            "end": 41,
+            "await": true,
+            "left": {
+              "type": "Identifier",
+              "start": 32,
+              "end": 33,
+              "name": "x"
+            },
+            "right": {
+              "type": "Identifier",
+              "start": 37,
+              "end": 39,
+              "name": "xs"
+            },
+            "body": {
+              "type": "EmptyStatement",
+              "start": 40,
+              "end": 41
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("async function f() { for await (var x of xs); }", {
+  "type": "Program",
+  "start": 0,
+  "end": 47,
+  "body": [
+    {
+      "type": "FunctionDeclaration",
+      "start": 0,
+      "end": 47,
+      "id": {
+        "type": "Identifier",
+        "start": 15,
+        "end": 16,
+        "name": "f"
+      },
+      "generator": false,
+      "expression": false,
+      "async": true,
+      "params": [],
+      "body": {
+        "type": "BlockStatement",
+        "start": 19,
+        "end": 47,
+        "body": [
+          {
+            "type": "ForOfStatement",
+            "start": 21,
+            "end": 45,
+            "await": true,
+            "left": {
+              "type": "VariableDeclaration",
+              "start": 32,
+              "end": 37,
+              "declarations": [
+                {
+                  "type": "VariableDeclarator",
+                  "start": 36,
+                  "end": 37,
+                  "id": {
+                    "type": "Identifier",
+                    "start": 36,
+                    "end": 37,
+                    "name": "x"
+                  },
+                  "init": null
+                }
+              ],
+              "kind": "var"
+            },
+            "right": {
+              "type": "Identifier",
+              "start": 41,
+              "end": 43,
+              "name": "xs"
+            },
+            "body": {
+              "type": "EmptyStatement",
+              "start": 44,
+              "end": 45
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("async function f() { for await (let x of xs); }", {
+  "type": "Program",
+  "start": 0,
+  "end": 47,
+  "body": [
+    {
+      "type": "FunctionDeclaration",
+      "start": 0,
+      "end": 47,
+      "id": {
+        "type": "Identifier",
+        "start": 15,
+        "end": 16,
+        "name": "f"
+      },
+      "generator": false,
+      "expression": false,
+      "async": true,
+      "params": [],
+      "body": {
+        "type": "BlockStatement",
+        "start": 19,
+        "end": 47,
+        "body": [
+          {
+            "type": "ForOfStatement",
+            "start": 21,
+            "end": 45,
+            "await": true,
+            "left": {
+              "type": "VariableDeclaration",
+              "start": 32,
+              "end": 37,
+              "declarations": [
+                {
+                  "type": "VariableDeclarator",
+                  "start": 36,
+                  "end": 37,
+                  "id": {
+                    "type": "Identifier",
+                    "start": 36,
+                    "end": 37,
+                    "name": "x"
+                  },
+                  "init": null
+                }
+              ],
+              "kind": "let"
+            },
+            "right": {
+              "type": "Identifier",
+              "start": 41,
+              "end": 43,
+              "name": "xs"
+            },
+            "body": {
+              "type": "EmptyStatement",
+              "start": 44,
+              "end": 45
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("async function f() { for\nawait (x of xs); }", {
+  "type": "Program",
+  "start": 0,
+  "end": 43,
+  "body": [
+    {
+      "type": "FunctionDeclaration",
+      "start": 0,
+      "end": 43,
+      "id": {
+        "type": "Identifier",
+        "start": 15,
+        "end": 16,
+        "name": "f"
+      },
+      "generator": false,
+      "expression": false,
+      "async": true,
+      "params": [],
+      "body": {
+        "type": "BlockStatement",
+        "start": 19,
+        "end": 43,
+        "body": [
+          {
+            "type": "ForOfStatement",
+            "start": 21,
+            "end": 41,
+            "await": true,
+            "left": {
+              "type": "Identifier",
+              "start": 32,
+              "end": 33,
+              "name": "x"
+            },
+            "right": {
+              "type": "Identifier",
+              "start": 37,
+              "end": 39,
+              "name": "xs"
+            },
+            "body": {
+              "type": "EmptyStatement",
+              "start": 40,
+              "end": 41
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("f = async function() { for await (x of xs); }", {
+  "type": "Program",
+  "start": 0,
+  "end": 45,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 45,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 0,
+        "end": 45,
+        "operator": "=",
+        "left": {
+          "type": "Identifier",
+          "start": 0,
+          "end": 1,
+          "name": "f"
+        },
+        "right": {
+          "type": "FunctionExpression",
+          "start": 4,
+          "end": 45,
+          "id": null,
+          "generator": false,
+          "expression": false,
+          "async": true,
+          "params": [],
+          "body": {
+            "type": "BlockStatement",
+            "start": 21,
+            "end": 45,
+            "body": [
+              {
+                "type": "ForOfStatement",
+                "start": 23,
+                "end": 43,
+                "await": true,
+                "left": {
+                  "type": "Identifier",
+                  "start": 34,
+                  "end": 35,
+                  "name": "x"
+                },
+                "right": {
+                  "type": "Identifier",
+                  "start": 39,
+                  "end": 41,
+                  "name": "xs"
+                },
+                "body": {
+                  "type": "EmptyStatement",
+                  "start": 42,
+                  "end": 43
+                }
+              }
+            ]
+          }
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("f = async() => { for await (x of xs); }", {
+  "type": "Program",
+  "start": 0,
+  "end": 39,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 39,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 0,
+        "end": 39,
+        "operator": "=",
+        "left": {
+          "type": "Identifier",
+          "start": 0,
+          "end": 1,
+          "name": "f"
+        },
+        "right": {
+          "type": "ArrowFunctionExpression",
+          "start": 4,
+          "end": 39,
+          "id": null,
+          "generator": false,
+          "expression": false,
+          "async": true,
+          "params": [],
+          "body": {
+            "type": "BlockStatement",
+            "start": 15,
+            "end": 39,
+            "body": [
+              {
+                "type": "ForOfStatement",
+                "start": 17,
+                "end": 37,
+                "await": true,
+                "left": {
+                  "type": "Identifier",
+                  "start": 28,
+                  "end": 29,
+                  "name": "x"
+                },
+                "right": {
+                  "type": "Identifier",
+                  "start": 33,
+                  "end": 35,
+                  "name": "xs"
+                },
+                "body": {
+                  "type": "EmptyStatement",
+                  "start": 36,
+                  "end": 37
+                }
+              }
+            ]
+          }
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("obj = { async f() { for await (x of xs); } }", {
+  "type": "Program",
+  "start": 0,
+  "end": 44,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 44,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 0,
+        "end": 44,
+        "operator": "=",
+        "left": {
+          "type": "Identifier",
+          "start": 0,
+          "end": 3,
+          "name": "obj"
+        },
+        "right": {
+          "type": "ObjectExpression",
+          "start": 6,
+          "end": 44,
+          "properties": [
+            {
+              "type": "Property",
+              "start": 8,
+              "end": 42,
+              "method": true,
+              "shorthand": false,
+              "computed": false,
+              "key": {
+                "type": "Identifier",
+                "start": 14,
+                "end": 15,
+                "name": "f"
+              },
+              "kind": "init",
+              "value": {
+                "type": "FunctionExpression",
+                "start": 15,
+                "end": 42,
+                "id": null,
+                "generator": false,
+                "expression": false,
+                "async": true,
+                "params": [],
+                "body": {
+                  "type": "BlockStatement",
+                  "start": 18,
+                  "end": 42,
+                  "body": [
+                    {
+                      "type": "ForOfStatement",
+                      "start": 20,
+                      "end": 40,
+                      "await": true,
+                      "left": {
+                        "type": "Identifier",
+                        "start": 31,
+                        "end": 32,
+                        "name": "x"
+                      },
+                      "right": {
+                        "type": "Identifier",
+                        "start": 36,
+                        "end": 38,
+                        "name": "xs"
+                      },
+                      "body": {
+                        "type": "EmptyStatement",
+                        "start": 39,
+                        "end": 40
+                      }
+                    }
+                  ]
+                }
+              }
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("class A { async f() { for await (x of xs); } }", {
+  "type": "Program",
+  "start": 0,
+  "end": 46,
+  "body": [
+    {
+      "type": "ClassDeclaration",
+      "start": 0,
+      "end": 46,
+      "id": {
+        "type": "Identifier",
+        "start": 6,
+        "end": 7,
+        "name": "A"
+      },
+      "superClass": null,
+      "body": {
+        "type": "ClassBody",
+        "start": 8,
+        "end": 46,
+        "body": [
+          {
+            "type": "MethodDefinition",
+            "start": 10,
+            "end": 44,
+            "kind": "method",
+            "static": false,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 16,
+              "end": 17,
+              "name": "f"
+            },
+            "value": {
+              "type": "FunctionExpression",
+              "start": 17,
+              "end": 44,
+              "id": null,
+              "generator": false,
+              "expression": false,
+              "async": true,
+              "params": [],
+              "body": {
+                "type": "BlockStatement",
+                "start": 20,
+                "end": 44,
+                "body": [
+                  {
+                    "type": "ForOfStatement",
+                    "start": 22,
+                    "end": 42,
+                    "await": true,
+                    "left": {
+                      "type": "Identifier",
+                      "start": 33,
+                      "end": 34,
+                      "name": "x"
+                    },
+                    "right": {
+                      "type": "Identifier",
+                      "start": 38,
+                      "end": 40,
+                      "name": "xs"
+                    },
+                    "body": {
+                      "type": "EmptyStatement",
+                      "start": 41,
+                      "end": 42
+                    }
+                  }
+                ]
+              }
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+
+// ForOfStatement has `await:false` in `ecmaVersion:9`
+test("for (x of xs);", {
+  "type": "Program",
+  "start": 0,
+  "end": 14,
+  "body": [
+    {
+      "type": "ForOfStatement",
+      "start": 0,
+      "end": 14,
+      "await": false,
+      "left": {
+        "type": "Identifier",
+        "start": 5,
+        "end": 6,
+        "name": "x"
+      },
+      "right": {
+        "type": "Identifier",
+        "start": 10,
+        "end": 12,
+        "name": "xs"
+      },
+      "body": {
+        "type": "EmptyStatement",
+        "start": 13,
+        "end": 14
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+
+// ForInStatement doesn't have `await:false` in `ecmaVersion:9`
+test("for (x in xs);", {
+  "type": "Program",
+  "start": 0,
+  "end": 14,
+  "body": [
+    {
+      "type": "ForInStatement",
+      "start": 0,
+      "end": 14,
+      "await": undefined,
+      "left": {
+        "type": "Identifier",
+        "start": 5,
+        "end": 6,
+        "name": "x"
+      },
+      "right": {
+        "type": "Identifier",
+        "start": 10,
+        "end": 12,
+        "name": "xs"
+      },
+      "body": {
+        "type": "EmptyStatement",
+        "start": 13,
+        "end": 14
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+
+// ForOfStatement doesn't have `await:false` in `ecmaVersion:8`
+test("for (x of xs);", {
+  "type": "Program",
+  "start": 0,
+  "end": 14,
+  "body": [
+    {
+      "type": "ForOfStatement",
+      "start": 0,
+      "end": 14,
+      "await": undefined,
+      "left": {
+        "type": "Identifier",
+        "start": 5,
+        "end": 6,
+        "name": "x"
+      },
+      "right": {
+        "type": "Identifier",
+        "start": 10,
+        "end": 12,
+        "name": "xs"
+      },
+      "body": {
+        "type": "EmptyStatement",
+        "start": 13,
+        "end": 14
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 8 })
+
+testFail("for await (x of xs);", "Unexpected token (1:4)", { ecmaVersion: 9 })
+testFail("function f() { for await (x of xs); }", "Unexpected token (1:19)", { ecmaVersion: 9 })
+testFail("f = function() { for await (x of xs); }", "Unexpected token (1:21)", { ecmaVersion: 9 })
+testFail("f = () => { for await (x of xs); }", "Unexpected token (1:16)", { ecmaVersion: 9 })
+testFail("async function f() { () => { for await (x of xs); } }", "Unexpected token (1:33)", { ecmaVersion: 9 })
+testFail("async function f() { for await (x in xs); }", "Unexpected token (1:25)", { ecmaVersion: 9 })
+testFail("async function f() { for await (;;); }", "Unexpected token (1:25)", { ecmaVersion: 9 })
+testFail("async function f() { for await (x;;); }", "Unexpected token (1:25)", { ecmaVersion: 9 })
+testFail("async function f() { for await (let x = 0;;); }", "Unexpected token (1:25)", { ecmaVersion: 9 })
+testFail("async function f() { for await (x of xs); }", "Unexpected token (1:25)", { ecmaVersion: 8 })
+
+//------------------------------------------------------------------------------
+// FunctionDeclaration#await
+//------------------------------------------------------------------------------
+
+test("async function* f() { await a; yield b; }", {
+  "type": "Program",
+  "start": 0,
+  "end": 41,
+  "body": [
+    {
+      "type": "FunctionDeclaration",
+      "start": 0,
+      "end": 41,
+      "id": {
+        "type": "Identifier",
+        "start": 16,
+        "end": 17,
+        "name": "f"
+      },
+      "generator": true,
+      "expression": false,
+      "async": true,
+      "params": [],
+      "body": {
+        "type": "BlockStatement",
+        "start": 20,
+        "end": 41,
+        "body": [
+          {
+            "type": "ExpressionStatement",
+            "start": 22,
+            "end": 30,
+            "expression": {
+              "type": "AwaitExpression",
+              "start": 22,
+              "end": 29,
+              "argument": {
+                "type": "Identifier",
+                "start": 28,
+                "end": 29,
+                "name": "a"
+              }
+            }
+          },
+          {
+            "type": "ExpressionStatement",
+            "start": 31,
+            "end": 39,
+            "expression": {
+              "type": "YieldExpression",
+              "start": 31,
+              "end": 38,
+              "delegate": false,
+              "argument": {
+                "type": "Identifier",
+                "start": 37,
+                "end": 38,
+                "name": "b"
+              }
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+
+testFail("async function* f() { () => await a; }", "Unexpected token (1:34)", { ecmaVersion: 9 })
+testFail("async function* f() { () => yield a; }", "Unexpected token (1:34)", { ecmaVersion: 9 })
+
+testFail("async function* f() { await a; yield b; }", "Unexpected token (1:14)", { ecmaVersion: 8 })
+
+//------------------------------------------------------------------------------
+// FunctionExpression#await
+//------------------------------------------------------------------------------
+
+test("f = async function*() { await a; yield b; }", {
+  "type": "Program",
+  "start": 0,
+  "end": 43,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 43,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 0,
+        "end": 43,
+        "operator": "=",
+        "left": {
+          "type": "Identifier",
+          "start": 0,
+          "end": 1,
+          "name": "f"
+        },
+        "right": {
+          "type": "FunctionExpression",
+          "start": 4,
+          "end": 43,
+          "id": null,
+          "generator": true,
+          "expression": false,
+          "async": true,
+          "params": [],
+          "body": {
+            "type": "BlockStatement",
+            "start": 22,
+            "end": 43,
+            "body": [
+              {
+                "type": "ExpressionStatement",
+                "start": 24,
+                "end": 32,
+                "expression": {
+                  "type": "AwaitExpression",
+                  "start": 24,
+                  "end": 31,
+                  "argument": {
+                    "type": "Identifier",
+                    "start": 30,
+                    "end": 31,
+                    "name": "a"
+                  }
+                }
+              },
+              {
+                "type": "ExpressionStatement",
+                "start": 33,
+                "end": 41,
+                "expression": {
+                  "type": "YieldExpression",
+                  "start": 33,
+                  "end": 40,
+                  "delegate": false,
+                  "argument": {
+                    "type": "Identifier",
+                    "start": 39,
+                    "end": 40,
+                    "name": "b"
+                  }
+                }
+              }
+            ]
+          }
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("obj = { async* f() { await a; yield b; } }", {
+  "type": "Program",
+  "start": 0,
+  "end": 42,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 42,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 0,
+        "end": 42,
+        "operator": "=",
+        "left": {
+          "type": "Identifier",
+          "start": 0,
+          "end": 3,
+          "name": "obj"
+        },
+        "right": {
+          "type": "ObjectExpression",
+          "start": 6,
+          "end": 42,
+          "properties": [
+            {
+              "type": "Property",
+              "start": 8,
+              "end": 40,
+              "method": true,
+              "shorthand": false,
+              "computed": false,
+              "key": {
+                "type": "Identifier",
+                "start": 15,
+                "end": 16,
+                "name": "f"
+              },
+              "kind": "init",
+              "value": {
+                "type": "FunctionExpression",
+                "start": 16,
+                "end": 40,
+                "id": null,
+                "generator": true,
+                "expression": false,
+                "async": true,
+                "params": [],
+                "body": {
+                  "type": "BlockStatement",
+                  "start": 19,
+                  "end": 40,
+                  "body": [
+                    {
+                      "type": "ExpressionStatement",
+                      "start": 21,
+                      "end": 29,
+                      "expression": {
+                        "type": "AwaitExpression",
+                        "start": 21,
+                        "end": 28,
+                        "argument": {
+                          "type": "Identifier",
+                          "start": 27,
+                          "end": 28,
+                          "name": "a"
+                        }
+                      }
+                    },
+                    {
+                      "type": "ExpressionStatement",
+                      "start": 30,
+                      "end": 38,
+                      "expression": {
+                        "type": "YieldExpression",
+                        "start": 30,
+                        "end": 37,
+                        "delegate": false,
+                        "argument": {
+                          "type": "Identifier",
+                          "start": 36,
+                          "end": 37,
+                          "name": "b"
+                        }
+                      }
+                    }
+                  ]
+                }
+              }
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("class A { async* f() { await a; yield b; } }", {
+  "type": "Program",
+  "start": 0,
+  "end": 44,
+  "body": [
+    {
+      "type": "ClassDeclaration",
+      "start": 0,
+      "end": 44,
+      "id": {
+        "type": "Identifier",
+        "start": 6,
+        "end": 7,
+        "name": "A"
+      },
+      "superClass": null,
+      "body": {
+        "type": "ClassBody",
+        "start": 8,
+        "end": 44,
+        "body": [
+          {
+            "type": "MethodDefinition",
+            "start": 10,
+            "end": 42,
+            "kind": "method",
+            "static": false,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 17,
+              "end": 18,
+              "name": "f"
+            },
+            "value": {
+              "type": "FunctionExpression",
+              "start": 18,
+              "end": 42,
+              "id": null,
+              "generator": true,
+              "expression": false,
+              "async": true,
+              "params": [],
+              "body": {
+                "type": "BlockStatement",
+                "start": 21,
+                "end": 42,
+                "body": [
+                  {
+                    "type": "ExpressionStatement",
+                    "start": 23,
+                    "end": 31,
+                    "expression": {
+                      "type": "AwaitExpression",
+                      "start": 23,
+                      "end": 30,
+                      "argument": {
+                        "type": "Identifier",
+                        "start": 29,
+                        "end": 30,
+                        "name": "a"
+                      }
+                    }
+                  },
+                  {
+                    "type": "ExpressionStatement",
+                    "start": 32,
+                    "end": 40,
+                    "expression": {
+                      "type": "YieldExpression",
+                      "start": 32,
+                      "end": 39,
+                      "delegate": false,
+                      "argument": {
+                        "type": "Identifier",
+                        "start": 38,
+                        "end": 39,
+                        "name": "b"
+                      }
+                    }
+                  }
+                ]
+              }
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("class A { static async* f() { await a; yield b; } }", {
+  "type": "Program",
+  "start": 0,
+  "end": 51,
+  "body": [
+    {
+      "type": "ClassDeclaration",
+      "start": 0,
+      "end": 51,
+      "id": {
+        "type": "Identifier",
+        "start": 6,
+        "end": 7,
+        "name": "A"
+      },
+      "superClass": null,
+      "body": {
+        "type": "ClassBody",
+        "start": 8,
+        "end": 51,
+        "body": [
+          {
+            "type": "MethodDefinition",
+            "start": 10,
+            "end": 49,
+            "kind": "method",
+            "static": true,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 24,
+              "end": 25,
+              "name": "f"
+            },
+            "value": {
+              "type": "FunctionExpression",
+              "start": 25,
+              "end": 49,
+              "id": null,
+              "generator": true,
+              "expression": false,
+              "async": true,
+              "params": [],
+              "body": {
+                "type": "BlockStatement",
+                "start": 28,
+                "end": 49,
+                "body": [
+                  {
+                    "type": "ExpressionStatement",
+                    "start": 30,
+                    "end": 38,
+                    "expression": {
+                      "type": "AwaitExpression",
+                      "start": 30,
+                      "end": 37,
+                      "argument": {
+                        "type": "Identifier",
+                        "start": 36,
+                        "end": 37,
+                        "name": "a"
+                      }
+                    }
+                  },
+                  {
+                    "type": "ExpressionStatement",
+                    "start": 39,
+                    "end": 47,
+                    "expression": {
+                      "type": "YieldExpression",
+                      "start": 39,
+                      "end": 46,
+                      "delegate": false,
+                      "argument": {
+                        "type": "Identifier",
+                        "start": 45,
+                        "end": 46,
+                        "name": "b"
+                      }
+                    }
+                  }
+                ]
+              }
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+
+testFail("f = async function*() { () => await a; }", "Unexpected token (1:36)", { ecmaVersion: 9 })
+testFail("f = async function*() { () => yield a; }", "Unexpected token (1:36)", { ecmaVersion: 9 })
+testFail("obj = { async\n* f() {} }", "Unexpected token (2:0)", { ecmaVersion: 9 })
+testFail("obj = { *async f() {}", "Unexpected token (1:15)", { ecmaVersion: 9 })
+testFail("obj = { *async* f() {}", "Unexpected token (1:14)", { ecmaVersion: 9 })
+testFail("obj = { async* f() { () => await a; } }", "Unexpected token (1:33)", { ecmaVersion: 9 })
+testFail("obj = { async* f() { () => yield a; } }", "Unexpected token (1:33)", { ecmaVersion: 9 })
+testFail("class A { async\n* f() {} }", "Unexpected token (2:0)", { ecmaVersion: 9 })
+testFail("class A { *async f() {} }", "Unexpected token (1:17)", { ecmaVersion: 9 })
+testFail("class A { *async* f() {} }", "Unexpected token (1:16)", { ecmaVersion: 9 })
+testFail("class A { async* f() { () => await a; } }", "Unexpected token (1:35)", { ecmaVersion: 9 })
+testFail("class A { async* f() { () => yield a; } }", "Unexpected token (1:35)", { ecmaVersion: 9 })
+
+testFail("f = async function*() { await a; yield b; }", "Unexpected token (1:18)", { ecmaVersion: 8 })
+testFail("obj = { async* f() { await a; yield b; } }", "Unexpected token (1:13)", { ecmaVersion: 8 })
+testFail("class A { async* f() { await a; yield b; } }", "Unexpected token (1:15)", { ecmaVersion: 8 })
+
+//------------------------------------------------------------------------------
+// From https://github.com/acornjs/acorn-async-iteration/blob/fc72be2928ed0ffd46041f8c19052a9a282602ea/test/test.js
+//------------------------------------------------------------------------------
+
+// Commented this test out because this should throw syntax error.
+// for-await-of statements can be only in async functions.
+//
+// test("for await (const line of readLines(filePath)) {\n  console.log(line);\n}", {
+//   "type": "Program",
+//   "start": 0,
+//   "end": 70,
+//   "body": [
+//     {
+//       "type": "ForOfStatement",
+//       "start": 0,
+//       "end": 70,
+//       "await": true,
+//       "left": {
+//         "type": "VariableDeclaration",
+//         "start": 11,
+//         "end": 21,
+//         "declarations": [
+//           {
+//             "type": "VariableDeclarator",
+//             "start": 17,
+//             "end": 21,
+//             "id": {
+//               "type": "Identifier",
+//               "start": 17,
+//               "end": 21,
+//               "name": "line"
+//             },
+//             "init": null
+//           }
+//         ],
+//         "kind": "const"
+//       },
+//       "right": {
+//         "type": "CallExpression",
+//         "start": 25,
+//         "end": 44,
+//         "callee": {
+//           "type": "Identifier",
+//           "start": 25,
+//           "end": 34,
+//           "name": "readLines"
+//         },
+//         "arguments": [
+//           {
+//             "type": "Identifier",
+//             "start": 35,
+//             "end": 43,
+//             "name": "filePath"
+//           }
+//         ]
+//       },
+//       "body": {
+//         "type": "BlockStatement",
+//         "start": 46,
+//         "end": 70,
+//         "body": [
+//           {
+//             "type": "ExpressionStatement",
+//             "start": 50,
+//             "end": 68,
+//             "expression": {
+//               "type": "CallExpression",
+//               "start": 50,
+//               "end": 67,
+//               "callee": {
+//                 "type": "MemberExpression",
+//                 "start": 50,
+//                 "end": 61,
+//                 "object": {
+//                   "type": "Identifier",
+//                   "start": 50,
+//                   "end": 57,
+//                   "name": "console"
+//                 },
+//                 "property": {
+//                   "type": "Identifier",
+//                   "start": 58,
+//                   "end": 61,
+//                   "name": "log"
+//                 },
+//                 "computed": false
+//               },
+//               "arguments": [
+//                 {
+//                   "type": "Identifier",
+//                   "start": 62,
+//                   "end": 66,
+//                   "name": "line"
+//                 }
+//               ]
+//             }
+//           }
+//         ]
+//       }
+//     }
+//   ],
+//   "sourceType": "script"
+// }, { "ecmaVersion": 9 })
+test("async function* x() {}", {}, { "ecmaVersion": 9 })
+test("ref = async function*() {}", {}, { "ecmaVersion": 9 })
+test("(async function*() {})", {}, { "ecmaVersion": 9 })
+test("var gen = { async *method() {} }", {
+  "type": "Program",
+  "start": 0,
+  "end": 32,
+  "body": [
+    {
+      "type": "VariableDeclaration",
+      "start": 0,
+      "end": 32,
+      "declarations": [
+        {
+          "type": "VariableDeclarator",
+          "start": 4,
+          "end": 32,
+          "id": {
+            "type": "Identifier",
+            "start": 4,
+            "end": 7,
+            "name": "gen"
+          },
+          "init": {
+            "type": "ObjectExpression",
+            "start": 10,
+            "end": 32,
+            "properties": [
+              {
+                "type": "Property",
+                "start": 12,
+                "end": 30,
+                "method": true,
+                "shorthand": false,
+                "computed": false,
+                "key": {
+                  "type": "Identifier",
+                  "start": 19,
+                  "end": 25,
+                  "name": "method"
+                },
+                "kind": "init",
+                "value": {
+                  "type": "FunctionExpression",
+                  "start": 25,
+                  "end": 30,
+                  "id": null,
+                  "generator": true,
+                  "expression": false,
+                  "async": true,
+                  "params": [],
+                  "body": {
+                    "body": [],
+                    "end": 30,
+                    "start": 28,
+                    "type": "BlockStatement"
+                  }
+                }
+              }
+            ]
+          }
+        }
+      ],
+      "kind": "var"
+    }
+  ],
+  "sourceType": "script"
+}, { "ecmaVersion": 9 })
+test("export default async function*() {}", {
+  "type": "Program",
+  "start": 0,
+  "end": 35,
+  "body": [
+    {
+      "type": "ExportDefaultDeclaration",
+      "start": 0,
+      "end": 35,
+      "declaration": {
+        "type": "FunctionDeclaration",
+        "start": 15,
+        "end": 35,
+        "id": null,
+        "generator": true,
+        "expression": false,
+        "async": true,
+        "params": [],
+        "body": {
+          "body": [],
+          "end": 35,
+          "start": 33,
+          "type": "BlockStatement"
+        }
+      }
+    }
+  ],
+  "sourceType": "module"
+}, { "ecmaVersion": 9, "sourceType": "module" })
+test("var C = class { async *method() {} }", {}, { "ecmaVersion": 9 })
+
+// Commented the tests of direct `super()` calls out because this is not unique matter in async iteration syntax.
+// Class's constructor is the only place which allows `super()`.
+// See also: https://github.com/acornjs/acorn/issues/448
+//
+// test("var C = class { static async *method() {} }", {}, { "ecmaVersion": 9 })
+// testFail("async function* x() { super(); }", "", { "ecmaVersion": 9 })
+// testFail("ref = async function*() { super(); }", "", { "ecmaVersion": 9 })
+// testFail("(async function*() { super(); })", "", { "ecmaVersion": 9 })
+// testFail("var gen = { async *method() { super(); } }", "", { "ecmaVersion": 9 })
+// testFail("export default async function*() { super(); }", "", { "ecmaVersion": 9, "sourceType": "module" })
+// testFail("var C = class { async *method() { super(); } }", "", { "ecmaVersion": 9 })
+// testFail("var C = class { static async *method() { super(); } }", "", { "ecmaVersion": 9 })
+// test("async function* x() { var x = () => { super(); } }", {}, { "ecmaVersion": 9 })
+// test("ref = async function*() { var x = () => { super(); } }", {}, { "ecmaVersion": 9 })
+// test("(async function*() { var x = () => { super(); } })", {}, { "ecmaVersion": 9 })
+// test("var gen = { async *method() { var x = () => { super(); } } }", {
+//   "type": "Program",
+//   "start": 0,
+//   "end": 60,
+//   "body": [
+//     {
+//       "type": "VariableDeclaration",
+//       "start": 0,
+//       "end": 60,
+//       "declarations": [
+//         {
+//           "type": "VariableDeclarator",
+//           "start": 4,
+//           "end": 60,
+//           "id": {
+//             "type": "Identifier",
+//             "start": 4,
+//             "end": 7,
+//             "name": "gen"
+//           },
+//           "init": {
+//             "type": "ObjectExpression",
+//             "start": 10,
+//             "end": 60,
+//             "properties": [
+//               {
+//                 "type": "Property",
+//                 "start": 12,
+//                 "end": 58,
+//                 "method": true,
+//                 "shorthand": false,
+//                 "computed": false,
+//                 "key": {
+//                   "type": "Identifier",
+//                   "start": 19,
+//                   "end": 25,
+//                   "name": "method"
+//                 },
+//                 "kind": "init",
+//                 "value": {
+//                   "type": "FunctionExpression",
+//                   "start": 25,
+//                   "end": 58,
+//                   "id": null,
+//                   "generator": true,
+//                   "expression": false,
+//                   "async": true,
+//                   "params": [],
+//                   "body": {
+//                     "end": 58,
+//                     "start": 28,
+//                     "type": "BlockStatement",
+//                     "body": [
+//                       {
+//                         "type": "VariableDeclaration",
+//                         "start": 30,
+//                         "end": 56,
+//                         "kind": "var",
+//                         "declarations": [
+//                           {
+//                             "type": "VariableDeclarator",
+//                             "start": 34,
+//                             "end": 56,
+//                             "id": {
+//                               "type": "Identifier",
+//                               "start": 34,
+//                               "end": 35,
+//                               "name": "x"
+//                             },
+//                             "init": {
+//                               "type": "ArrowFunctionExpression",
+//                               "start": 38,
+//                               "end": 56,
+//                               "id": null,
+//                               "generator": false,
+//                               "expression": false,
+//                               "async": false,
+//                               "params": [],
+//                               "body": {
+//                                 "type": "BlockStatement",
+//                                 "start": 44,
+//                                 "end": 56,
+//                                 "body": [
+//                                   {
+//                                     "type": "ExpressionStatement",
+//                                     "start": 46,
+//                                     "end": 54,
+//                                     "expression": {
+//                                       "type": "CallExpression",
+//                                       "start": 46,
+//                                       "end": 53,
+//                                       "callee": {
+//                                         "type": "Super",
+//                                         "start": 46,
+//                                         "end": 51
+//                                       },
+//                                       "arguments": []
+//                                     }
+//                                   }
+//                                 ]
+//                               }
+//                             }
+//                           }
+//                         ]
+//                       }
+//                     ]
+//                   }
+//                 }
+//               }
+//             ]
+//           }
+//         }
+//       ],
+//       "kind": "var"
+//     }
+//   ],
+//   "sourceType": "script"
+// }, { "ecmaVersion": 9 })
+// test("export default async function*() { var x = () => { super(); } }", {
+//   "type": "Program",
+//   "start": 0,
+//   "end": 63,
+//   "body": [
+//     {
+//       "type": "ExportDefaultDeclaration",
+//       "start": 0,
+//       "end": 63,
+//       "declaration": {
+//         "type": "FunctionDeclaration",
+//         "start": 15,
+//         "end": 63,
+//         "id": null,
+//         "generator": true,
+//         "expression": false,
+//         "async": true,
+//         "params": [],
+//         "body": {
+//           "end": 63,
+//           "start": 33,
+//           "type": "BlockStatement",
+//           "body": [
+//             {
+//               "type": "VariableDeclaration",
+//               "start": 35,
+//               "end": 61,
+//               "kind": "var",
+//               "declarations": [
+//                 {
+//                   "type": "VariableDeclarator",
+//                   "start": 39,
+//                   "end": 61,
+//                   "id": {
+//                     "type": "Identifier",
+//                     "start": 39,
+//                     "end": 40,
+//                     "name": "x"
+//                   },
+//                   "init": {
+//                     "type": "ArrowFunctionExpression",
+//                     "start": 43,
+//                     "end": 61,
+//                     "id": null,
+//                     "generator": false,
+//                     "expression": false,
+//                     "async": false,
+//                     "params": [],
+//                     "body": {
+//                       "type": "BlockStatement",
+//                       "start": 49,
+//                       "end": 61,
+//                       "body": [
+//                         {
+//                           "type": "ExpressionStatement",
+//                           "start": 51,
+//                           "end": 59,
+//                           "expression": {
+//                             "type": "CallExpression",
+//                             "start": 51,
+//                             "end": 58,
+//                             "callee": {
+//                               "type": "Super",
+//                               "start": 51,
+//                               "end": 56
+//                             },
+//                             "arguments": []
+//                           }
+//                         }
+//                       ]
+//                     }
+//                   }
+//                 }
+//               ]
+//             }
+//           ]
+//         }
+//       }
+//     }
+//   ],
+//   "sourceType": "module"
+// }, { "ecmaVersion": 9, "sourceType": "module" })
+// test("var C = class { async *method() { var x = () => { super(); } } }", {}, { "ecmaVersion": 9 })
+// test("var C = class { static async *method() { var x = () => { super(); } } }", {}, { "ecmaVersion": 9 })
+// test("async function* x() { var x = function () { super(); } }", {}, { "ecmaVersion": 9 })
+// test("ref = async function*() { var x = function () { super(); } }", {}, { "ecmaVersion": 9 })
+// test("(async function*() { var x = function () { super(); } })", {}, { "ecmaVersion": 9 })
+// test("var gen = { async *method() { var x = function () { super(); } } }", {
+//   "type": "Program",
+//   "start": 0,
+//   "end": 66,
+//   "body": [
+//     {
+//       "type": "VariableDeclaration",
+//       "start": 0,
+//       "end": 66,
+//       "declarations": [
+//         {
+//           "type": "VariableDeclarator",
+//           "start": 4,
+//           "end": 66,
+//           "id": {
+//             "type": "Identifier",
+//             "start": 4,
+//             "end": 7,
+//             "name": "gen"
+//           },
+//           "init": {
+//             "type": "ObjectExpression",
+//             "start": 10,
+//             "end": 66,
+//             "properties": [
+//               {
+//                 "type": "Property",
+//                 "start": 12,
+//                 "end": 64,
+//                 "method": true,
+//                 "shorthand": false,
+//                 "computed": false,
+//                 "key": {
+//                   "type": "Identifier",
+//                   "start": 19,
+//                   "end": 25,
+//                   "name": "method"
+//                 },
+//                 "kind": "init",
+//                 "value": {
+//                   "type": "FunctionExpression",
+//                   "start": 25,
+//                   "end": 64,
+//                   "id": null,
+//                   "generator": true,
+//                   "expression": false,
+//                   "async": true,
+//                   "params": [],
+//                   "body": {
+//                     "end": 64,
+//                     "start": 28,
+//                     "type": "BlockStatement",
+//                     "body": [
+//                       {
+//                         "type": "VariableDeclaration",
+//                         "start": 30,
+//                         "end": 62,
+//                         "kind": "var",
+//                         "declarations": [
+//                           {
+//                             "type": "VariableDeclarator",
+//                             "start": 34,
+//                             "end": 62,
+//                             "id": {
+//                               "type": "Identifier",
+//                               "start": 34,
+//                               "end": 35,
+//                               "name": "x"
+//                             },
+//                             "init": {
+//                               "type": "FunctionExpression",
+//                               "start": 38,
+//                               "end": 62,
+//                               "id": null,
+//                               "generator": false,
+//                               "expression": false,
+//                               "async": false,
+//                               "params": [],
+//                               "body": {
+//                                 "type": "BlockStatement",
+//                                 "start": 50,
+//                                 "end": 62,
+//                                 "body": [
+//                                   {
+//                                     "type": "ExpressionStatement",
+//                                     "start": 52,
+//                                     "end": 60,
+//                                     "expression": {
+//                                       "type": "CallExpression",
+//                                       "start": 52,
+//                                       "end": 59,
+//                                       "callee": {
+//                                         "type": "Super",
+//                                         "start": 52,
+//                                         "end": 57
+//                                       },
+//                                       "arguments": []
+//                                     }
+//                                   }
+//                                 ]
+//                               }
+//                             }
+//                           }
+//                         ]
+//                       }
+//                     ]
+//                   }
+//                 }
+//               }
+//             ]
+//           }
+//         }
+//       ],
+//       "kind": "var"
+//     }
+//   ],
+//   "sourceType": "script"
+// }, { "ecmaVersion": 9 })
+// test("export default async function*() { var x = function () { super(); } }", {
+//   "type": "Program",
+//   "start": 0,
+//   "end": 69,
+//   "body": [
+//     {
+//       "type": "ExportDefaultDeclaration",
+//       "start": 0,
+//       "end": 69,
+//       "declaration": {
+//         "type": "FunctionDeclaration",
+//         "start": 15,
+//         "end": 69,
+//         "id": null,
+//         "generator": true,
+//         "expression": false,
+//         "async": true,
+//         "params": [],
+//         "body": {
+//           "end": 69,
+//           "start": 33,
+//           "type": "BlockStatement",
+//           "body": [
+//             {
+//               "type": "VariableDeclaration",
+//               "start": 35,
+//               "end": 67,
+//               "kind": "var",
+//               "declarations": [
+//                 {
+//                   "type": "VariableDeclarator",
+//                   "start": 39,
+//                   "end": 67,
+//                   "id": {
+//                     "type": "Identifier",
+//                     "start": 39,
+//                     "end": 40,
+//                     "name": "x"
+//                   },
+//                   "init": {
+//                     "type": "FunctionExpression",
+//                     "start": 43,
+//                     "end": 67,
+//                     "id": null,
+//                     "generator": false,
+//                     "expression": false,
+//                     "async": false,
+//                     "params": [],
+//                     "body": {
+//                       "type": "BlockStatement",
+//                       "start": 55,
+//                       "end": 67,
+//                       "body": [
+//                         {
+//                           "type": "ExpressionStatement",
+//                           "start": 57,
+//                           "end": 65,
+//                           "expression": {
+//                             "type": "CallExpression",
+//                             "start": 57,
+//                             "end": 64,
+//                             "callee": {
+//                               "type": "Super",
+//                               "start": 57,
+//                               "end": 62
+//                             },
+//                             "arguments": []
+//                           }
+//                         }
+//                       ]
+//                     }
+//                   }
+//                 }
+//               ]
+//             }
+//           ]
+//         }
+//       }
+//     }
+//   ],
+//   "sourceType": "module"
+// }, { "ecmaVersion": 9, "sourceType": "module" })
+// test("var C = class { async *method() { var x = function () { super(); } } }", {}, { "ecmaVersion": 9 })
+// test("var C = class { static async *method() { var x = function () { super(); } } }", {}, { "ecmaVersion": 9 })
+// test("async function* x() { var x = { y: function () { super(); } } }", {}, { "ecmaVersion": 9 })
+// test("ref = async function*() { var x = { y: function () { super(); } } }", {}, { "ecmaVersion": 9 })
+// test("(async function*() { var x = { y: function () { super(); } } })", {}, { "ecmaVersion": 9 })
+// test("var gen = { async *method() { var x = { y: function () { super(); } } } }", {
+//   "type": "Program",
+//   "start": 0,
+//   "end": 73,
+//   "body": [
+//     {
+//       "type": "VariableDeclaration",
+//       "start": 0,
+//       "end": 73,
+//       "declarations": [
+//         {
+//           "type": "VariableDeclarator",
+//           "start": 4,
+//           "end": 73,
+//           "id": {
+//             "type": "Identifier",
+//             "start": 4,
+//             "end": 7,
+//             "name": "gen"
+//           },
+//           "init": {
+//             "type": "ObjectExpression",
+//             "start": 10,
+//             "end": 73,
+//             "properties": [
+//               {
+//                 "type": "Property",
+//                 "start": 12,
+//                 "end": 71,
+//                 "method": true,
+//                 "shorthand": false,
+//                 "computed": false,
+//                 "key": {
+//                   "type": "Identifier",
+//                   "start": 19,
+//                   "end": 25,
+//                   "name": "method"
+//                 },
+//                 "kind": "init",
+//                 "value": {
+//                   "type": "FunctionExpression",
+//                   "start": 25,
+//                   "end": 71,
+//                   "id": null,
+//                   "generator": true,
+//                   "expression": false,
+//                   "async": true,
+//                   "params": [],
+//                   "body": {
+//                     "type": "BlockStatement",
+//                     "start": 28,
+//                     "end": 71,
+//                     "body": [
+//                       {
+//                         "type": "VariableDeclaration",
+//                         "start": 30,
+//                         "end": 69,
+//                         "declarations": [
+//                           {
+//                             "type": "VariableDeclarator",
+//                             "start": 34,
+//                             "end": 69,
+//                             "id": {
+//                               "type": "Identifier",
+//                               "start": 34,
+//                               "end": 35,
+//                               "name": "x"
+//                             },
+//                             "init": {
+//                               "type": "ObjectExpression",
+//                               "start": 38,
+//                               "end": 69,
+//                               "properties": [
+//                                 {
+//                                   "type": "Property",
+//                                   "start": 40,
+//                                   "end": 67,
+//                                   "method": false,
+//                                   "shorthand": false,
+//                                   "computed": false,
+//                                   "key": {
+//                                     "type": "Identifier",
+//                                     "start": 40,
+//                                     "end": 41,
+//                                     "name": "y"
+//                                   },
+//                                   "value": {
+//                                     "type": "FunctionExpression",
+//                                     "start": 43,
+//                                     "end": 67,
+//                                     "id": null,
+//                                     "generator": false,
+//                                     "expression": false,
+//                                     "async": false,
+//                                     "params": [],
+//                                     "body": {
+//                                       "type": "BlockStatement",
+//                                       "start": 55,
+//                                       "end": 67,
+//                                       "body": [
+//                                         {
+//                                           "type": "ExpressionStatement",
+//                                           "start": 57,
+//                                           "end": 65,
+//                                           "expression": {
+//                                             "type": "CallExpression",
+//                                             "start": 57,
+//                                             "end": 64,
+//                                             "callee": {
+//                                               "type": "Super",
+//                                               "start": 57,
+//                                               "end": 62
+//                                             },
+//                                             "arguments": []
+//                                           }
+//                                         }
+//                                       ]
+//                                     }
+//                                   },
+//                                   "kind": "init"
+//                                 }
+//                               ]
+//                             }
+//                           }
+//                         ],
+//                         "kind": "var"
+//                       }
+//                     ]
+//                   }
+//                 }
+//               }
+//             ]
+//           }
+//         }
+//       ],
+//       "kind": "var"
+//     }
+//   ],
+//   "sourceType": "script"
+// }, { "ecmaVersion": 9 })
+// test("export default async function*() { var x = { y: function () { super(); } } }", {
+//   "type": "Program",
+//   "start": 0,
+//   "end": 76,
+//   "body": [
+//     {
+//       "type": "ExportDefaultDeclaration",
+//       "start": 0,
+//       "end": 76,
+//       "declaration": {
+//         "type": "FunctionDeclaration",
+//         "start": 15,
+//         "end": 76,
+//         "id": null,
+//         "generator": true,
+//         "expression": false,
+//         "async": true,
+//         "params": [],
+//         "body": {
+//           "type": "BlockStatement",
+//           "start": 33,
+//           "end": 76,
+//           "body": [
+//             {
+//               "type": "VariableDeclaration",
+//               "start": 35,
+//               "end": 74,
+//               "declarations": [
+//                 {
+//                   "type": "VariableDeclarator",
+//                   "start": 39,
+//                   "end": 74,
+//                   "id": {
+//                     "type": "Identifier",
+//                     "start": 39,
+//                     "end": 40,
+//                     "name": "x"
+//                   },
+//                   "init": {
+//                     "type": "ObjectExpression",
+//                     "start": 43,
+//                     "end": 74,
+//                     "properties": [
+//                       {
+//                         "type": "Property",
+//                         "start": 45,
+//                         "end": 72,
+//                         "method": false,
+//                         "shorthand": false,
+//                         "computed": false,
+//                         "key": {
+//                           "type": "Identifier",
+//                           "start": 45,
+//                           "end": 46,
+//                           "name": "y"
+//                         },
+//                         "value": {
+//                           "type": "FunctionExpression",
+//                           "start": 48,
+//                           "end": 72,
+//                           "id": null,
+//                           "generator": false,
+//                           "expression": false,
+//                           "async": false,
+//                           "params": [],
+//                           "body": {
+//                             "type": "BlockStatement",
+//                             "start": 60,
+//                             "end": 72,
+//                             "body": [
+//                               {
+//                                 "type": "ExpressionStatement",
+//                                 "start": 62,
+//                                 "end": 70,
+//                                 "expression": {
+//                                   "type": "CallExpression",
+//                                   "start": 62,
+//                                   "end": 69,
+//                                   "callee": {
+//                                     "type": "Super",
+//                                     "start": 62,
+//                                     "end": 67
+//                                   },
+//                                   "arguments": []
+//                                 }
+//                               }
+//                             ]
+//                           }
+//                         },
+//                         "kind": "init"
+//                       }
+//                     ]
+//                   }
+//                 }
+//               ],
+//               "kind": "var"
+//             }
+//           ]
+//         }
+//       }
+//     }
+//   ],
+//   "sourceType": "module"
+// }, { "ecmaVersion": 9, "sourceType": "module" })
+// test("var C = class { async *method() { var x = { y: function () { super(); } } } }", {}, { "ecmaVersion": 9 })
+// test("var C = class { static async *method() { var x = { y: function () { super(); } } } }", {}, { "ecmaVersion": 9 })
+
+test("({ async *method(){} })", {}, { "ecmaVersion": 9 })
+
+testFail("({ \\u0061sync *method(){} })", "Unexpected token (1:14)", { "ecmaVersion": 9 })
+testFail("void \\u0061sync function* f(){};", "Unexpected token (1:16)", { "ecmaVersion": 9 })
+testFail("for ( ; false; ) async function* g() {}", "Unexpected token (1:17)", { "ecmaVersion": 9 })
+
+test("({async() { }})", {}, { "ecmaVersion": 9 })
+test("({async = 0} = {})", {}, { "ecmaVersion": 9 })
+test("({async, foo})", {}, { "ecmaVersion": 9 })
+test("({async})", {}, { "ecmaVersion": 9 })
+test("({async: true})", {}, { "ecmaVersion": 9 })
+
+testFail("({async\n    foo() { }})", "Unexpected token (2:4)", { "ecmaVersion": 9 })
diff --git a/test/tests-rest-spread-properties.js b/test/tests-rest-spread-properties.js
new file mode 100644
index 0000000..28e36dd
--- /dev/null
+++ b/test/tests-rest-spread-properties.js
@@ -0,0 +1,1416 @@
+
+if (typeof exports != "undefined") {
+  var driver = require("./driver.js");
+  var test = driver.test, testFail = driver.testFail, testAssert = driver.testAssert, misMatch = driver.misMatch;
+  var acorn = require("..");
+}
+
+//------------------------------------------------------------------------------
+// Spread Properties
+//------------------------------------------------------------------------------
+
+test("({...obj})", {
+  "type": "Program",
+  "start": 0,
+  "end": 10,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 10,
+      "expression": {
+        "type": "ObjectExpression",
+        "start": 1,
+        "end": 9,
+        "properties": [
+          {
+            "type": "SpreadElement",
+            "start": 2,
+            "end": 8,
+            "argument": {
+              "type": "Identifier",
+              "start": 5,
+              "end": 8,
+              "name": "obj"
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({...obj1,})", {
+  "type": "Program",
+  "start": 0,
+  "end": 12,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 12,
+      "expression": {
+        "type": "ObjectExpression",
+        "start": 1,
+        "end": 11,
+        "properties": [
+          {
+            "type": "SpreadElement",
+            "start": 2,
+            "end": 9,
+            "argument": {
+              "type": "Identifier",
+              "start": 5,
+              "end": 9,
+              "name": "obj1"
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({...obj1,...obj2})", {
+  "type": "Program",
+  "start": 0,
+  "end": 19,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 19,
+      "expression": {
+        "type": "ObjectExpression",
+        "start": 1,
+        "end": 18,
+        "properties": [
+          {
+            "type": "SpreadElement",
+            "start": 2,
+            "end": 9,
+            "argument": {
+              "type": "Identifier",
+              "start": 5,
+              "end": 9,
+              "name": "obj1"
+            }
+          },
+          {
+            "type": "SpreadElement",
+            "start": 10,
+            "end": 17,
+            "argument": {
+              "type": "Identifier",
+              "start": 13,
+              "end": 17,
+              "name": "obj2"
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({a,...obj1,b:1,...obj2,c:2})", {
+  "type": "Program",
+  "start": 0,
+  "end": 29,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 29,
+      "expression": {
+        "type": "ObjectExpression",
+        "start": 1,
+        "end": 28,
+        "properties": [
+          {
+            "type": "Property",
+            "start": 2,
+            "end": 3,
+            "method": false,
+            "shorthand": true,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 2,
+              "end": 3,
+              "name": "a"
+            },
+            "kind": "init",
+            "value": {
+              "type": "Identifier",
+              "start": 2,
+              "end": 3,
+              "name": "a"
+            }
+          },
+          {
+            "type": "SpreadElement",
+            "start": 4,
+            "end": 11,
+            "argument": {
+              "type": "Identifier",
+              "start": 7,
+              "end": 11,
+              "name": "obj1"
+            }
+          },
+          {
+            "type": "Property",
+            "start": 12,
+            "end": 15,
+            "method": false,
+            "shorthand": false,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 12,
+              "end": 13,
+              "name": "b"
+            },
+            "value": {
+              "type": "Literal",
+              "start": 14,
+              "end": 15,
+              "value": 1,
+              "raw": "1"
+            },
+            "kind": "init"
+          },
+          {
+            "type": "SpreadElement",
+            "start": 16,
+            "end": 23,
+            "argument": {
+              "type": "Identifier",
+              "start": 19,
+              "end": 23,
+              "name": "obj2"
+            }
+          },
+          {
+            "type": "Property",
+            "start": 24,
+            "end": 27,
+            "method": false,
+            "shorthand": false,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 24,
+              "end": 25,
+              "name": "c"
+            },
+            "value": {
+              "type": "Literal",
+              "start": 26,
+              "end": 27,
+              "value": 2,
+              "raw": "2"
+            },
+            "kind": "init"
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({...(obj)})", {
+  "type": "Program",
+  "start": 0,
+  "end": 12,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 12,
+      "expression": {
+        "type": "ObjectExpression",
+        "start": 1,
+        "end": 11,
+        "properties": [
+          {
+            "type": "SpreadElement",
+            "start": 2,
+            "end": 10,
+            "argument": {
+              "type": "Identifier",
+              "start": 6,
+              "end": 9,
+              "name": "obj"
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({...a,b,c})", {
+  "type": "Program",
+  "start": 0,
+  "end": 12,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 12,
+      "expression": {
+        "type": "ObjectExpression",
+        "start": 1,
+        "end": 11,
+        "properties": [
+          {
+            "type": "SpreadElement",
+            "start": 2,
+            "end": 6,
+            "argument": {
+              "type": "Identifier",
+              "start": 5,
+              "end": 6,
+              "name": "a"
+            }
+          },
+          {
+            "type": "Property",
+            "start": 7,
+            "end": 8,
+            "method": false,
+            "shorthand": true,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 7,
+              "end": 8,
+              "name": "b"
+            },
+            "kind": "init",
+            "value": {
+              "type": "Identifier",
+              "start": 7,
+              "end": 8,
+              "name": "b"
+            }
+          },
+          {
+            "type": "Property",
+            "start": 9,
+            "end": 10,
+            "method": false,
+            "shorthand": true,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 9,
+              "end": 10,
+              "name": "c"
+            },
+            "kind": "init",
+            "value": {
+              "type": "Identifier",
+              "start": 9,
+              "end": 10,
+              "name": "c"
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({...(a,b),c})", {
+  "type": "Program",
+  "start": 0,
+  "end": 14,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 14,
+      "expression": {
+        "type": "ObjectExpression",
+        "start": 1,
+        "end": 13,
+        "properties": [
+          {
+            "type": "SpreadElement",
+            "start": 2,
+            "end": 10,
+            "argument": {
+              "type": "SequenceExpression",
+              "start": 6,
+              "end": 9,
+              "expressions": [
+                {
+                  "type": "Identifier",
+                  "start": 6,
+                  "end": 7,
+                  "name": "a"
+                },
+                {
+                  "type": "Identifier",
+                  "start": 8,
+                  "end": 9,
+                  "name": "b"
+                }
+              ]
+            }
+          },
+          {
+            "type": "Property",
+            "start": 11,
+            "end": 12,
+            "method": false,
+            "shorthand": true,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 11,
+              "end": 12,
+              "name": "c"
+            },
+            "kind": "init",
+            "value": {
+              "type": "Identifier",
+              "start": 11,
+              "end": 12,
+              "name": "c"
+            }
+          }
+        ]
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+
+testFail("({...})", "Unexpected token (1:5)", { ecmaVersion: 9 })
+testFail("({...obj})", "Unexpected token (1:2)", { ecmaVersion: 8 })
+
+//------------------------------------------------------------------------------
+// Rest Properties
+//------------------------------------------------------------------------------
+
+test("({...obj} = foo)", {
+  "type": "Program",
+  "start": 0,
+  "end": 16,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 16,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 1,
+        "end": 15,
+        "operator": "=",
+        "left": {
+          "type": "ObjectPattern",
+          "start": 1,
+          "end": 9,
+          "properties": [
+            {
+              "type": "RestElement",
+              "start": 2,
+              "end": 8,
+              "argument": {
+                "type": "Identifier",
+                "start": 5,
+                "end": 8,
+                "name": "obj"
+              }
+            }
+          ]
+        },
+        "right": {
+          "type": "Identifier",
+          "start": 12,
+          "end": 15,
+          "name": "foo"
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({a,...obj} = foo)", {
+  "type": "Program",
+  "start": 0,
+  "end": 18,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 18,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 1,
+        "end": 17,
+        "operator": "=",
+        "left": {
+          "type": "ObjectPattern",
+          "start": 1,
+          "end": 11,
+          "properties": [
+            {
+              "type": "Property",
+              "start": 2,
+              "end": 3,
+              "method": false,
+              "shorthand": true,
+              "computed": false,
+              "key": {
+                "type": "Identifier",
+                "start": 2,
+                "end": 3,
+                "name": "a"
+              },
+              "kind": "init",
+              "value": {
+                "type": "Identifier",
+                "start": 2,
+                "end": 3,
+                "name": "a"
+              }
+            },
+            {
+              "type": "RestElement",
+              "start": 4,
+              "end": 10,
+              "argument": {
+                "type": "Identifier",
+                "start": 7,
+                "end": 10,
+                "name": "obj"
+              }
+            }
+          ]
+        },
+        "right": {
+          "type": "Identifier",
+          "start": 14,
+          "end": 17,
+          "name": "foo"
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({a:b,...obj} = foo)", {
+  "type": "Program",
+  "start": 0,
+  "end": 20,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 20,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 1,
+        "end": 19,
+        "operator": "=",
+        "left": {
+          "type": "ObjectPattern",
+          "start": 1,
+          "end": 13,
+          "properties": [
+            {
+              "type": "Property",
+              "start": 2,
+              "end": 5,
+              "method": false,
+              "shorthand": false,
+              "computed": false,
+              "key": {
+                "type": "Identifier",
+                "start": 2,
+                "end": 3,
+                "name": "a"
+              },
+              "value": {
+                "type": "Identifier",
+                "start": 4,
+                "end": 5,
+                "name": "b"
+              },
+              "kind": "init"
+            },
+            {
+              "type": "RestElement",
+              "start": 6,
+              "end": 12,
+              "argument": {
+                "type": "Identifier",
+                "start": 9,
+                "end": 12,
+                "name": "obj"
+              }
+            }
+          ]
+        },
+        "right": {
+          "type": "Identifier",
+          "start": 16,
+          "end": 19,
+          "name": "foo"
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({...obj}) => {}", {
+  "type": "Program",
+  "start": 0,
+  "end": 16,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 16,
+      "expression": {
+        "type": "ArrowFunctionExpression",
+        "start": 0,
+        "end": 16,
+        "id": null,
+        "generator": false,
+        "expression": false,
+        "async": false,
+        "params": [
+          {
+            "type": "ObjectPattern",
+            "start": 1,
+            "end": 9,
+            "properties": [
+              {
+                "type": "RestElement",
+                "start": 2,
+                "end": 8,
+                "argument": {
+                  "type": "Identifier",
+                  "start": 5,
+                  "end": 8,
+                  "name": "obj"
+                }
+              }
+            ]
+          }
+        ],
+        "body": {
+          "type": "BlockStatement",
+          "start": 14,
+          "end": 16,
+          "body": []
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({...obj} = {}) => {}", {
+  "type": "Program",
+  "start": 0,
+  "end": 21,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 21,
+      "expression": {
+        "type": "ArrowFunctionExpression",
+        "start": 0,
+        "end": 21,
+        "id": null,
+        "generator": false,
+        "expression": false,
+        "async": false,
+        "params": [
+          {
+            "type": "AssignmentPattern",
+            "start": 1,
+            "end": 14,
+            "left": {
+              "type": "ObjectPattern",
+              "start": 1,
+              "end": 9,
+              "properties": [
+                {
+                  "type": "RestElement",
+                  "start": 2,
+                  "end": 8,
+                  "argument": {
+                    "type": "Identifier",
+                    "start": 5,
+                    "end": 8,
+                    "name": "obj"
+                  }
+                }
+              ]
+            },
+            "right": {
+              "type": "ObjectExpression",
+              "start": 12,
+              "end": 14,
+              "properties": []
+            }
+          }
+        ],
+        "body": {
+          "type": "BlockStatement",
+          "start": 19,
+          "end": 21,
+          "body": []
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({a,...obj}) => {}", {
+  "type": "Program",
+  "start": 0,
+  "end": 18,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 18,
+      "expression": {
+        "type": "ArrowFunctionExpression",
+        "start": 0,
+        "end": 18,
+        "id": null,
+        "generator": false,
+        "expression": false,
+        "async": false,
+        "params": [
+          {
+            "type": "ObjectPattern",
+            "start": 1,
+            "end": 11,
+            "properties": [
+              {
+                "type": "Property",
+                "start": 2,
+                "end": 3,
+                "method": false,
+                "shorthand": true,
+                "computed": false,
+                "key": {
+                  "type": "Identifier",
+                  "start": 2,
+                  "end": 3,
+                  "name": "a"
+                },
+                "kind": "init",
+                "value": {
+                  "type": "Identifier",
+                  "start": 2,
+                  "end": 3,
+                  "name": "a"
+                }
+              },
+              {
+                "type": "RestElement",
+                "start": 4,
+                "end": 10,
+                "argument": {
+                  "type": "Identifier",
+                  "start": 7,
+                  "end": 10,
+                  "name": "obj"
+                }
+              }
+            ]
+          }
+        ],
+        "body": {
+          "type": "BlockStatement",
+          "start": 16,
+          "end": 18,
+          "body": []
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+test("({a:b,...obj}) => {}", {
+  "type": "Program",
+  "start": 0,
+  "end": 20,
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 20,
+      "expression": {
+        "type": "ArrowFunctionExpression",
+        "start": 0,
+        "end": 20,
+        "id": null,
+        "generator": false,
+        "expression": false,
+        "async": false,
+        "params": [
+          {
+            "type": "ObjectPattern",
+            "start": 1,
+            "end": 13,
+            "properties": [
+              {
+                "type": "Property",
+                "start": 2,
+                "end": 5,
+                "method": false,
+                "shorthand": false,
+                "computed": false,
+                "key": {
+                  "type": "Identifier",
+                  "start": 2,
+                  "end": 3,
+                  "name": "a"
+                },
+                "value": {
+                  "type": "Identifier",
+                  "start": 4,
+                  "end": 5,
+                  "name": "b"
+                },
+                "kind": "init"
+              },
+              {
+                "type": "RestElement",
+                "start": 6,
+                "end": 12,
+                "argument": {
+                  "type": "Identifier",
+                  "start": 9,
+                  "end": 12,
+                  "name": "obj"
+                }
+              }
+            ]
+          }
+        ],
+        "body": {
+          "type": "BlockStatement",
+          "start": 18,
+          "end": 20,
+          "body": []
+        }
+      }
+    }
+  ],
+  "sourceType": "script"
+}, { ecmaVersion: 9 })
+
+testFail("let {...obj1,} = foo", "Comma is not permitted after the rest element (1:12)", { ecmaVersion: 9 })
+testFail("let {...obj1,a} = foo", "Comma is not permitted after the rest element (1:12)", { ecmaVersion: 9 })
+testFail("let {...obj1,...obj2} = foo", "Comma is not permitted after the rest element (1:12)", { ecmaVersion: 9 })
+testFail("let {...(obj)} = foo", "Unexpected token (1:8)", { ecmaVersion: 9 })
+testFail("let {...(a,b)} = foo", "Unexpected token (1:8)", { ecmaVersion: 9 })
+testFail("let {...{a,b}} = foo", "Unexpected token (1:8)", { ecmaVersion: 9 })
+testFail("let {...[a,b]} = foo", "Unexpected token (1:8)", { ecmaVersion: 9 })
+testFail("({...obj1,} = foo)", "Comma is not permitted after the rest element (1:9)", { ecmaVersion: 9 })
+testFail("({...obj1,a} = foo)", "Comma is not permitted after the rest element (1:9)", { ecmaVersion: 9 })
+testFail("({...obj1,...obj2} = foo)", "Comma is not permitted after the rest element (1:9)", { ecmaVersion: 9 })
+testFail("({...(obj)} = foo)", "Parenthesized pattern (1:5)", { ecmaVersion: 9 })
+testFail("({...(a,b)} = foo)", "Parenthesized pattern (1:5)", { ecmaVersion: 9 })
+testFail("({...{a,b}} = foo)", "Unexpected token (1:5)", { ecmaVersion: 9 })
+testFail("({...[a,b]} = foo)", "Unexpected token (1:5)", { ecmaVersion: 9 })
+testFail("({...obj} = foo)", "Unexpected token (1:2)", { ecmaVersion: 8 })
+testFail("({...(obj)}) => {}", "Parenthesized pattern (1:5)", { ecmaVersion: 9 })
+testFail("({...(a,b)}) => {}", "Parenthesized pattern (1:5)", { ecmaVersion: 9 })
+testFail("({...{a,b}}) => {}", "Unexpected token (1:5)", { ecmaVersion: 9 })
+testFail("({...[a,b]}) => {}", "Unexpected token (1:5)", { ecmaVersion: 9 })
+testFail("({...obj}) => {}", "Unexpected token (1:2)", { ecmaVersion: 8 })
+
+//------------------------------------------------------------------------------
+// From https://github.com/adrianheine/acorn5-object-spread/tree/49839ac662fe34e1b4ad56767115f54747db2e7c/test
+//------------------------------------------------------------------------------
+
+test("let z = {...x}", {
+  "type": "Program",
+  "body": [
+    {
+      "type": "VariableDeclaration",
+      "start": 0,
+      "end": 14,
+      "declarations": [
+        {
+          "type": "VariableDeclarator",
+          "start": 4,
+          "end": 14,
+          "id": {
+            "type": "Identifier",
+            "start": 4,
+            "end": 5,
+            "name": "z"
+          },
+          "init": {
+            "type": "ObjectExpression",
+            "start": 8,
+            "end": 14,
+            "properties": [
+              {
+                "type": "SpreadElement",
+                "start": 9,
+                "end": 13,
+                "argument": {
+                  "type": "Identifier",
+                  "start": 12,
+                  "end": 13,
+                  "name": "x"
+                }
+              }
+            ]
+          }
+        }
+      ],
+      "kind": "let"
+    }
+  ],
+  "start": 0,
+  "end": 14,
+  "sourceType": "script"
+}, { "ecmaVersion": 9 })
+test("z = {x, ...y}", {
+  "type": "Program",
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 13,
+      "expression": {
+        "type": "AssignmentExpression",
+        "start": 0,
+        "end": 13,
+        "operator": "=",
+        "left": {
+          "type": "Identifier",
+          "start": 0,
+          "end": 1,
+          "name": "z"
+        },
+        "right": {
+          "type": "ObjectExpression",
+          "start": 4,
+          "end": 13,
+          "properties": [
+            {
+              "type": "Property",
+              "start": 5,
+              "end": 6,
+              "method": false,
+              "shorthand": true,
+              "computed": false,
+              "key": {
+                "type": "Identifier",
+                "start": 5,
+                "end": 6,
+                "name": "x"
+              },
+              "value": {
+                "type": "Identifier",
+                "start": 5,
+                "end": 6,
+                "name": "x"
+              },
+              "kind": "init"
+            },
+            {
+              "type": "SpreadElement",
+              "start": 8,
+              "end": 12,
+              "argument": {
+                "type": "Identifier",
+                "start": 11,
+                "end": 12,
+                "name": "y"
+              }
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "start": 0,
+  "end": 13,
+  "sourceType": "script"
+}, { "ecmaVersion": 9 })
+test("({x, ...y, a, ...b, c})", {
+  "type": "Program",
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 23,
+      "expression": {
+        "type": "ObjectExpression",
+        "start": 1,
+        "end": 22,
+        "properties": [
+          {
+            "type": "Property",
+            "start": 2,
+            "end": 3,
+            "method": false,
+            "shorthand": true,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 2,
+              "end": 3,
+              "name": "x"
+            },
+            "value": {
+              "type": "Identifier",
+              "start": 2,
+              "end": 3,
+              "name": "x"
+            },
+            "kind": "init"
+          },
+          {
+            "type": "SpreadElement",
+            "start": 5,
+            "end": 9,
+            "argument": {
+              "type": "Identifier",
+              "start": 8,
+              "end": 9,
+              "name": "y"
+            }
+          },
+          {
+            "type": "Property",
+            "start": 11,
+            "end": 12,
+            "method": false,
+            "shorthand": true,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 11,
+              "end": 12,
+              "name": "a"
+            },
+            "value": {
+              "type": "Identifier",
+              "start": 11,
+              "end": 12,
+              "name": "a"
+            },
+            "kind": "init"
+          },
+          {
+            "type": "SpreadElement",
+            "start": 14,
+            "end": 18,
+            "argument": {
+              "type": "Identifier",
+              "start": 17,
+              "end": 18,
+              "name": "b"
+            }
+          },
+          {
+            "type": "Property",
+            "start": 20,
+            "end": 21,
+            "method": false,
+            "shorthand": true,
+            "computed": false,
+            "key": {
+              "type": "Identifier",
+              "start": 20,
+              "end": 21,
+              "name": "c"
+            },
+            "value": {
+              "type": "Identifier",
+              "start": 20,
+              "end": 21,
+              "name": "c"
+            },
+            "kind": "init"
+          }
+        ]
+      }
+    }
+  ],
+  "start": 0,
+  "end": 23,
+  "sourceType": "script"
+}, { "ecmaVersion": 9 })
+test("var someObject = { someKey: { ...mapGetters([ 'some_val_1', 'some_val_2' ]) } }", {
+  "type": "Program",
+  "body": [
+    {
+      "type": "VariableDeclaration",
+      "start": 0,
+      "end": 79,
+      "declarations": [
+        {
+          "type": "VariableDeclarator",
+          "start": 4,
+          "end": 79,
+          "id": {
+            "type": "Identifier",
+            "start": 4,
+            "end": 14,
+            "name": "someObject"
+          },
+          "init": {
+            "type": "ObjectExpression",
+            "start": 17,
+            "end": 79,
+            "properties": [
+              {
+                "type": "Property",
+                "start": 19,
+                "end": 77,
+                "method": false,
+                "shorthand": false,
+                "computed": false,
+                "key": {
+                  "type": "Identifier",
+                  "start": 19,
+                  "end": 26,
+                  "name": "someKey"
+                },
+                "value": {
+                  "type": "ObjectExpression",
+                  "start": 28,
+                  "end": 77,
+                  "properties": [
+                    {
+                      "type": "SpreadElement",
+                      "start": 30,
+                      "end": 75,
+                      "argument": {
+                        "type": "CallExpression",
+                        "start": 33,
+                        "end": 75,
+                        "callee": {
+                          "type": "Identifier",
+                          "start": 33,
+                          "end": 43,
+                          "name": "mapGetters"
+                        },
+                        "arguments": [
+                          {
+                            "type": "ArrayExpression",
+                            "start": 44,
+                            "end": 74,
+                            "elements": [
+                              {
+                                "type": "Literal",
+                                "start": 46,
+                                "end": 58,
+                                "value": "some_val_1",
+                                "raw": "'some_val_1'"
+                              },
+                              {
+                                "type": "Literal",
+                                "start": 60,
+                                "end": 72,
+                                "value": "some_val_2",
+                                "raw": "'some_val_2'"
+                              }
+                            ]
+                          }
+                        ]
+                      }
+                    }
+                  ]
+                },
+                "kind": "init"
+              }
+            ]
+          }
+        }
+      ],
+      "kind": "var"
+    }
+  ],
+  "start": 0,
+  "end": 79,
+  "sourceType": "script"
+}, { "ecmaVersion": 9 })
+test("let {x, ...y} = v", {
+  "type": "Program",
+  "body": [
+    {
+      "type": "VariableDeclaration",
+      "start": 0,
+      "end": 17,
+      "declarations": [
+        {
+          "type": "VariableDeclarator",
+          "start": 4,
+          "end": 17,
+          "id": {
+            "type": "ObjectPattern",
+            "start": 4,
+            "end": 13,
+            "properties": [
+              {
+                "type": "Property",
+                "start": 5,
+                "end": 6,
+                "method": false,
+                "shorthand": true,
+                "computed": false,
+                "key": {
+                  "type": "Identifier",
+                  "start": 5,
+                  "end": 6,
+                  "name": "x"
+                },
+                "kind": "init",
+                "value": {
+                  "type": "Identifier",
+                  "start": 5,
+                  "end": 6,
+                  "name": "x"
+                }
+              },
+              {
+                "type": "RestElement",
+                "start": 8,
+                "end": 12,
+                "argument": {
+                  "type": "Identifier",
+                  "start": 11,
+                  "end": 12,
+                  "name": "y"
+                }
+              }
+            ]
+          },
+          "init": {
+            "type": "Identifier",
+            "start": 16,
+            "end": 17,
+            "name": "v"
+          }
+        }
+      ],
+      "kind": "let"
+    }
+  ],
+  "start": 0,
+  "end": 17,
+  "sourceType": "script"
+}, { "ecmaVersion": 9 })
+test("(function({x, ...y}) {})", {
+  "type": "Program",
+  "body": [
+    {
+      "type": "ExpressionStatement",
+      "start": 0,
+      "end": 24,
+      "expression": {
+        "type": "FunctionExpression",
+        "start": 1,
+        "end": 23,
+        "id": null,
+        "generator": false,
+        "expression": false,
+        "params": [
+          {
+            "type": "ObjectPattern",
+            "start": 10,
+            "end": 19,
+            "properties": [
+              {
+                "type": "Property",
+                "start": 11,
+                "end": 12,
+                "method": false,
+                "shorthand": true,
+                "computed": false,
+                "key": {
+                  "type": "Identifier",
+                  "start": 11,
+                  "end": 12,
+                  "name": "x"
+                },
+                "kind": "init",
+                "value": {
+                  "type": "Identifier",
+                  "start": 11,
+                  "end": 12,
+                  "name": "x"
+                }
+              },
+              {
+                "type": "RestElement",
+                "start": 14,
+                "end": 18,
+                "argument": {
+                  "type": "Identifier",
+                  "start": 17,
+                  "end": 18,
+                  "name": "y"
+                }
+              }
+            ]
+          }
+        ],
+        "body": {
+          "type": "BlockStatement",
+          "start": 21,
+          "end": 23,
+          "body": []
+        }
+      }
+    }
+  ],
+  "start": 0,
+  "end": 24,
+  "sourceType": "script"
+}, { "ecmaVersion": 9 })
+test("const fn = ({text = \"default\", ...props}) => text + props.children", {
+  "type": "Program",
+  "body": [
+    {
+      "type": "VariableDeclaration",
+      "start": 0,
+      "end": 66,
+      "declarations": [
+        {
+          "type": "VariableDeclarator",
+          "start": 6,
+          "end": 66,
+          "id": {
+            "type": "Identifier",
+            "start": 6,
+            "end": 8,
+            "name": "fn"
+          },
+          "init": {
+            "type": "ArrowFunctionExpression",
+            "start": 11,
+            "end": 66,
+            "id": null,
+            "generator": false,
+            "expression": true,
+            "params": [
+              {
+                "type": "ObjectPattern",
+                "start": 12,
+                "end": 40,
+                "properties": [
+                  {
+                    "type": "Property",
+                    "start": 13,
+                    "end": 29,
+                    "method": false,
+                    "shorthand": true,
+                    "computed": false,
+                    "key": {
+                      "type": "Identifier",
+                      "start": 13,
+                      "end": 17,
+                      "name": "text"
+                    },
+                    "kind": "init",
+                    "value": {
+                      "type": "AssignmentPattern",
+                      "start": 13,
+                      "end": 29,
+                      "left": {
+                        "type": "Identifier",
+                        "start": 13,
+                        "end": 17,
+                        "name": "text"
+                      },
+                      "right": {
+                        "type": "Literal",
+                        "start": 20,
+                        "end": 29,
+                        "value": "default",
+                        "raw": "\"default\""
+                      }
+                    }
+                  },
+                  {
+                    "type": "RestElement",
+                    "start": 31,
+                    "end": 39,
+                    "argument": {
+                      "type": "Identifier",
+                      "start": 34,
+                      "end": 39,
+                      "name": "props"
+                    }
+                  }
+                ]
+              }
+            ],
+            "body": {
+              "type": "BinaryExpression",
+              "start": 45,
+              "end": 66,
+              "left": {
+                "type": "Identifier",
+                "start": 45,
+                "end": 49,
+                "name": "text"
+              },
+              "operator": "+",
+              "right": {
+                "type": "MemberExpression",
+                "start": 52,
+                "end": 66,
+                "object": {
+                  "type": "Identifier",
+                  "start": 52,
+                  "end": 57,
+                  "name": "props"
+                },
+                "property": {
+                  "type": "Identifier",
+                  "start": 58,
+                  "end": 66,
+                  "name": "children"
+                },
+                "computed": false
+              }
+            }
+          }
+        }
+      ],
+      "kind": "const"
+    }
+  ],
+  "start": 0,
+  "end": 66,
+  "sourceType": "script"
+}, { "ecmaVersion": 9 })
+
+testFail("({get x() {}}) => {}", "Object pattern can't contain getter or setter (1:6)", { ecmaVersion: 9 })
+testFail("let {...x, ...y} = {}", "Comma is not permitted after the rest element (1:9)", { ecmaVersion: 9 })
+testFail("({...x,}) => z", "Comma is not permitted after the rest element (1:6)", { ecmaVersion: 9 })
+testFail("export const { foo, ...bar } = baz;\nexport const bar = 1;\n", "Identifier 'bar' has already been declared (2:13)", {
+  ecmaVersion: 9,
+  sourceType: "module"
+})
+testFail("function ({...x,}) { z }", "Unexpected token (1:9)", { ecmaVersion: 9 })
+testFail("let {...{x, y}} = {}", "Unexpected token (1:8)", { ecmaVersion: 9 })
+testFail("let {...{...{x, y}}} = {}", "Unexpected token (1:8)", { ecmaVersion: 9 })
+testFail("0, {...rest, b} = {}", "Comma is not permitted after the rest element (1:11)", { ecmaVersion: 9 })
+testFail("(([a, ...b = 0]) => {})", "Rest elements cannot have a default value (1:9)", { ecmaVersion: 9 })
+testFail("(({a, ...b = 0}) => {})", "Rest elements cannot have a default value (1:9)", { ecmaVersion: 9 })
diff --git a/test/tests.js b/test/tests.js
index 53a4882..79fbb33 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -7768,78 +7768,7 @@ test("var x = /=([^=\\s])+/g", {
   }
 });
 
-test("var x = /[P QR]/\\u0067", {
-  type: "Program",
-  body: [
-    {
-      type: "VariableDeclaration",
-      declarations: [
-        {
-          type: "VariableDeclarator",
-          id: {
-            type: "Identifier",
-            name: "x",
-            loc: {
-              start: {
-                line: 1,
-                column: 4
-              },
-              end: {
-                line: 1,
-                column: 5
-              }
-            }
-          },
-          init: {
-            type: "Literal",
-            value: /[P QR]/g,
-            loc: {
-              start: {
-                line: 1,
-                column: 8
-              },
-              end: {
-                line: 1,
-                column: 22
-              }
-            }
-          },
-          loc: {
-            start: {
-              line: 1,
-              column: 4
-            },
-            end: {
-              line: 1,
-              column: 22
-            }
-          }
-        }
-      ],
-      kind: "var",
-      loc: {
-        start: {
-          line: 1,
-          column: 0
-        },
-        end: {
-          line: 1,
-          column: 22
-        }
-      }
-    }
-  ],
-  loc: {
-    start: {
-      line: 1,
-      column: 0
-    },
-    end: {
-      line: 1,
-      column: 22
-    }
-  }
-});
+testFail("var x = /[P QR]/\\u0067", "Unexpected token (1:16)");
 
 test("new Button", {
   type: "Program",
@@ -29236,6 +29165,7 @@ test("/[a-z]/gim", {
 testFail("/[a-z]/u", "Invalid regular expression flag (1:1)");
 testFail("/[a-z]/y", "Invalid regular expression flag (1:1)");
 testFail("/[a-z]/s", "Invalid regular expression flag (1:1)");
+testFail("/a/gg", "Duplicate regular expression flag (1:1)");
 
 testFail("function(){}", "Unexpected token (1:8)");
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/acorn.git



More information about the Pkg-javascript-commits mailing list