Skip to content

Commit

Permalink
[[FIX]] Correct interpretation of ImportSpecifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike committed Mar 1, 2021
1 parent 3a9fa87 commit 72a8102
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5581,15 +5581,12 @@ var JSHINT = (function() {
break;
}
var importName;
if (state.tokens.next.type === "default") {
importName = "default";
advance("default");
} else {
importName = identifier(context);
}
if (state.tokens.next.value === "as") {
if (peek().value === "as") {
identifier(context, true);
advance("as");
importName = identifier(context);
} else {
importName = identifier(context);
}

// Import bindings are immutable (see ES6 8.1.1.5.5)
Expand Down
2 changes: 0 additions & 2 deletions tests/test262/expectations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ test/language/module-code/early-export-global.js(default)
test/language/module-code/early-export-global.js(strict mode)
test/language/module-code/early-export-unresolvable.js(default)
test/language/module-code/early-export-unresolvable.js(strict mode)
test/language/module-code/instn-named-id-name.js(default)
test/language/module-code/instn-named-id-name.js(strict mode)
test/language/module-code/parse-err-hoist-lex-fun.js(default)
test/language/module-code/parse-err-hoist-lex-fun.js(strict mode)
test/language/module-code/parse-err-hoist-lex-gen.js(default)
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,12 @@ exports.testES6Modules = function (test) {
"export default async function * () { yield 0; await 0; }",
], { esversion: 9, module: true });

TestRun(test, "IdentifierName in renamed import/export")
.test([
"import { if as x } from '.';",
"export { x as if } from '.';"
], { esversion: 6, module: true });

test.done();
};

Expand Down

0 comments on commit 72a8102

Please sign in to comment.