shift-codegen
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -1,4 +0,5 @@ | ||
// istanbul ignore next | ||
"use strict"; | ||
// istanbul ignore next | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
@@ -8,5 +9,3 @@ | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x, | ||
property = _x2, | ||
receiver = _x3; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
@@ -38,3 +37,3 @@ exports["default"] = codeGen; | ||
var ts = new _token_stream.TokenStream(); | ||
var rep = _shiftReducer["default"](INSTANCE, script); | ||
var rep = (0, _shiftReducer["default"])(INSTANCE, script); | ||
rep.emit(ts); | ||
@@ -100,4 +99,4 @@ return ts.result; | ||
_function2: while (_again2) { | ||
var node = _x4; | ||
_again2 = false; | ||
var node = _x4; | ||
@@ -119,2 +118,3 @@ switch (node.type) { | ||
case "AssignmentExpression": | ||
case "CompoundAssignmentExpression": | ||
case "YieldExpression": | ||
@@ -164,5 +164,5 @@ case "YieldGeneratorExpression": | ||
return node.arguments.length === 0 ? Precedence.New : Precedence.Member; | ||
case "PostfixExpression": | ||
return Precedence.Postfix; | ||
case "PrefixExpression": | ||
case "UpdateExpression": | ||
return node.isPrefix ? Precedence.Prefix : Precedence.Postfix; | ||
case "UnaryExpression": | ||
return Precedence.Prefix; | ||
@@ -620,2 +620,19 @@ } | ||
} | ||
return objectAssign(seq(leftCode, t("="), rightCode), { containsIn: containsIn, startsWithCurly: startsWithCurly, startsWithFunctionOrClass: startsWithFunctionOrClass }); | ||
} | ||
}, { | ||
key: "reduceCompoundAssignmentExpression", | ||
value: function reduceCompoundAssignmentExpression(node, _ref4) { | ||
var binding = _ref4.binding; | ||
var expression = _ref4.expression; | ||
var leftCode = binding; | ||
var rightCode = expression; | ||
var containsIn = expression.containsIn; | ||
var startsWithCurly = binding.startsWithCurly; | ||
var startsWithFunctionOrClass = binding.startsWithFunctionOrClass; | ||
if (getPrecedence(node.expression) < getPrecedence(node)) { | ||
rightCode = paren(rightCode); | ||
containsIn = false; | ||
} | ||
return objectAssign(seq(leftCode, t(node.operator), rightCode), { containsIn: containsIn, startsWithCurly: startsWithCurly, startsWithFunctionOrClass: startsWithFunctionOrClass }); | ||
@@ -625,5 +642,5 @@ } | ||
key: "reduceBinaryExpression", | ||
value: function reduceBinaryExpression(node, _ref4) { | ||
var left = _ref4.left; | ||
var right = _ref4.right; | ||
value: function reduceBinaryExpression(node, _ref5) { | ||
var left = _ref5.left; | ||
var right = _ref5.right; | ||
@@ -655,5 +672,5 @@ var leftCode = left; | ||
key: "reduceBindingWithDefault", | ||
value: function reduceBindingWithDefault(node, _ref5) { | ||
var binding = _ref5.binding; | ||
var init = _ref5.init; | ||
value: function reduceBindingWithDefault(node, _ref6) { | ||
var binding = _ref6.binding; | ||
var init = _ref6.init; | ||
@@ -669,5 +686,5 @@ return seq(binding, t("="), init); | ||
key: "reduceArrayBinding", | ||
value: function reduceArrayBinding(node, _ref6) { | ||
var elements = _ref6.elements; | ||
var restElement = _ref6.restElement; | ||
value: function reduceArrayBinding(node, _ref7) { | ||
var elements = _ref7.elements; | ||
var restElement = _ref7.restElement; | ||
@@ -688,4 +705,4 @@ var content = undefined; | ||
key: "reduceObjectBinding", | ||
value: function reduceObjectBinding(node, _ref7) { | ||
var properties = _ref7.properties; | ||
value: function reduceObjectBinding(node, _ref8) { | ||
var properties = _ref8.properties; | ||
@@ -698,5 +715,5 @@ var state = brace(commaSep(properties)); | ||
key: "reduceBindingPropertyIdentifier", | ||
value: function reduceBindingPropertyIdentifier(node, _ref8) { | ||
var binding = _ref8.binding; | ||
var init = _ref8.init; | ||
value: function reduceBindingPropertyIdentifier(node, _ref9) { | ||
var binding = _ref9.binding; | ||
var init = _ref9.init; | ||
@@ -708,5 +725,5 @@ if (node.init == null) return binding; | ||
key: "reduceBindingPropertyProperty", | ||
value: function reduceBindingPropertyProperty(node, _ref9) { | ||
var name = _ref9.name; | ||
var binding = _ref9.binding; | ||
value: function reduceBindingPropertyProperty(node, _ref10) { | ||
var name = _ref10.name; | ||
var binding = _ref10.binding; | ||
@@ -717,4 +734,4 @@ return seq(name, t(":"), binding); | ||
key: "reduceBlock", | ||
value: function reduceBlock(node, _ref10) { | ||
var statements = _ref10.statements; | ||
value: function reduceBlock(node, _ref11) { | ||
var statements = _ref11.statements; | ||
@@ -725,4 +742,4 @@ return brace(seq.apply(undefined, _toConsumableArray(statements))); | ||
key: "reduceBlockStatement", | ||
value: function reduceBlockStatement(node, _ref11) { | ||
var block = _ref11.block; | ||
value: function reduceBlockStatement(node, _ref12) { | ||
var block = _ref12.block; | ||
@@ -733,4 +750,4 @@ return block; | ||
key: "reduceBreakStatement", | ||
value: function reduceBreakStatement(node, _ref12) { | ||
var label = _ref12.label; | ||
value: function reduceBreakStatement(node, _ref13) { | ||
var label = _ref13.label; | ||
@@ -741,5 +758,5 @@ return seq(t("break"), label ? t(label) : empty(), semiOp()); | ||
key: "reduceCallExpression", | ||
value: function reduceCallExpression(node, _ref13) { | ||
var callee = _ref13.callee; | ||
var args = _ref13.arguments; | ||
value: function reduceCallExpression(node, _ref14) { | ||
var callee = _ref14.callee; | ||
var args = _ref14.arguments; | ||
@@ -750,5 +767,5 @@ return objectAssign(seq(p(node.callee, getPrecedence(node), callee), paren(commaSep(args))), { startsWithCurly: callee.startsWithCurly, startsWithFunctionOrClass: callee.startsWithFunctionOrClass }); | ||
key: "reduceCatchClause", | ||
value: function reduceCatchClause(node, _ref14) { | ||
var binding = _ref14.binding; | ||
var body = _ref14.body; | ||
value: function reduceCatchClause(node, _ref15) { | ||
var binding = _ref15.binding; | ||
var body = _ref15.body; | ||
@@ -759,6 +776,6 @@ return seq(t("catch"), paren(binding), body); | ||
key: "reduceClassDeclaration", | ||
value: function reduceClassDeclaration(node, _ref15) { | ||
var name = _ref15.name; | ||
var _super = _ref15["super"]; | ||
var elements = _ref15.elements; | ||
value: function reduceClassDeclaration(node, _ref16) { | ||
var name = _ref16.name; | ||
var _super = _ref16["super"]; | ||
var elements = _ref16.elements; | ||
@@ -774,6 +791,6 @@ var state = seq(t("class"), name); | ||
key: "reduceClassExpression", | ||
value: function reduceClassExpression(node, _ref16) { | ||
var name = _ref16.name; | ||
var _super = _ref16["super"]; | ||
var elements = _ref16.elements; | ||
value: function reduceClassExpression(node, _ref17) { | ||
var name = _ref17.name; | ||
var _super = _ref17["super"]; | ||
var elements = _ref17.elements; | ||
@@ -793,4 +810,4 @@ var state = t("class"); | ||
key: "reduceClassElement", | ||
value: function reduceClassElement(node, _ref17) { | ||
var method = _ref17.method; | ||
value: function reduceClassElement(node, _ref18) { | ||
var method = _ref18.method; | ||
@@ -802,5 +819,5 @@ if (!node.isStatic) return method; | ||
key: "reduceComputedMemberExpression", | ||
value: function reduceComputedMemberExpression(node, _ref18) { | ||
var object = _ref18.object; | ||
var expression = _ref18.expression; | ||
value: function reduceComputedMemberExpression(node, _ref19) { | ||
var object = _ref19.object; | ||
var expression = _ref19.expression; | ||
@@ -811,4 +828,4 @@ return objectAssign(seq(p(node.object, getPrecedence(node), object), bracket(expression)), { startsWithCurly: object.startsWithCurly, startsWithFunctionOrClass: object.startsWithFunctionOrClass }); | ||
key: "reduceComputedPropertyName", | ||
value: function reduceComputedPropertyName(node, _ref19) { | ||
var expression = _ref19.expression; | ||
value: function reduceComputedPropertyName(node, _ref20) { | ||
var expression = _ref20.expression; | ||
@@ -819,6 +836,6 @@ return bracket(expression); | ||
key: "reduceConditionalExpression", | ||
value: function reduceConditionalExpression(node, _ref20) { | ||
var test = _ref20.test; | ||
var consequent = _ref20.consequent; | ||
var alternate = _ref20.alternate; | ||
value: function reduceConditionalExpression(node, _ref21) { | ||
var test = _ref21.test; | ||
var consequent = _ref21.consequent; | ||
var alternate = _ref21.alternate; | ||
@@ -836,4 +853,4 @@ var containsIn = test.containsIn || alternate.containsIn; | ||
key: "reduceContinueStatement", | ||
value: function reduceContinueStatement(node, _ref21) { | ||
var label = _ref21.label; | ||
value: function reduceContinueStatement(node, _ref22) { | ||
var label = _ref22.label; | ||
@@ -844,5 +861,5 @@ return seq(t("continue"), label ? t(label) : empty(), semiOp()); | ||
key: "reduceDataProperty", | ||
value: function reduceDataProperty(node, _ref22) { | ||
var name = _ref22.name; | ||
var expression = _ref22.expression; | ||
value: function reduceDataProperty(node, _ref23) { | ||
var name = _ref23.name; | ||
var expression = _ref23.expression; | ||
@@ -858,5 +875,5 @@ return seq(name, t(":"), getAssignmentExpr(expression)); | ||
key: "reduceDoWhileStatement", | ||
value: function reduceDoWhileStatement(node, _ref23) { | ||
var body = _ref23.body; | ||
var test = _ref23.test; | ||
value: function reduceDoWhileStatement(node, _ref24) { | ||
var body = _ref24.body; | ||
var test = _ref24.test; | ||
@@ -872,4 +889,4 @@ return seq(t("do"), body, t("while"), paren(test), semiOp()); | ||
key: "reduceExpressionStatement", | ||
value: function reduceExpressionStatement(node, _ref24) { | ||
var expression = _ref24.expression; | ||
value: function reduceExpressionStatement(node, _ref25) { | ||
var expression = _ref25.expression; | ||
@@ -880,6 +897,6 @@ return seq(expression.startsWithCurly || expression.startsWithFunctionOrClass ? paren(expression) : expression, semiOp()); | ||
key: "reduceForInStatement", | ||
value: function reduceForInStatement(node, _ref25) { | ||
var left = _ref25.left; | ||
var right = _ref25.right; | ||
var body = _ref25.body; | ||
value: function reduceForInStatement(node, _ref26) { | ||
var left = _ref26.left; | ||
var right = _ref26.right; | ||
var body = _ref26.body; | ||
@@ -901,6 +918,6 @@ var leftP = left; | ||
key: "reduceForOfStatement", | ||
value: function reduceForOfStatement(node, _ref26) { | ||
var left = _ref26.left; | ||
var right = _ref26.right; | ||
var body = _ref26.body; | ||
value: function reduceForOfStatement(node, _ref27) { | ||
var left = _ref27.left; | ||
var right = _ref27.right; | ||
var body = _ref27.body; | ||
@@ -912,7 +929,7 @@ left = node.left.type === "VariableDeclaration" ? noIn(markContainsIn(left)) : left; | ||
key: "reduceForStatement", | ||
value: function reduceForStatement(node, _ref27) { | ||
var init = _ref27.init; | ||
var test = _ref27.test; | ||
var update = _ref27.update; | ||
var body = _ref27.body; | ||
value: function reduceForStatement(node, _ref28) { | ||
var init = _ref28.init; | ||
var test = _ref28.test; | ||
var update = _ref28.update; | ||
var body = _ref28.body; | ||
@@ -925,5 +942,5 @@ return objectAssign(seq(t("for"), paren(seq(init ? noIn(markContainsIn(init)) : empty(), semi(), test || empty(), semi(), update || empty())), body), { | ||
key: "reduceFunctionBody", | ||
value: function reduceFunctionBody(node, _ref28) { | ||
var directives = _ref28.directives; | ||
var statements = _ref28.statements; | ||
value: function reduceFunctionBody(node, _ref29) { | ||
var directives = _ref29.directives; | ||
var statements = _ref29.statements; | ||
@@ -937,6 +954,6 @@ if (statements.length) { | ||
key: "reduceFunctionDeclaration", | ||
value: function reduceFunctionDeclaration(node, _ref29) { | ||
var name = _ref29.name; | ||
var params = _ref29.params; | ||
var body = _ref29.body; | ||
value: function reduceFunctionDeclaration(node, _ref30) { | ||
var name = _ref30.name; | ||
var params = _ref30.params; | ||
var body = _ref30.body; | ||
@@ -947,6 +964,6 @@ return seq(t("function"), node.isGenerator ? t("*") : empty(), node.name.name === "*default*" ? empty() : name, paren(params), brace(body)); | ||
key: "reduceFunctionExpression", | ||
value: function reduceFunctionExpression(node, _ref30) { | ||
var name = _ref30.name; | ||
var params = _ref30.params; | ||
var body = _ref30.body; | ||
value: function reduceFunctionExpression(node, _ref31) { | ||
var name = _ref31.name; | ||
var params = _ref31.params; | ||
var body = _ref31.body; | ||
@@ -959,5 +976,5 @@ var state = seq(t("function"), node.isGenerator ? t("*") : empty(), name ? name : empty(), paren(params), brace(body)); | ||
key: "reduceFormalParameters", | ||
value: function reduceFormalParameters(node, _ref31) { | ||
var items = _ref31.items; | ||
var rest = _ref31.rest; | ||
value: function reduceFormalParameters(node, _ref32) { | ||
var items = _ref32.items; | ||
var rest = _ref32.rest; | ||
@@ -968,5 +985,5 @@ return commaSep(items.concat(rest == null ? [] : [seq(t("..."), rest)])); | ||
key: "reduceArrowExpression", | ||
value: function reduceArrowExpression(node, _ref32) { | ||
var params = _ref32.params; | ||
var body = _ref32.body; | ||
value: function reduceArrowExpression(node, _ref33) { | ||
var params = _ref33.params; | ||
var body = _ref33.body; | ||
@@ -985,5 +1002,5 @@ if (node.params.rest != null || node.params.items.length !== 1 || node.params.items[0].type !== "BindingIdentifier") { | ||
key: "reduceGetter", | ||
value: function reduceGetter(node, _ref33) { | ||
var name = _ref33.name; | ||
var body = _ref33.body; | ||
value: function reduceGetter(node, _ref34) { | ||
var name = _ref34.name; | ||
var body = _ref34.body; | ||
@@ -999,6 +1016,6 @@ return seq(t("get"), name, paren(empty()), brace(body)); | ||
key: "reduceIfStatement", | ||
value: function reduceIfStatement(node, _ref34) { | ||
var test = _ref34.test; | ||
var consequent = _ref34.consequent; | ||
var alternate = _ref34.alternate; | ||
value: function reduceIfStatement(node, _ref35) { | ||
var test = _ref35.test; | ||
var consequent = _ref35.consequent; | ||
var alternate = _ref35.alternate; | ||
@@ -1012,5 +1029,5 @@ if (alternate && consequent.endsWithMissingElse) { | ||
key: "reduceImport", | ||
value: function reduceImport(node, _ref35) { | ||
var defaultBinding = _ref35.defaultBinding; | ||
var namedImports = _ref35.namedImports; | ||
value: function reduceImport(node, _ref36) { | ||
var defaultBinding = _ref36.defaultBinding; | ||
var namedImports = _ref36.namedImports; | ||
@@ -1031,5 +1048,5 @@ var bindings = []; | ||
key: "reduceImportNamespace", | ||
value: function reduceImportNamespace(node, _ref36) { | ||
var defaultBinding = _ref36.defaultBinding; | ||
var namespaceBinding = _ref36.namespaceBinding; | ||
value: function reduceImportNamespace(node, _ref37) { | ||
var defaultBinding = _ref37.defaultBinding; | ||
var namespaceBinding = _ref37.namespaceBinding; | ||
@@ -1040,4 +1057,4 @@ return seq(t("import"), defaultBinding == null ? empty() : seq(defaultBinding, t(",")), t("*"), t("as"), namespaceBinding, t("from"), t(escapeStringLiteral(node.moduleSpecifier)), semiOp()); | ||
key: "reduceImportSpecifier", | ||
value: function reduceImportSpecifier(node, _ref37) { | ||
var binding = _ref37.binding; | ||
value: function reduceImportSpecifier(node, _ref38) { | ||
var binding = _ref38.binding; | ||
@@ -1054,4 +1071,4 @@ if (node.name == null) return binding; | ||
key: "reduceExportFrom", | ||
value: function reduceExportFrom(node, _ref38) { | ||
var namedExports = _ref38.namedExports; | ||
value: function reduceExportFrom(node, _ref39) { | ||
var namedExports = _ref39.namedExports; | ||
@@ -1062,4 +1079,4 @@ return seq(t("export"), brace(commaSep(namedExports)), node.moduleSpecifier == null ? empty() : seq(t("from"), t(escapeStringLiteral(node.moduleSpecifier)), semiOp())); | ||
key: "reduceExport", | ||
value: function reduceExport(node, _ref39) { | ||
var declaration = _ref39.declaration; | ||
value: function reduceExport(node, _ref40) { | ||
var declaration = _ref40.declaration; | ||
@@ -1077,4 +1094,4 @@ switch (node.declaration.type) { | ||
key: "reduceExportDefault", | ||
value: function reduceExportDefault(node, _ref40) { | ||
var body = _ref40.body; | ||
value: function reduceExportDefault(node, _ref41) { | ||
var body = _ref41.body; | ||
@@ -1099,5 +1116,5 @@ body = body.startsWithFunctionOrClass ? paren(body) : body; | ||
key: "reduceLabeledStatement", | ||
value: function reduceLabeledStatement(node, _ref41) { | ||
var label = _ref41.label; | ||
var body = _ref41.body; | ||
value: function reduceLabeledStatement(node, _ref42) { | ||
var label = _ref42.label; | ||
var body = _ref42.body; | ||
@@ -1138,6 +1155,6 @@ return objectAssign(seq(t(label + ":"), body), { endsWithMissingElse: body.endsWithMissingElse }); | ||
key: "reduceMethod", | ||
value: function reduceMethod(node, _ref42) { | ||
var name = _ref42.name; | ||
var params = _ref42.params; | ||
var body = _ref42.body; | ||
value: function reduceMethod(node, _ref43) { | ||
var name = _ref43.name; | ||
var params = _ref43.params; | ||
var body = _ref43.body; | ||
@@ -1148,12 +1165,16 @@ return seq(node.isGenerator ? t("*") : empty(), name, paren(params), brace(body)); | ||
key: "reduceModule", | ||
value: function reduceModule(node, _ref43) { | ||
var items = _ref43.items; | ||
value: function reduceModule(node, _ref44) { | ||
var directives = _ref44.directives; | ||
var items = _ref44.items; | ||
return seq.apply(undefined, _toConsumableArray(items)); | ||
if (items.length) { | ||
items[0] = parenToAvoidBeingDirective(node.items[0], items[0]); | ||
} | ||
return seq.apply(undefined, _toConsumableArray(directives).concat(_toConsumableArray(items))); | ||
} | ||
}, { | ||
key: "reduceNewExpression", | ||
value: function reduceNewExpression(node, _ref44) { | ||
var callee = _ref44.callee; | ||
var args = _ref44.arguments; | ||
value: function reduceNewExpression(node, _ref45) { | ||
var callee = _ref45.callee; | ||
var args = _ref45.arguments; | ||
@@ -1170,4 +1191,4 @@ var calleeRep = getPrecedence(node.callee) == Precedence.Call ? paren(callee) : p(node.callee, getPrecedence(node), callee); | ||
key: "reduceObjectExpression", | ||
value: function reduceObjectExpression(node, _ref45) { | ||
var properties = _ref45.properties; | ||
value: function reduceObjectExpression(node, _ref46) { | ||
var properties = _ref46.properties; | ||
@@ -1179,12 +1200,16 @@ var state = brace(commaSep(properties)); | ||
}, { | ||
key: "reducePostfixExpression", | ||
value: function reducePostfixExpression(node, _ref46) { | ||
var operand = _ref46.operand; | ||
key: "reduceUpdateExpression", | ||
value: function reduceUpdateExpression(node, _ref47) { | ||
var operand = _ref47.operand; | ||
return objectAssign(seq(p(node.operand, Precedence.New, operand), t(node.operator)), { startsWithCurly: operand.startsWithCurly, startsWithFunctionOrClass: operand.startsWithFunctionOrClass }); | ||
if (node.isPrefix) { | ||
return this.reduceUnaryExpression.apply(this, arguments); | ||
} else { | ||
return objectAssign(seq(p(node.operand, Precedence.New, operand), t(node.operator)), { startsWithCurly: operand.startsWithCurly, startsWithFunctionOrClass: operand.startsWithFunctionOrClass }); | ||
} | ||
} | ||
}, { | ||
key: "reducePrefixExpression", | ||
value: function reducePrefixExpression(node, _ref47) { | ||
var operand = _ref47.operand; | ||
key: "reduceUnaryExpression", | ||
value: function reduceUnaryExpression(node, _ref48) { | ||
var operand = _ref48.operand; | ||
@@ -1195,4 +1220,4 @@ return seq(t(node.operator), p(node.operand, getPrecedence(node), operand)); | ||
key: "reduceReturnStatement", | ||
value: function reduceReturnStatement(node, _ref48) { | ||
var expression = _ref48.expression; | ||
value: function reduceReturnStatement(node, _ref49) { | ||
var expression = _ref49.expression; | ||
@@ -1203,13 +1228,17 @@ return seq(t("return"), expression || empty(), semiOp()); | ||
key: "reduceScript", | ||
value: function reduceScript(node, _ref49) { | ||
var body = _ref49.body; | ||
value: function reduceScript(node, _ref50) { | ||
var directives = _ref50.directives; | ||
var statements = _ref50.statements; | ||
return body; | ||
if (statements.length) { | ||
statements[0] = parenToAvoidBeingDirective(node.statements[0], statements[0]); | ||
} | ||
return seq.apply(undefined, _toConsumableArray(directives).concat(_toConsumableArray(statements))); | ||
} | ||
}, { | ||
key: "reduceSetter", | ||
value: function reduceSetter(node, _ref50) { | ||
var name = _ref50.name; | ||
var param = _ref50.param; | ||
var body = _ref50.body; | ||
value: function reduceSetter(node, _ref51) { | ||
var name = _ref51.name; | ||
var param = _ref51.param; | ||
var body = _ref51.body; | ||
@@ -1225,5 +1254,5 @@ return seq(t("set"), name, paren(param), brace(body)); | ||
key: "reduceStaticMemberExpression", | ||
value: function reduceStaticMemberExpression(node, _ref51) { | ||
var object = _ref51.object; | ||
var property = _ref51.property; | ||
value: function reduceStaticMemberExpression(node, _ref52) { | ||
var object = _ref52.object; | ||
var property = _ref52.property; | ||
@@ -1253,5 +1282,5 @@ var state = seq(p(node.object, getPrecedence(node), object), t("."), t(property)); | ||
key: "reduceSwitchCase", | ||
value: function reduceSwitchCase(node, _ref52) { | ||
var test = _ref52.test; | ||
var consequent = _ref52.consequent; | ||
value: function reduceSwitchCase(node, _ref53) { | ||
var test = _ref53.test; | ||
var consequent = _ref53.consequent; | ||
@@ -1262,4 +1291,4 @@ return seq(t("case"), test, t(":"), seq.apply(undefined, _toConsumableArray(consequent))); | ||
key: "reduceSwitchDefault", | ||
value: function reduceSwitchDefault(node, _ref53) { | ||
var consequent = _ref53.consequent; | ||
value: function reduceSwitchDefault(node, _ref54) { | ||
var consequent = _ref54.consequent; | ||
@@ -1270,5 +1299,5 @@ return seq(t("default:"), seq.apply(undefined, _toConsumableArray(consequent))); | ||
key: "reduceSwitchStatement", | ||
value: function reduceSwitchStatement(node, _ref54) { | ||
var discriminant = _ref54.discriminant; | ||
var cases = _ref54.cases; | ||
value: function reduceSwitchStatement(node, _ref55) { | ||
var discriminant = _ref55.discriminant; | ||
var cases = _ref55.cases; | ||
@@ -1279,7 +1308,7 @@ return seq(t("switch"), paren(discriminant), brace(seq.apply(undefined, _toConsumableArray(cases)))); | ||
key: "reduceSwitchStatementWithDefault", | ||
value: function reduceSwitchStatementWithDefault(node, _ref55) { | ||
var discriminant = _ref55.discriminant; | ||
var preDefaultCases = _ref55.preDefaultCases; | ||
var defaultCase = _ref55.defaultCase; | ||
var postDefaultCases = _ref55.postDefaultCases; | ||
value: function reduceSwitchStatementWithDefault(node, _ref56) { | ||
var discriminant = _ref56.discriminant; | ||
var preDefaultCases = _ref56.preDefaultCases; | ||
var defaultCase = _ref56.defaultCase; | ||
var postDefaultCases = _ref56.postDefaultCases; | ||
@@ -1290,5 +1319,5 @@ return seq(t("switch"), paren(discriminant), brace(seq.apply(undefined, _toConsumableArray(preDefaultCases).concat([defaultCase], _toConsumableArray(postDefaultCases))))); | ||
key: "reduceTemplateExpression", | ||
value: function reduceTemplateExpression(node, _ref56) { | ||
var tag = _ref56.tag; | ||
var elements = _ref56.elements; | ||
value: function reduceTemplateExpression(node, _ref57) { | ||
var tag = _ref57.tag; | ||
var elements = _ref57.elements; | ||
@@ -1328,4 +1357,4 @@ var state = node.tag == null ? empty() : p(node.tag, getPrecedence(node), tag); | ||
key: "reduceThrowStatement", | ||
value: function reduceThrowStatement(node, _ref57) { | ||
var expression = _ref57.expression; | ||
value: function reduceThrowStatement(node, _ref58) { | ||
var expression = _ref58.expression; | ||
@@ -1336,5 +1365,5 @@ return seq(t("throw"), expression, semiOp()); | ||
key: "reduceTryCatchStatement", | ||
value: function reduceTryCatchStatement(node, _ref58) { | ||
var body = _ref58.body; | ||
var catchClause = _ref58.catchClause; | ||
value: function reduceTryCatchStatement(node, _ref59) { | ||
var body = _ref59.body; | ||
var catchClause = _ref59.catchClause; | ||
@@ -1345,6 +1374,6 @@ return seq(t("try"), body, catchClause); | ||
key: "reduceTryFinallyStatement", | ||
value: function reduceTryFinallyStatement(node, _ref59) { | ||
var body = _ref59.body; | ||
var catchClause = _ref59.catchClause; | ||
var finalizer = _ref59.finalizer; | ||
value: function reduceTryFinallyStatement(node, _ref60) { | ||
var body = _ref60.body; | ||
var catchClause = _ref60.catchClause; | ||
var finalizer = _ref60.finalizer; | ||
@@ -1355,4 +1384,4 @@ return seq(t("try"), body, catchClause || empty(), t("finally"), finalizer); | ||
key: "reduceYieldExpression", | ||
value: function reduceYieldExpression(node, _ref60) { | ||
var expression = _ref60.expression; | ||
value: function reduceYieldExpression(node, _ref61) { | ||
var expression = _ref61.expression; | ||
@@ -1364,4 +1393,4 @@ if (node.expression == null) return t("yield"); | ||
key: "reduceYieldGeneratorExpression", | ||
value: function reduceYieldGeneratorExpression(node, _ref61) { | ||
var expression = _ref61.expression; | ||
value: function reduceYieldGeneratorExpression(node, _ref62) { | ||
var expression = _ref62.expression; | ||
@@ -1378,4 +1407,4 @@ return seq(t("yield"), t("*"), p(node.expression, getPrecedence(node), expression)); | ||
key: "reduceVariableDeclaration", | ||
value: function reduceVariableDeclaration(node, _ref62) { | ||
var declarators = _ref62.declarators; | ||
value: function reduceVariableDeclaration(node, _ref63) { | ||
var declarators = _ref63.declarators; | ||
@@ -1386,4 +1415,4 @@ return seq(t(node.kind), commaSep(declarators)); | ||
key: "reduceVariableDeclarationStatement", | ||
value: function reduceVariableDeclarationStatement(node, _ref63) { | ||
var declaration = _ref63.declaration; | ||
value: function reduceVariableDeclarationStatement(node, _ref64) { | ||
var declaration = _ref64.declaration; | ||
@@ -1394,5 +1423,5 @@ return seq(declaration, semiOp()); | ||
key: "reduceVariableDeclarator", | ||
value: function reduceVariableDeclarator(node, _ref64) { | ||
var binding = _ref64.binding; | ||
var init = _ref64.init; | ||
value: function reduceVariableDeclarator(node, _ref65) { | ||
var binding = _ref65.binding; | ||
var init = _ref65.init; | ||
@@ -1411,5 +1440,5 @@ var containsIn = init && init.containsIn && !init.containsGroup; | ||
key: "reduceWhileStatement", | ||
value: function reduceWhileStatement(node, _ref65) { | ||
var test = _ref65.test; | ||
var body = _ref65.body; | ||
value: function reduceWhileStatement(node, _ref66) { | ||
var test = _ref66.test; | ||
var body = _ref66.body; | ||
@@ -1420,5 +1449,5 @@ return objectAssign(seq(t("while"), paren(test), body), { endsWithMissingElse: body.endsWithMissingElse }); | ||
key: "reduceWithStatement", | ||
value: function reduceWithStatement(node, _ref66) { | ||
var object = _ref66.object; | ||
var body = _ref66.body; | ||
value: function reduceWithStatement(node, _ref67) { | ||
var object = _ref67.object; | ||
var body = _ref67.body; | ||
@@ -1425,0 +1454,0 @@ return objectAssign(seq(t("with"), paren(object), body), { endsWithMissingElse: body.endsWithMissingElse }); |
@@ -1,10 +0,1 @@ | ||
// istanbul ignore next | ||
"use strict"; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
// istanbul ignore next | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
/** | ||
@@ -26,2 +17,12 @@ * Copyright 2014 Shape Security, Inc. | ||
"use strict"; | ||
// istanbul ignore next | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
// istanbul ignore next | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var _esutils = require("esutils"); | ||
@@ -28,0 +29,0 @@ |
{ | ||
"name": "shift-codegen", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "code generator for Shift format ASTs", | ||
@@ -16,5 +16,5 @@ "author": "Shape Security Labs", | ||
"scripts": { | ||
"test": "mocha --inline-diffs --check-leaks --ui tdd --reporter dot --recursive test", | ||
"test": "mocha --inline-diffs --check-leaks --ui tdd --reporter dot --timeout 5000 --recursive test", | ||
"build": "babel --auxiliary-comment 'istanbul ignore next' --modules commonStrict --source-maps-inline --out-dir dist src", | ||
"generate-coverage": "istanbul cover _mocha -- --inline-diffs --check-leaks --ui tdd --reporter dot --recursive test", | ||
"generate-coverage": "istanbul cover _mocha -- --inline-diffs --check-leaks --ui tdd --reporter dot --timeout 5000 --recursive test", | ||
"check-coverage": "istanbul check-coverage --statements 100 --functions 100 --branches 100 --lines 100", | ||
@@ -35,3 +35,3 @@ "cjsify": "cjsify --export ShiftCodegen lib/index.js > shift-codegen.js" | ||
"mocha": "2.2.4", | ||
"shift-parser": "2.1.0" | ||
"shift-parser": "3.0.1" | ||
}, | ||
@@ -38,0 +38,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
60888
1311
0