diff --git a/src/babel/transformation/transformers/es6/classes.js b/src/babel/transformation/transformers/es6/classes.js index db62df61e4..1a63e8ad8b 100644 --- a/src/babel/transformation/transformers/es6/classes.js +++ b/src/babel/transformation/transformers/es6/classes.js @@ -452,7 +452,7 @@ class ClassTransformer { file: this.file }; - path.traverse(verifyConstructorVisitor, state); + path.get("value").traverse(verifyConstructorVisitor, state); this.bareSuper = state.bareSuper; diff --git a/src/babel/traversal/scope.js b/src/babel/traversal/scope.js index 3a6b550fa6..f58908606f 100644 --- a/src/babel/traversal/scope.js +++ b/src/babel/traversal/scope.js @@ -237,11 +237,12 @@ export default class Scope { var local = this.getOwnBindingInfo(name); if (!local) return; + if (kind === "param") return; if (kind === "hoisted" && local.kind === "let") return; var duplicate = false; - duplicate ||= local.kind === "let" || local.kind === "const" || local.kind === "module"; + duplicate ||= kind === "let" || kind === "const" || local.kind === "let" || local.kind === "const" || local.kind === "module"; duplicate ||= local.kind === "param" && (kind === "let" || kind === "const"); if (duplicate) { diff --git a/test/core/fixtures/transformation/flow/strip-type-annotations/actual.js b/test/core/fixtures/transformation/flow/strip-type-annotations/actual.js index d86c13e840..f3aae7e444 100644 --- a/test/core/fixtures/transformation/flow/strip-type-annotations/actual.js +++ b/test/core/fixtures/transformation/flow/strip-type-annotations/actual.js @@ -89,7 +89,7 @@ var a: Promise[] var a:(...rest:Array) => number var identity: (x: T) => T var identity: (x: T, ...y:T[]) => T -import type foo from "bar"; +import type foo4 from "bar"; import type { foo2, bar } from "baz"; import type { foo as bar2 } from "baz"; import type from "foo"; diff --git a/test/core/fixtures/transformation/misc/regression-1155/actual.js b/test/core/fixtures/transformation/misc/regression-1155/actual.js index f94a7f5899..db5770c849 100644 --- a/test/core/fixtures/transformation/misc/regression-1155/actual.js +++ b/test/core/fixtures/transformation/misc/regression-1155/actual.js @@ -1,4 +1,4 @@ -class Foo { +class Foo extends Bar { constructor (options) { let parentOptions = {}; parentOptions.init = function () { diff --git a/test/core/fixtures/transformation/misc/regression-1155/expected.js b/test/core/fixtures/transformation/misc/regression-1155/expected.js index e9efbee824..9acd4f71a6 100644 --- a/test/core/fixtures/transformation/misc/regression-1155/expected.js +++ b/test/core/fixtures/transformation/misc/regression-1155/expected.js @@ -1,11 +1,16 @@ "use strict"; -var Foo = function Foo(options) { - babelHelpers.classCallCheck(this, Foo); +var Foo = (function (_Bar) { + function Foo(options) { + babelHelpers.classCallCheck(this, Foo); - var parentOptions = {}; - parentOptions.init = function () { - this; - }; - babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this, parentOptions); -}; + var parentOptions = {}; + parentOptions.init = function () { + this; + }; + babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this, parentOptions); + } + + babelHelpers.inherits(Foo, _Bar); + return Foo; +})(Bar); diff --git a/test/core/fixtures/transformation/misc/regression-lodash-tostring-import/expected.js b/test/core/fixtures/transformation/misc/regression-lodash-tostring-import/expected.js index f061cdb9ad..86d5e19c3d 100644 --- a/test/core/fixtures/transformation/misc/regression-lodash-tostring-import/expected.js +++ b/test/core/fixtures/transformation/misc/regression-lodash-tostring-import/expected.js @@ -1,9 +1,7 @@ "use strict"; -var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; }; - var _toString = require("foo"); -var _toString2 = _interopRequireWildcard(_toString); +var _toString2 = babelHelpers.interopRequireWildcard(_toString); -_toString2["default"]; \ No newline at end of file +_toString2["default"];