Method names should not be bound to body
As an artificat of compiling methods to named function expressions the function name is being considered a "local" binding in the function body. This means that we will throw errors anytime someone would want to create a new local binding with the same name. This is solved by assigning a symbol to function Identifiers that indicates that they should not be considered local bindings.
This commit is contained in:
5
packages/babel-plugin-transform-es2015-classes/test/fixtures/regression/T6712/actual.js
vendored
Normal file
5
packages/babel-plugin-transform-es2015-classes/test/fixtures/regression/T6712/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
foo() {
|
||||
const foo = 2;
|
||||
}
|
||||
}
|
||||
15
packages/babel-plugin-transform-es2015-classes/test/fixtures/regression/T6712/expected.js
vendored
Normal file
15
packages/babel-plugin-transform-es2015-classes/test/fixtures/regression/T6712/expected.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
var A = function () {
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(A, [{
|
||||
key: "foo",
|
||||
value: function foo() {
|
||||
var foo = 2;
|
||||
}
|
||||
}]);
|
||||
return A;
|
||||
}();
|
||||
Reference in New Issue
Block a user