[Pkg-javascript-commits] [node-esprima] 01/03: New upstream version 3.1.1+ds
Julien Puydt
julien.puydt at laposte.net
Sun Nov 6 09:13:04 UTC 2016
This is an automated email from the git hooks/post-receive script.
jpuydt-guest pushed a commit to branch master
in repository node-esprima.
commit 5d392afa8f9abe3fc2f17074a5c9dded1b9fdff0
Author: Julien Puydt <julien.puydt at laposte.net>
Date: Sun Nov 6 10:09:23 2016 +0100
New upstream version 3.1.1+ds
---
ChangeLog | 5 +
package.json | 2 +-
src/character.ts | 4 +-
src/esprima.ts | 2 +-
src/parser.ts | 5 +-
.../export-default-assignment.module.js | 1 +
.../export-default-assignment.module.tree.json | 202 +++++++++++++++++++++
.../literal/numeric/invalid_hex.failure.json | 1 +
.../primary/literal/numeric/invalid_hex.js | 1 +
.../string/invalid_escaped_hex.failure.json | 1 +
.../primary/literal/string/invalid_escaped_hex.js | 1 +
.../literal/string/invalid_hex.failure.json | 1 +
.../primary/literal/string/invalid_hex.js | 1 +
13 files changed, 220 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 02bf00d..73848b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-31: Version 3.1.1
+
+ * Fix assignment expression problem in an export declaration (issue 1596)
+ * Fix incorrect tokenization of hex digits (issue 1605)
+
2016-10-09: Version 3.1.0
* Do not implicitly collect comments when comment attachment is specified (issue 1553)
diff --git a/package.json b/package.json
index 312d309..eecca3d 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"esparse": "./bin/esparse.js",
"esvalidate": "./bin/esvalidate.js"
},
- "version": "3.1.0",
+ "version": "3.1.1",
"files": [
"bin",
"dist/esprima.js"
diff --git a/src/character.ts b/src/character.ts
index c414ac2..96122e5 100644
--- a/src/character.ts
+++ b/src/character.ts
@@ -55,8 +55,8 @@ export const Character = {
isHexDigit(cp: number): boolean {
return (cp >= 0x30 && cp <= 0x39) || // 0..9
- (cp >= 0x41 && cp <= 0x48) || // A..H
- (cp >= 0x61 && cp <= 0x68); // a..h
+ (cp >= 0x41 && cp <= 0x46) || // A..F
+ (cp >= 0x61 && cp <= 0x66); // a..f
},
isOctalDigit(cp: number): boolean {
diff --git a/src/esprima.ts b/src/esprima.ts
index 90ad1a1..e3f94a9 100644
--- a/src/esprima.ts
+++ b/src/esprima.ts
@@ -104,4 +104,4 @@ export function tokenize(code: string, options, delegate) {
export { Syntax } from './syntax';
// Sync with *.json manifests.
-export const version = '3.1.0';
+export const version = '3.1.1';
diff --git a/src/parser.ts b/src/parser.ts
index 3f7ebe0..b7bb66e 100644
--- a/src/parser.ts
+++ b/src/parser.ts
@@ -1629,6 +1629,8 @@ export class Parser {
parseStatementListItem(): Node.StatementListItem {
let statement = null;
+ this.context.isAssignmentTarget = true;
+ this.context.isBindingElement = true;
if (this.lookahead.type === Token.Keyword) {
switch (this.lookahead.value) {
case 'export':
@@ -2444,9 +2446,6 @@ export class Parser {
// ECMA-262 13 Statements
parseStatement(): Node.Statement {
- this.context.isAssignmentTarget = true;
- this.context.isBindingElement = true;
-
let statement = null;
switch (this.lookahead.type) {
case Token.BooleanLiteral:
diff --git a/test/fixtures/ES6/export-declaration/export-default-assignment.module.js b/test/fixtures/ES6/export-declaration/export-default-assignment.module.js
new file mode 100644
index 0000000..c9b2339
--- /dev/null
+++ b/test/fixtures/ES6/export-declaration/export-default-assignment.module.js
@@ -0,0 +1 @@
+export default a = 0;
diff --git a/test/fixtures/ES6/export-declaration/export-default-assignment.module.tree.json b/test/fixtures/ES6/export-declaration/export-default-assignment.module.tree.json
new file mode 100644
index 0000000..22403e7
--- /dev/null
+++ b/test/fixtures/ES6/export-declaration/export-default-assignment.module.tree.json
@@ -0,0 +1,202 @@
+{
+ "type": "Program",
+ "body": [
+ {
+ "type": "ExportDefaultDeclaration",
+ "declaration": {
+ "type": "AssignmentExpression",
+ "operator": "=",
+ "left": {
+ "type": "Identifier",
+ "name": "a",
+ "range": [
+ 15,
+ 16
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 15
+ },
+ "end": {
+ "line": 1,
+ "column": 16
+ }
+ }
+ },
+ "right": {
+ "type": "Literal",
+ "value": 0,
+ "raw": "0",
+ "range": [
+ 19,
+ 20
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 19
+ },
+ "end": {
+ "line": 1,
+ "column": 20
+ }
+ }
+ },
+ "range": [
+ 15,
+ 20
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 15
+ },
+ "end": {
+ "line": 1,
+ "column": 20
+ }
+ }
+ },
+ "range": [
+ 0,
+ 21
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 21
+ }
+ }
+ }
+ ],
+ "sourceType": "module",
+ "range": [
+ 0,
+ 21
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 21
+ }
+ },
+ "tokens": [
+ {
+ "type": "Keyword",
+ "value": "export",
+ "range": [
+ 0,
+ 6
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 6
+ }
+ }
+ },
+ {
+ "type": "Keyword",
+ "value": "default",
+ "range": [
+ 7,
+ 14
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 7
+ },
+ "end": {
+ "line": 1,
+ "column": 14
+ }
+ }
+ },
+ {
+ "type": "Identifier",
+ "value": "a",
+ "range": [
+ 15,
+ 16
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 15
+ },
+ "end": {
+ "line": 1,
+ "column": 16
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": "=",
+ "range": [
+ 17,
+ 18
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 17
+ },
+ "end": {
+ "line": 1,
+ "column": 18
+ }
+ }
+ },
+ {
+ "type": "Numeric",
+ "value": "0",
+ "range": [
+ 19,
+ 20
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 19
+ },
+ "end": {
+ "line": 1,
+ "column": 20
+ }
+ }
+ },
+ {
+ "type": "Punctuator",
+ "value": ";",
+ "range": [
+ 20,
+ 21
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 20
+ },
+ "end": {
+ "line": 1,
+ "column": 21
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/test/fixtures/expression/primary/literal/numeric/invalid_hex.failure.json b/test/fixtures/expression/primary/literal/numeric/invalid_hex.failure.json
new file mode 100644
index 0000000..60ab38e
--- /dev/null
+++ b/test/fixtures/expression/primary/literal/numeric/invalid_hex.failure.json
@@ -0,0 +1 @@
+{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"}
\ No newline at end of file
diff --git a/test/fixtures/expression/primary/literal/numeric/invalid_hex.js b/test/fixtures/expression/primary/literal/numeric/invalid_hex.js
new file mode 100644
index 0000000..6c2cc71
--- /dev/null
+++ b/test/fixtures/expression/primary/literal/numeric/invalid_hex.js
@@ -0,0 +1 @@
+0xFG
diff --git a/test/fixtures/expression/primary/literal/string/invalid_escaped_hex.failure.json b/test/fixtures/expression/primary/literal/string/invalid_escaped_hex.failure.json
new file mode 100644
index 0000000..f442682
--- /dev/null
+++ b/test/fixtures/expression/primary/literal/string/invalid_escaped_hex.failure.json
@@ -0,0 +1 @@
+{"index":6,"lineNumber":1,"column":7,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"}
\ No newline at end of file
diff --git a/test/fixtures/expression/primary/literal/string/invalid_escaped_hex.js b/test/fixtures/expression/primary/literal/string/invalid_escaped_hex.js
new file mode 100644
index 0000000..484f4e8
--- /dev/null
+++ b/test/fixtures/expression/primary/literal/string/invalid_escaped_hex.js
@@ -0,0 +1 @@
+'\u00FG'
diff --git a/test/fixtures/expression/primary/literal/string/invalid_hex.failure.json b/test/fixtures/expression/primary/literal/string/invalid_hex.failure.json
new file mode 100644
index 0000000..49ab9a0
--- /dev/null
+++ b/test/fixtures/expression/primary/literal/string/invalid_hex.failure.json
@@ -0,0 +1 @@
+{"index":4,"lineNumber":1,"column":5,"message":"Error: Line 1: Unexpected token ILLEGAL","description":"Unexpected token ILLEGAL"}
\ No newline at end of file
diff --git a/test/fixtures/expression/primary/literal/string/invalid_hex.js b/test/fixtures/expression/primary/literal/string/invalid_hex.js
new file mode 100644
index 0000000..4e99d9f
--- /dev/null
+++ b/test/fixtures/expression/primary/literal/string/invalid_hex.js
@@ -0,0 +1 @@
+'\xFG'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-esprima.git
More information about the Pkg-javascript-commits
mailing list