v3 new release (#84)

swap to graphql
This commit is contained in:
github-actions[bot]
2022-07-11 13:48:02 -04:00
committed by GitHub
parent 20d2b4f98d
commit e4f3964f67
1492 changed files with 63799 additions and 63001 deletions

View File

@ -3,19 +3,19 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BreakStatement = void 0;
exports.BreakStatement = BreakStatement;
exports.CatchClause = CatchClause;
exports.ContinueStatement = void 0;
exports.ContinueStatement = ContinueStatement;
exports.DebuggerStatement = DebuggerStatement;
exports.DoWhileStatement = DoWhileStatement;
exports.ForOfStatement = exports.ForInStatement = void 0;
exports.ForStatement = ForStatement;
exports.IfStatement = IfStatement;
exports.LabeledStatement = LabeledStatement;
exports.ReturnStatement = void 0;
exports.ReturnStatement = ReturnStatement;
exports.SwitchCase = SwitchCase;
exports.SwitchStatement = SwitchStatement;
exports.ThrowStatement = void 0;
exports.ThrowStatement = ThrowStatement;
exports.TryStatement = TryStatement;
exports.VariableDeclaration = VariableDeclaration;
exports.VariableDeclarator = VariableDeclarator;
@ -72,8 +72,15 @@ function IfStatement(node) {
}
function getLastStatement(statement) {
if (!isStatement(statement.body)) return statement;
return getLastStatement(statement.body);
const {
body
} = statement;
if (isStatement(body) === false) {
return statement;
}
return getLastStatement(body);
}
function ForStatement(node) {
@ -110,30 +117,29 @@ function WhileStatement(node) {
this.printBlock(node);
}
const buildForXStatement = function (op) {
return function (node) {
this.word("for");
this.space();
function ForXStatement(node) {
this.word("for");
this.space();
const isForOf = node.type === "ForOfStatement";
if (op === "of" && node.await) {
this.word("await");
this.space();
}
this.token("(");
this.print(node.left, node);
if (isForOf && node.await) {
this.word("await");
this.space();
this.word(op);
this.space();
this.print(node.right, node);
this.token(")");
this.printBlock(node);
};
};
}
const ForInStatement = buildForXStatement("in");
this.token("(");
this.print(node.left, node);
this.space();
this.word(isForOf ? "of" : "in");
this.space();
this.print(node.right, node);
this.token(")");
this.printBlock(node);
}
const ForInStatement = ForXStatement;
exports.ForInStatement = ForInStatement;
const ForOfStatement = buildForXStatement("of");
const ForOfStatement = ForXStatement;
exports.ForOfStatement = ForOfStatement;
function DoWhileStatement(node) {
@ -149,31 +155,34 @@ function DoWhileStatement(node) {
this.semicolon();
}
function buildLabelStatement(prefix, key = "label") {
return function (node) {
this.word(prefix);
const label = node[key];
function printStatementAfterKeyword(printer, node, parent, isLabel) {
if (node) {
printer.space();
printer.printTerminatorless(node, parent, isLabel);
}
if (label) {
this.space();
const isLabel = key == "label";
const terminatorState = this.startTerminatorless(isLabel);
this.print(label, node);
this.endTerminatorless(terminatorState);
}
this.semicolon();
};
printer.semicolon();
}
const ContinueStatement = buildLabelStatement("continue");
exports.ContinueStatement = ContinueStatement;
const ReturnStatement = buildLabelStatement("return", "argument");
exports.ReturnStatement = ReturnStatement;
const BreakStatement = buildLabelStatement("break");
exports.BreakStatement = BreakStatement;
const ThrowStatement = buildLabelStatement("throw", "argument");
exports.ThrowStatement = ThrowStatement;
function BreakStatement(node) {
this.word("break");
printStatementAfterKeyword(this, node.label, node, true);
}
function ContinueStatement(node) {
this.word("continue");
printStatementAfterKeyword(this, node.label, node, true);
}
function ReturnStatement(node) {
this.word("return");
printStatementAfterKeyword(this, node.argument, node, false);
}
function ThrowStatement(node) {
this.word("throw");
printStatementAfterKeyword(this, node.argument, node, false);
}
function LabeledStatement(node) {
this.print(node.label, node);