-
-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transformer/async-to-generator): support inferring the function …
…name from the ObjectPropertyValue's key (#7201) Support for inferring function name from ObjectPropertyValue's key For example: ```js ({ foo: async function() {} }) ``` After this, we will able to infer `foo` for the object method
- Loading branch information
Showing
5 changed files
with
157 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
commit: d20b314c | ||
|
||
Passed: 79/88 | ||
Passed: 80/89 | ||
|
||
# All Passed: | ||
* babel-plugin-transform-class-static-block | ||
|
23 changes: 23 additions & 0 deletions
23
...-plugin-transform-async-to-generator/test/fixtures/object/property-with-function/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const Normal = { | ||
foo: async () => { | ||
console.log(log) | ||
} | ||
} | ||
|
||
const StringLiteralKey = { | ||
['bar']: async () => { | ||
} | ||
} | ||
|
||
const EmptyStringLiteralKey = { | ||
['']: async () => { | ||
console.log(this) | ||
} | ||
} | ||
|
||
const InvalidStringLiteralKey = { | ||
['#']: async () => {}, | ||
['this']: async () => {}, | ||
['#default']: async () => {}, | ||
['O X C']: async () => {} | ||
} |
55 changes: 55 additions & 0 deletions
55
...plugin-transform-async-to-generator/test/fixtures/object/property-with-function/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
var _this = this; | ||
const Normal = { | ||
foo: function () { | ||
var _ref = babelHelpers.asyncToGenerator(function* () { | ||
console.log(log); | ||
}); | ||
return function foo() { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}() | ||
}; | ||
const StringLiteralKey = { | ||
['bar']: function () { | ||
var _ref2 = babelHelpers.asyncToGenerator(function* () {}); | ||
return function bar() { | ||
return _ref2.apply(this, arguments); | ||
}; | ||
}() | ||
}; | ||
const EmptyStringLiteralKey = { | ||
['']: function () { | ||
var _ref3 = babelHelpers.asyncToGenerator(function* () { | ||
console.log(_this); | ||
}); | ||
return function _() { | ||
return _ref3.apply(this, arguments); | ||
}; | ||
}() | ||
}; | ||
const InvalidStringLiteralKey = { | ||
['#']: function () { | ||
var _ref4 = babelHelpers.asyncToGenerator(function* () {}); | ||
return function _() { | ||
return _ref4.apply(this, arguments); | ||
}; | ||
}(), | ||
['this']: function () { | ||
var _ref5 = babelHelpers.asyncToGenerator(function* () {}); | ||
return function _this() { | ||
return _ref5.apply(this, arguments); | ||
}; | ||
}(), | ||
['#default']: function () { | ||
var _ref6 = babelHelpers.asyncToGenerator(function* () {}); | ||
return function _default() { | ||
return _ref6.apply(this, arguments); | ||
}; | ||
}(), | ||
['O X C']: function () { | ||
var _ref7 = babelHelpers.asyncToGenerator(function* () {}); | ||
return function O_X_C() { | ||
return _ref7.apply(this, arguments); | ||
}; | ||
}() | ||
}; |