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

Julien Puydt julien.puydt at laposte.net
Sun Oct 22 14:55:22 UTC 2017


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

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

commit 0510162a75ad40fd389866ecfba2e2baddf5024c
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Sun Oct 22 09:40:35 2017 +0200

    New upstream version 5.1.2+ds1
---
 AUTHORS                  |  1 +
 CHANGELOG.md             |  8 ++++++++
 package.json             |  2 +-
 src/expression.js        |  2 +-
 src/index.js             |  2 +-
 src/parseutil.js         |  2 +-
 src/tokenize.js          |  5 ++---
 src/tokentype.js         |  8 ++++----
 test/tests-asyncawait.js |  2 ++
 test/tests-harmony.js    | 11 +++++++++++
 10 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 7b9f6a1..78437f6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -59,6 +59,7 @@ r-e-d
 Richard Gibson
 Rich Harris
 Sebastian McKenzie
+Shahar Soel
 Simen Bekkhus
 Teddy Katz
 Timothy Gu
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34d1ac7..73894d1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+## 5.1.2 (2017-09-04)
+
+### Bug fixes
+
+Disable parsing of legacy HTML-style comments in modules.
+
+Fix parsing of async methods whose names are keywords.
+
 ## 5.1.1 (2017-07-06)
 
 ### Bug fixes
diff --git a/package.json b/package.json
index 3d242e7..035bc3c 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "homepage": "https://github.com/ternjs/acorn",
   "main": "dist/acorn.js",
   "module": "dist/acorn.es.js",
-  "version": "5.1.1",
+  "version": "5.1.2",
   "engines": {
     "node": ">=0.4.0"
   },
diff --git a/src/expression.js b/src/expression.js
index a07c10b..635642c 100644
--- a/src/expression.js
+++ b/src/expression.js
@@ -532,7 +532,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 === tt.name || this.type === tt.num || this.type === tt.string || this.type === tt.bracketL || this.type.keyword) &&
     !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
 }
 
diff --git a/src/index.js b/src/index.js
index ae830a1..c0c0065 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.1.1"
+export const version = "5.1.2"
 
 // 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/parseutil.js b/src/parseutil.js
index 07a090a..5eda52f 100644
--- a/src/parseutil.js
+++ b/src/parseutil.js
@@ -6,7 +6,7 @@ const pp = Parser.prototype
 
 // ## Parser utilities
 
-const literal = /^(?:'((?:[^']|\.)*)'|"((?:[^"]|\.)*)"|;)/
+const literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/
 pp.strictDirective = function(start) {
   for (;;) {
     skipWhiteSpace.lastIndex = start
diff --git a/src/tokenize.js b/src/tokenize.js
index f256e25..4f98e34 100644
--- a/src/tokenize.js
+++ b/src/tokenize.js
@@ -247,7 +247,7 @@ pp.readToken_caret = function() { // '^'
 pp.readToken_plus_min = function(code) { // '+-'
   let next = this.input.charCodeAt(this.pos + 1)
   if (next === code) {
-    if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 &&
+    if (next == 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) == 62 &&
         (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
       // A `-->` line comment
       this.skipLineComment(3)
@@ -268,9 +268,8 @@ pp.readToken_lt_gt = function(code) { // '<>'
     if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)
     return this.finishOp(tt.bitShift, size)
   }
-  if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 &&
+  if (next == 33 && code == 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) == 45 &&
       this.input.charCodeAt(this.pos + 3) == 45) {
-    if (this.inModule) this.unexpected()
     // `<!--`, an XML-style comment that should be interpreted as a line comment
     this.skipLineComment(4)
     this.skipSpace()
diff --git a/src/tokentype.js b/src/tokentype.js
index 37f3d43..76b145f 100644
--- a/src/tokentype.js
+++ b/src/tokentype.js
@@ -94,15 +94,15 @@ export const types = {
   eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
   assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
   incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
-  prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}),
+  prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
   logicalOR: binop("||", 1),
   logicalAND: binop("&&", 2),
   bitwiseOR: binop("|", 3),
   bitwiseXOR: binop("^", 4),
   bitwiseAND: binop("&", 5),
-  equality: binop("==/!=", 6),
-  relational: binop("</>", 7),
-  bitShift: binop("<</>>", 8),
+  equality: binop("==/!=/===/!==", 6),
+  relational: binop("</>/<=/>=", 7),
+  bitShift: binop("<</>>/>>>", 8),
   plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
   modulo: binop("%", 10),
   star: binop("*", 10),
diff --git a/test/tests-asyncawait.js b/test/tests-asyncawait.js
index 558799c..35ccd41 100644
--- a/test/tests-asyncawait.js
+++ b/test/tests-asyncawait.js
@@ -3517,3 +3517,5 @@ test(
   },
   {ecmaVersion: 8}
 )
+
+test("({ async delete() {} })", {}, {ecmaVersion: 8})
diff --git a/test/tests-harmony.js b/test/tests-harmony.js
index 7e4cca2..1f06847 100644
--- a/test/tests-harmony.js
+++ b/test/tests-harmony.js
@@ -15727,3 +15727,14 @@ test("function *f1() { function g() { return yield / 1 } }", {}, {ecmaVersion: 6
 test("class Foo {} /regexp/", {}, {ecmaVersion: 6})
 
 test("(class Foo {} / 2)", {}, {ecmaVersion: 6})
+
+test("1 <!--b", {
+  type: "Program",
+  body: [{
+    type: "ExpressionStatement",
+    expression: {
+      type: "BinaryExpression",
+      operator: "<"
+    }
+  }]
+}, {ecmaVersion: 6, sourceType: "module"})

-- 
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