remove use of exports
This commit is contained in:
parent
d38f18af40
commit
65a44a1e13
@ -1,7 +1,9 @@
|
||||
import explode from "./explode-assignable-expression";
|
||||
import * as t from "../../types";
|
||||
|
||||
export default function (exports, opts) {
|
||||
export default function (opts) {
|
||||
var exports = {};
|
||||
|
||||
var isAssignment = function (node) {
|
||||
return node.operator === opts.operator + "=";
|
||||
};
|
||||
@ -40,4 +42,6 @@ export default function (exports, opts) {
|
||||
if (node.operator !== opts.operator) return;
|
||||
return opts.build(node.left, node.right);
|
||||
};
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
@ -55,7 +55,7 @@ export function ForOfStatement(node, parent, scope, file) {
|
||||
|
||||
export { ForOfStatement as ForInStatement };
|
||||
|
||||
exports.Function = function (node, parent, scope, file) {
|
||||
export function Func(node, parent, scope, file) {
|
||||
var nodes = [];
|
||||
|
||||
var hasDestructuring = false;
|
||||
@ -85,7 +85,7 @@ exports.Function = function (node, parent, scope, file) {
|
||||
|
||||
var block = node.body;
|
||||
block.body = nodes.concat(block.body);
|
||||
};
|
||||
}
|
||||
|
||||
export function CatchClause(node, parent, scope, file) {
|
||||
var pattern = node.param;
|
||||
|
||||
@ -20,7 +20,7 @@ var iifeVisitor = {
|
||||
}
|
||||
};
|
||||
|
||||
exports.Function = function (node, parent, scope, file) {
|
||||
export function Func(node, parent, scope, file) {
|
||||
if (!hasDefaults(node)) return;
|
||||
|
||||
t.ensureBlock(node);
|
||||
@ -92,4 +92,4 @@ exports.Function = function (node, parent, scope, file) {
|
||||
} else {
|
||||
node.body.body = body.concat(node.body.body);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ var hasRest = function (node) {
|
||||
return t.isRestElement(node.params[node.params.length - 1]);
|
||||
};
|
||||
|
||||
exports.Function = function (node, parent, scope, file) {
|
||||
export function Func(node, parent, scope, file) {
|
||||
if (!hasRest(node)) return;
|
||||
|
||||
var rest = node.params.pop().argument;
|
||||
@ -135,4 +135,4 @@ exports.Function = function (node, parent, scope, file) {
|
||||
});
|
||||
loop._blockHoist = node.params.length + 1;
|
||||
node.body.body.unshift(loop);
|
||||
};
|
||||
}
|
||||
|
||||
@ -10,11 +10,11 @@ export var metadata = {
|
||||
group: "builtin-trailing"
|
||||
};
|
||||
|
||||
exports.Function = function (node, parent, scope, file) {
|
||||
export function Func(node, parent, scope, file) {
|
||||
if (node.generator || node.async) return;
|
||||
var tailCall = new TailCallTransformer(this, scope, file);
|
||||
tailCall.run();
|
||||
};
|
||||
}
|
||||
|
||||
function returnBlock(expr) {
|
||||
return t.blockStatement([t.returnStatement(expr)]);
|
||||
|
||||
@ -9,10 +9,20 @@ export var metadata = {
|
||||
|
||||
var MATH_POW = t.memberExpression(t.identifier("Math"), t.identifier("pow"));
|
||||
|
||||
build(exports, {
|
||||
var {
|
||||
ExpressionStatement,
|
||||
AssignmentExpression,
|
||||
BinaryExpression
|
||||
} = build({
|
||||
operator: "**",
|
||||
|
||||
build(left, right) {
|
||||
return t.callExpression(MATH_POW, [left, right]);
|
||||
}
|
||||
});
|
||||
|
||||
export {
|
||||
ExpressionStatement,
|
||||
AssignmentExpression,
|
||||
BinaryExpression
|
||||
};
|
||||
|
||||
@ -7,8 +7,8 @@ export var metadata = {
|
||||
dependencies: ["es7.asyncFunctions", "es6.classes"]
|
||||
};
|
||||
|
||||
exports.Function = function (node, parent, scope, file) {
|
||||
export function Func(node, parent, scope, file) {
|
||||
if (!node.async || node.generator) return;
|
||||
|
||||
return remapAsyncToGenerator(node, file.addHelper("async-to-generator"), scope);
|
||||
};
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ export var metadata = {
|
||||
dependencies: ["es7.asyncFunctions", "es6.classes"]
|
||||
};
|
||||
|
||||
exports.Function = function (node, parent, scope, file) {
|
||||
export function Func(node, parent, scope, file) {
|
||||
if (!node.async || node.generator) return;
|
||||
|
||||
return remapAsyncToGenerator(
|
||||
@ -18,4 +18,4 @@ exports.Function = function (node, parent, scope, file) {
|
||||
t.memberExpression(file.addImport("bluebird", null, "absolute"), t.identifier("coroutine")),
|
||||
scope
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@ -12,12 +12,12 @@ export function Class(node) {
|
||||
node.implements = null;
|
||||
}
|
||||
|
||||
exports.Function = function (node) {
|
||||
export function Func(node) {
|
||||
for (var i = 0; i < node.params.length; i++) {
|
||||
var param = node.params[i];
|
||||
param.optional = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function TypeCastExpression(node) {
|
||||
return node.expression;
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
"ExportNamedDeclaration": ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
|
||||
"ImportDeclaration": ["Statement", "Declaration", "ModuleDeclaration"],
|
||||
|
||||
"ArrowFunctionExpression": ["Scopable", "Function", "Expression", "Pure"],
|
||||
"FunctionDeclaration": ["Scopable", "Function", "Statement", "Pure", "Declaration"],
|
||||
"FunctionExpression": ["Scopable", "Function", "Expression", "Pure"],
|
||||
"ArrowFunctionExpression": ["Scopable", "Function", "Func", "Expression", "Pure"],
|
||||
"FunctionDeclaration": ["Scopable", "Function", "Func", "Statement", "Pure", "Declaration"],
|
||||
"FunctionExpression": ["Scopable", "Function", "Func", "Expression", "Pure"],
|
||||
|
||||
"BlockStatement": ["Scopable", "Statement"],
|
||||
"Program": ["Scopable"],
|
||||
|
||||
@ -79,6 +79,8 @@ export function isType(nodeType, targetType) {
|
||||
|
||||
var aliases = t.FLIPPED_ALIAS_KEYS[targetType];
|
||||
if (aliases) {
|
||||
if (aliases[0] === nodeType) return true;
|
||||
|
||||
for (var alias of (aliases: Array)) {
|
||||
if (nodeType === alias) return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user