rename es5-property-methods-assignment to es6-property-method-assignment and add function ids to object methods and remap them if they contain a reference to themselves - fixes #308
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
var obj = {
|
||||
get foo() {
|
||||
return 5 + 5;
|
||||
return 5 + 5;
|
||||
},
|
||||
set foo(value) {
|
||||
this._foo = value;
|
||||
this._foo = value;
|
||||
}
|
||||
};
|
||||
19
test/fixtures/transformation/es6-property-methods-assignment/method-self-reference/actual.js
vendored
Normal file
19
test/fixtures/transformation/es6-property-methods-assignment/method-self-reference/actual.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
var bar = {
|
||||
foo() {
|
||||
console.log(foo);
|
||||
}
|
||||
};
|
||||
|
||||
var bar = {
|
||||
foo() {
|
||||
var foo = 41;
|
||||
console.log(foo);
|
||||
}
|
||||
};
|
||||
|
||||
var foobar = 123;
|
||||
var foobar2 = {
|
||||
foobar() {
|
||||
return foobar;
|
||||
}
|
||||
};
|
||||
42
test/fixtures/transformation/es6-property-methods-assignment/method-self-reference/expected.js
vendored
Normal file
42
test/fixtures/transformation/es6-property-methods-assignment/method-self-reference/expected.js
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
var bar = {
|
||||
foo: (function (_foo) {
|
||||
var _fooWrapper = function foo() {
|
||||
return _foo.apply(this, arguments);
|
||||
};
|
||||
|
||||
_fooWrapper.toString = function () {
|
||||
return _foo.toString();
|
||||
};
|
||||
|
||||
return _fooWrapper;
|
||||
})(function () {
|
||||
console.log(foo);
|
||||
})
|
||||
};
|
||||
|
||||
var bar = {
|
||||
foo: function foo() {
|
||||
var foo = 41;
|
||||
console.log(foo);
|
||||
}
|
||||
};
|
||||
|
||||
var foobar = 123;
|
||||
var foobar2 = {
|
||||
foobar: (function (_foobar) {
|
||||
var _foobarWrapper = function foobar() {
|
||||
return _foobar.apply(this, arguments);
|
||||
};
|
||||
|
||||
_foobarWrapper.toString = function () {
|
||||
return _foobar.toString();
|
||||
};
|
||||
|
||||
return _foobarWrapper;
|
||||
})(function () {
|
||||
console.log(foobar);
|
||||
})
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var obj = {
|
||||
method() {
|
||||
return 5 + 5;
|
||||
return 5 + 5;
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var obj = {
|
||||
method: function () {
|
||||
method: function method() {
|
||||
return 5 + 5;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user