add regeneratot transform to builtin-advanced group
This commit is contained in:
parent
9f2ac15695
commit
99c4810770
@ -59,13 +59,11 @@ export default {
|
||||
"es6.spec.blockScoping": require("./es6/spec.block-scoping"),
|
||||
reactCompat: require("./other/react-compat"),
|
||||
react: require("./other/react"),
|
||||
regenerator: require("./other/regenerator"),
|
||||
|
||||
// es6 syntax transformation is **forbidden** past this point since regenerator will chuck a massive
|
||||
// hissy fit
|
||||
|
||||
//- regenerator
|
||||
regenerator: require("./other/regenerator"),
|
||||
|
||||
//- builtin-modules
|
||||
runtime: require("./other/runtime"),
|
||||
"es6.modules": require("./es6/modules"),
|
||||
|
||||
@ -3,21 +3,23 @@ import * as t from "../../../types";
|
||||
import { NodePath } from "ast-types";
|
||||
|
||||
export var metadata = {
|
||||
group: "regenerator"
|
||||
group: "builtin-advanced"
|
||||
};
|
||||
|
||||
export function Func/*tion*/(node) {
|
||||
if (node.async || node.generator) {
|
||||
// Although this code transforms only the subtree rooted at the given
|
||||
// Function node, that node might contain other generator functions
|
||||
// that will also be transformed. It might help performance to ignore
|
||||
// nested functions, and rely on the traversal to visit them later,
|
||||
// but that's a small optimization. Starting here instead of at the
|
||||
// root of the AST is the key optimization, since huge async/generator
|
||||
// functions are relatively rare.
|
||||
regenerator.transform(convertNodePath(this));
|
||||
export var Func/*tion*/ = {
|
||||
exit(node) {
|
||||
if (node.async || node.generator) {
|
||||
// Although this code transforms only the subtree rooted at the given
|
||||
// Function node, that node might contain other generator functions
|
||||
// that will also be transformed. It might help performance to ignore
|
||||
// nested functions, and rely on the traversal to visit them later,
|
||||
// but that's a small optimization. Starting here instead of at the
|
||||
// root of the AST is the key optimization, since huge async/generator
|
||||
// functions are relatively rare.
|
||||
regenerator.transform(convertNodePath(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Given a Babel NodePath, return an ast-types NodePath that includes full
|
||||
// ancestry information (up to and including the Program node). This is
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user