You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
745 B
34 lines
745 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = toBlock;
|
|
|
|
var _generated = require("../validators/generated");
|
|
|
|
var _generated2 = require("../builders/generated");
|
|
|
|
function toBlock(node, parent) {
|
|
if ((0, _generated.isBlockStatement)(node)) {
|
|
return node;
|
|
}
|
|
|
|
let blockNodes = [];
|
|
|
|
if ((0, _generated.isEmptyStatement)(node)) {
|
|
blockNodes = [];
|
|
} else {
|
|
if (!(0, _generated.isStatement)(node)) {
|
|
if ((0, _generated.isFunction)(parent)) {
|
|
node = (0, _generated2.returnStatement)(node);
|
|
} else {
|
|
node = (0, _generated2.expressionStatement)(node);
|
|
}
|
|
}
|
|
|
|
blockNodes = [node];
|
|
}
|
|
|
|
return (0, _generated2.blockStatement)(blockNodes);
|
|
} |