Skip to content

Commit

Permalink
fixed #1731
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Dec 22, 2015
1 parent 4c69156 commit c26aa92
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dependencies/HarmonyExportDependencyParserPlugin.js
Expand Up @@ -34,8 +34,8 @@ module.exports = AbstractPlugin.create({
},
"export declaration": function() {},
"export specifier": function(statement, id, name) {
var immutable = isImmutableStatement(statement.declaration);
var hoisted = isHoistedStatement(statement.declaration);
var immutable = statement.declaration && isImmutableStatement(statement.declaration);
var hoisted = statement.declaration && isHoistedStatement(statement.declaration);
var dep = new HarmonyExportSpecifierDependency(this.state.module, id, name, hoisted ? 0 : (statement.range[1] + 0.5), immutable);
dep.loc = statement.loc;
this.state.current.addDependency(dep);
Expand Down
8 changes: 8 additions & 0 deletions test/cases/parsing/harmony/index.js
Expand Up @@ -12,9 +12,12 @@ import { a as rea, b as reb, c as rec, o as reo, two as retwo } from "reexport";

import threeIsOdd, { even } from "circularEven";

import { specA, specB } from "exports-specifier";

import Thing, { Other } from "commonjs";
import Thing2, { Other as Other2 } from "commonjs-trans";


it("should import an identifier from a module", function() {
a.should.be.eql("a");
B.should.be.eql("b");
Expand Down Expand Up @@ -56,6 +59,11 @@ it("should support circular dependencies", function() {
even(4).should.be.eql(true);
});

it("should support export specifier", function() {
specA.should.be.eql(1);
specB.should.be.eql(2);
});

it("should be able to import commonjs", function() {
function x() { throw new Error("should not be executed"); }
// next line doesn't end with semicolon
Expand Down
2 changes: 2 additions & 0 deletions test/cases/parsing/harmony/node_modules/exports-specifier.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c26aa92

Please sign in to comment.