@@ -1,3 +1,9 @@
2015-07-01: Version 2.4.1

* Fix some cases of comment attachment (issue 1071, 1175)
* Fix the handling of destructuring in function arguments (issue 1193)
* Fix invalid ranges in assignment expression (issue 1201)

2015-06-26: Version 2.4.0

* Support ES6 for-of iteration (issue 1047)
@@ -5199,52 +5199,53 @@
}

function parseImportDeclaration() {
var specifiers, src, node = new Node();
var specifiers = [], src, node = new Node();

if (state.inFunctionBody) {
throwError(Messages.IllegalImportDeclaration);
}

expectKeyword('import');
specifiers = [];

if (lookahead.type === Token.StringLiteral) {
// covers:
// import 'foo';
src = parseModuleSpecifier();
consumeSemicolon();
return node.finishImportDeclaration(specifiers, src);
}
} else {

if (!matchKeyword('default') && isIdentifierName(lookahead)) {
// covers:
// import foo
// import foo, ...
specifiers.push(parseImportDefaultSpecifier());
if (match(',')) {
lex();
if (match('{')) {
// import {bar}
specifiers = specifiers.concat(parseNamedImports());
} else if (match('*')) {
// import * as foo
specifiers.push(parseImportNamespaceSpecifier());
} else if (isIdentifierName(lookahead) && !matchKeyword('default')) {
// import foo
specifiers.push(parseImportDefaultSpecifier());
if (match(',')) {
lex();
if (match('*')) {
// import foo, * as foo
specifiers.push(parseImportNamespaceSpecifier());
} else if (match('{')) {
// import foo, {bar}
specifiers = specifiers.concat(parseNamedImports());
} else {
throwUnexpectedToken(lookahead);
}
}
} else {
throwUnexpectedToken(lex());
}
}
if (match('*')) {
// covers:
// import foo, * as foo
// import * as foo
specifiers.push(parseImportNamespaceSpecifier());
} else if (match('{')) {
// covers:
// import foo, {bar}
// import {bar}
specifiers = specifiers.concat(parseNamedImports());
}

if (!matchContextualKeyword('from')) {
throwError(lookahead.value ?
Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
if (!matchContextualKeyword('from')) {
throwError(lookahead.value ?
Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
}
lex();
src = parseModuleSpecifier();
}
lex();
src = parseModuleSpecifier();
consumeSemicolon();

consumeSemicolon();
return node.finishImportDeclaration(specifiers, src);
}

@@ -1,7 +1,7 @@
{
"index": 6,
"index": 7,
"lineNumber": 1,
"column": 7,
"column": 8,
"message": "Error: Line 1: Unexpected token default",
"description": "Unexpected token default"
}
@@ -0,0 +1 @@
import foo { bar } from "bar";
@@ -0,0 +1,7 @@
{
"index": 10,
"lineNumber": 1,
"column": 11,
"message": "Error: Line 1: Unexpected token {",
"description":"Unexpected token {"
}
@@ -0,0 +1 @@
import foo, from "bar";
@@ -0,0 +1,7 @@
{
"index": 12,
"lineNumber": 1,
"column": 13,
"message": "Error: Line 1: Unexpected identifier",
"description": "Unexpected identifier"
}