babel-generator
Advanced tools
Comparing version 6.5.2-canary.ab7533ed to 6.6.0
@@ -1,3 +0,1 @@ | ||
/* @flow */ | ||
"use strict"; | ||
@@ -23,5 +21,4 @@ | ||
/*:: import type Position from "./position";*/ | ||
var Buffer = (function () { | ||
function Buffer(position /*: Position*/, format /*: Object*/) { | ||
function Buffer(position, format) { | ||
_classCallCheck(this, Buffer); | ||
@@ -46,3 +43,3 @@ | ||
Buffer.prototype.catchUp = function catchUp(node /*: Object*/) { | ||
Buffer.prototype.catchUp = function catchUp(node) { | ||
// catch up to this nodes newline if we're behind | ||
@@ -60,3 +57,3 @@ if (node.loc && this.format.retainLines && this.buf) { | ||
Buffer.prototype.get = function get() /*: string*/ { | ||
Buffer.prototype.get = function get() { | ||
return _trimRight2["default"](this.buf); | ||
@@ -69,3 +66,3 @@ }; | ||
Buffer.prototype.getIndent = function getIndent() /*: string*/ { | ||
Buffer.prototype.getIndent = function getIndent() { | ||
if (this.format.compact || this.format.concise) { | ||
@@ -82,3 +79,3 @@ return ""; | ||
Buffer.prototype.indentSize = function indentSize() /*: number*/ { | ||
Buffer.prototype.indentSize = function indentSize() { | ||
return this.getIndent().length; | ||
@@ -135,3 +132,3 @@ }; | ||
Buffer.prototype.keyword = function keyword(name /*: string*/) { | ||
Buffer.prototype.keyword = function keyword(name) { | ||
this.push(name); | ||
@@ -145,3 +142,3 @@ this.space(); | ||
Buffer.prototype.space = function space(force /*:: ?: boolean*/) { | ||
Buffer.prototype.space = function space(force) { | ||
if (!force && this.format.compact) return; | ||
@@ -158,3 +155,3 @@ | ||
Buffer.prototype.removeLast = function removeLast(cha /*: string*/) { | ||
Buffer.prototype.removeLast = function removeLast(cha) { | ||
if (this.format.compact) return; | ||
@@ -164,3 +161,3 @@ return this._removeLast(cha); | ||
Buffer.prototype._removeLast = function _removeLast(cha /*: string*/) { | ||
Buffer.prototype._removeLast = function _removeLast(cha) { | ||
if (!this._isLast(cha)) return; | ||
@@ -188,3 +185,3 @@ this.buf = this.buf.slice(0, -1); | ||
Buffer.prototype.startTerminatorless = function startTerminatorless() /*: Object*/ { | ||
Buffer.prototype.startTerminatorless = function startTerminatorless() { | ||
return this.parenPushNewlineState = { | ||
@@ -199,3 +196,3 @@ printed: false | ||
Buffer.prototype.endTerminatorless = function endTerminatorless(state /*: Object*/) { | ||
Buffer.prototype.endTerminatorless = function endTerminatorless(state) { | ||
if (state.printed) { | ||
@@ -213,3 +210,3 @@ this.dedent(); | ||
Buffer.prototype.newline = function newline(i /*:: ?: boolean | number*/, removeLast /*:: ?: boolean*/) { | ||
Buffer.prototype.newline = function newline(i, removeLast) { | ||
if (this.format.retainLines || this.format.compact) return; | ||
@@ -258,3 +255,3 @@ | ||
Buffer.prototype.push = function push(str /*: string*/, noIndent /*:: ?: boolean*/) { | ||
Buffer.prototype.push = function push(str, noIndent) { | ||
if (!this.format.compact && this._indent && !noIndent && str !== "\n") { | ||
@@ -278,3 +275,3 @@ // we have an indent level and we aren't pushing a newline | ||
Buffer.prototype._push = function _push(str /*: string*/) /*: void*/ { | ||
Buffer.prototype._push = function _push(str) { | ||
// see startTerminatorless() instance method | ||
@@ -312,3 +309,3 @@ var parenPushNewlineState = this.parenPushNewlineState; | ||
Buffer.prototype.endsWith = function endsWith(str /*: string*/) /*: boolean*/ { | ||
Buffer.prototype.endsWith = function endsWith(str) { | ||
if (str.length === 1) { | ||
@@ -325,3 +322,3 @@ return this.last === str; | ||
Buffer.prototype.isLast = function isLast(cha /*: string*/) /*: boolean*/ { | ||
Buffer.prototype.isLast = function isLast(cha) { | ||
if (this.format.compact) return false; | ||
@@ -331,3 +328,3 @@ return this._isLast(cha); | ||
Buffer.prototype._isLast = function _isLast(cha /*: string*/) /*: boolean*/ { | ||
Buffer.prototype._isLast = function _isLast(cha) { | ||
var last = this.last; | ||
@@ -334,0 +331,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* @flow */ | ||
"use strict"; | ||
@@ -13,7 +11,7 @@ | ||
function File(node /*: Object*/) { | ||
function File(node) { | ||
this.print(node.program, node); | ||
} | ||
function Program(node /*: Object*/) { | ||
function Program(node) { | ||
this.printInnerComments(node, false); | ||
@@ -27,3 +25,3 @@ | ||
function BlockStatement(node /*: Object*/) { | ||
function BlockStatement(node) { | ||
this.push("{"); | ||
@@ -47,3 +45,3 @@ this.printInnerComments(node); | ||
function Directive(node /*: Object*/) { | ||
function Directive(node) { | ||
this.print(node.value, node); | ||
@@ -53,4 +51,4 @@ this.semicolon(); | ||
function DirectiveLiteral(node /*: Object*/) { | ||
function DirectiveLiteral(node) { | ||
this.push(this._stringLiteral(node.value)); | ||
} |
@@ -1,3 +0,1 @@ | ||
/* @flow */ | ||
"use strict"; | ||
@@ -11,3 +9,3 @@ | ||
function ClassDeclaration(node /*: Object*/) { | ||
function ClassDeclaration(node) { | ||
this.printJoin(node.decorators, node, { separator: "" }); | ||
@@ -40,3 +38,3 @@ this.push("class"); | ||
function ClassBody(node /*: Object*/) { | ||
function ClassBody(node) { | ||
this.push("{"); | ||
@@ -57,3 +55,3 @@ this.printInnerComments(node); | ||
function ClassProperty(node /*: Object*/) { | ||
function ClassProperty(node) { | ||
this.printJoin(node.decorators, node, { separator: "" }); | ||
@@ -73,3 +71,3 @@ | ||
function ClassMethod(node /*: Object*/) { | ||
function ClassMethod(node) { | ||
this.printJoin(node.decorators, node, { separator: "" }); | ||
@@ -76,0 +74,0 @@ |
@@ -1,2 +0,1 @@ | ||
/* @flow */ | ||
/* eslint max-len: 0 */ | ||
@@ -48,4 +47,5 @@ | ||
var ZERO_DECIMAL_INTEGER = /\.0+$/; | ||
var NON_DECIMAL_LITERAL = /^0[box]/; | ||
function UnaryExpression(node /*: Object*/) { | ||
function UnaryExpression(node) { | ||
var needsSpace = /[a-z]$/.test(node.operator); | ||
@@ -67,3 +67,3 @@ var arg = node.argument; | ||
function DoExpression(node /*: Object*/) { | ||
function DoExpression(node) { | ||
this.push("do"); | ||
@@ -74,3 +74,3 @@ this.space(); | ||
function ParenthesizedExpression(node /*: Object*/) { | ||
function ParenthesizedExpression(node) { | ||
this.push("("); | ||
@@ -81,3 +81,3 @@ this.print(node.expression, node); | ||
function UpdateExpression(node /*: Object*/) { | ||
function UpdateExpression(node) { | ||
if (node.prefix) { | ||
@@ -92,3 +92,3 @@ this.push(node.operator); | ||
function ConditionalExpression(node /*: Object*/) { | ||
function ConditionalExpression(node) { | ||
this.print(node.test, node); | ||
@@ -105,3 +105,3 @@ this.space(); | ||
function NewExpression(node /*: Object*/, parent /*: Object*/) { | ||
function NewExpression(node, parent) { | ||
this.push("new "); | ||
@@ -116,3 +116,3 @@ this.print(node.callee, node); | ||
function SequenceExpression(node /*: Object*/) { | ||
function SequenceExpression(node) { | ||
this.printList(node.expressions, node); | ||
@@ -129,3 +129,3 @@ } | ||
function Decorator(node /*: Object*/) { | ||
function Decorator(node) { | ||
this.push("@"); | ||
@@ -136,3 +136,3 @@ this.print(node.expression, node); | ||
function CallExpression(node /*: Object*/) { | ||
function CallExpression(node) { | ||
this.print(node.callee, node); | ||
@@ -162,4 +162,4 @@ if (node.loc) this.printAuxAfterComment(); | ||
function buildYieldAwait(keyword /*: string*/) { | ||
return function (node /*: Object*/) { | ||
function buildYieldAwait(keyword) { | ||
return function (node) { | ||
this.push(keyword); | ||
@@ -191,3 +191,3 @@ | ||
function ExpressionStatement(node /*: Object*/) { | ||
function ExpressionStatement(node) { | ||
this.print(node.expression, node); | ||
@@ -197,3 +197,3 @@ this.semicolon(); | ||
function AssignmentPattern(node /*: Object*/) { | ||
function AssignmentPattern(node) { | ||
this.print(node.left, node); | ||
@@ -206,3 +206,3 @@ this.space(); | ||
function AssignmentExpression(node /*: Object*/, parent /*: Object*/) { | ||
function AssignmentExpression(node, parent) { | ||
// Somewhere inside a for statement `init` node but doesn't usually | ||
@@ -244,3 +244,3 @@ // needs a paren except for `in` expressions: `for (a in b ? a : b;;)` | ||
function BindExpression(node /*: Object*/) { | ||
function BindExpression(node) { | ||
this.print(node.object, node); | ||
@@ -254,3 +254,3 @@ this.push("::"); | ||
function MemberExpression(node /*: Object*/) { | ||
function MemberExpression(node) { | ||
this.print(node.object, node); | ||
@@ -274,3 +274,3 @@ | ||
var val = this.getPossibleRaw(node.object) || node.object.value; | ||
if (_isInteger2["default"](+val) && !SCIENTIFIC_NOTATION.test(val) && !ZERO_DECIMAL_INTEGER.test(val) && !this.endsWith(".")) { | ||
if (_isInteger2["default"](+val) && !NON_DECIMAL_LITERAL.test(val) && !SCIENTIFIC_NOTATION.test(val) && !ZERO_DECIMAL_INTEGER.test(val) && !this.endsWith(".")) { | ||
this.push("."); | ||
@@ -285,3 +285,3 @@ } | ||
function MetaProperty(node /*: Object*/) { | ||
function MetaProperty(node) { | ||
this.print(node.meta, node); | ||
@@ -288,0 +288,0 @@ this.push("."); |
@@ -1,2 +0,1 @@ | ||
/* @flow */ | ||
/* eslint max-len: 0 */ | ||
@@ -55,3 +54,3 @@ | ||
function ArrayTypeAnnotation(node /*: Object*/) { | ||
function ArrayTypeAnnotation(node) { | ||
this.print(node.elementType, node); | ||
@@ -66,3 +65,3 @@ this.push("["); | ||
function BooleanLiteralTypeAnnotation(node /*: Object*/) { | ||
function BooleanLiteralTypeAnnotation(node) { | ||
this.push(node.value ? "true" : "false"); | ||
@@ -75,3 +74,3 @@ } | ||
function DeclareClass(node /*: Object*/) { | ||
function DeclareClass(node) { | ||
this.push("declare class "); | ||
@@ -81,3 +80,3 @@ this._interfaceish(node); | ||
function DeclareFunction(node /*: Object*/) { | ||
function DeclareFunction(node) { | ||
this.push("declare function "); | ||
@@ -89,3 +88,3 @@ this.print(node.id, node); | ||
function DeclareInterface(node /*: Object*/) { | ||
function DeclareInterface(node) { | ||
this.push("declare "); | ||
@@ -95,3 +94,3 @@ this.InterfaceDeclaration(node); | ||
function DeclareModule(node /*: Object*/) { | ||
function DeclareModule(node) { | ||
this.push("declare module "); | ||
@@ -103,3 +102,3 @@ this.print(node.id, node); | ||
function DeclareTypeAlias(node /*: Object*/) { | ||
function DeclareTypeAlias(node) { | ||
this.push("declare "); | ||
@@ -109,3 +108,3 @@ this.TypeAlias(node); | ||
function DeclareVariable(node /*: Object*/) { | ||
function DeclareVariable(node) { | ||
this.push("declare var "); | ||
@@ -121,3 +120,3 @@ this.print(node.id, node); | ||
function FunctionTypeAnnotation(node /*: Object*/, parent /*: Object*/) { | ||
function FunctionTypeAnnotation(node, parent) { | ||
this.print(node.typeParameters, node); | ||
@@ -150,3 +149,3 @@ this.push("("); | ||
function FunctionTypeParam(node /*: Object*/) { | ||
function FunctionTypeParam(node) { | ||
this.print(node.name, node); | ||
@@ -159,3 +158,3 @@ if (node.optional) this.push("?"); | ||
function InterfaceExtends(node /*: Object*/) { | ||
function InterfaceExtends(node) { | ||
this.print(node.id, node); | ||
@@ -168,3 +167,3 @@ this.print(node.typeParameters, node); | ||
function _interfaceish(node /*: Object*/) { | ||
function _interfaceish(node) { | ||
this.print(node.id, node); | ||
@@ -184,3 +183,3 @@ this.print(node.typeParameters, node); | ||
function InterfaceDeclaration(node /*: Object*/) { | ||
function InterfaceDeclaration(node) { | ||
this.push("interface "); | ||
@@ -190,3 +189,3 @@ this._interfaceish(node); | ||
function IntersectionTypeAnnotation(node /*: Object*/) { | ||
function IntersectionTypeAnnotation(node) { | ||
this.printJoin(node.types, node, { separator: " & " }); | ||
@@ -199,3 +198,3 @@ } | ||
function NullableTypeAnnotation(node /*: Object*/) { | ||
function NullableTypeAnnotation(node) { | ||
this.push("?"); | ||
@@ -213,3 +212,3 @@ this.print(node.typeAnnotation, node); | ||
function StringLiteralTypeAnnotation(node /*: Object*/) { | ||
function StringLiteralTypeAnnotation(node) { | ||
this.push(this._stringLiteral(node.value)); | ||
@@ -226,3 +225,3 @@ } | ||
function TupleTypeAnnotation(node /*: Object*/) { | ||
function TupleTypeAnnotation(node) { | ||
this.push("["); | ||
@@ -233,3 +232,3 @@ this.printJoin(node.types, node, { separator: ", " }); | ||
function TypeofTypeAnnotation(node /*: Object*/) { | ||
function TypeofTypeAnnotation(node) { | ||
this.push("typeof "); | ||
@@ -239,3 +238,3 @@ this.print(node.argument, node); | ||
function TypeAlias(node /*: Object*/) { | ||
function TypeAlias(node) { | ||
this.push("type "); | ||
@@ -251,3 +250,3 @@ this.print(node.id, node); | ||
function TypeAnnotation(node /*: Object*/) { | ||
function TypeAnnotation(node) { | ||
this.push(":"); | ||
@@ -259,3 +258,3 @@ this.space(); | ||
function TypeParameterInstantiation(node /*: Object*/) { | ||
function TypeParameterInstantiation(node) { | ||
// istanbul ignore next | ||
@@ -268,3 +267,3 @@ | ||
separator: ", ", | ||
iterator: function iterator(node /*: Object*/) { | ||
iterator: function iterator(node) { | ||
_this.print(node.typeAnnotation, node); | ||
@@ -278,3 +277,3 @@ } | ||
function ObjectTypeAnnotation(node /*: Object*/) { | ||
function ObjectTypeAnnotation(node) { | ||
// istanbul ignore next | ||
@@ -307,3 +306,3 @@ | ||
function ObjectTypeCallProperty(node /*: Object*/) { | ||
function ObjectTypeCallProperty(node) { | ||
if (node["static"]) this.push("static "); | ||
@@ -313,3 +312,3 @@ this.print(node.value, node); | ||
function ObjectTypeIndexer(node /*: Object*/) { | ||
function ObjectTypeIndexer(node) { | ||
if (node["static"]) this.push("static "); | ||
@@ -327,3 +326,3 @@ this.push("["); | ||
function ObjectTypeProperty(node /*: Object*/) { | ||
function ObjectTypeProperty(node) { | ||
if (node["static"]) this.push("static "); | ||
@@ -339,3 +338,3 @@ this.print(node.key, node); | ||
function QualifiedTypeIdentifier(node /*: Object*/) { | ||
function QualifiedTypeIdentifier(node) { | ||
this.print(node.qualification, node); | ||
@@ -346,7 +345,7 @@ this.push("."); | ||
function UnionTypeAnnotation(node /*: Object*/) { | ||
function UnionTypeAnnotation(node) { | ||
this.printJoin(node.types, node, { separator: " | " }); | ||
} | ||
function TypeCastExpression(node /*: Object*/) { | ||
function TypeCastExpression(node) { | ||
this.push("("); | ||
@@ -353,0 +352,0 @@ this.print(node.expression, node); |
@@ -1,3 +0,1 @@ | ||
/* @flow */ | ||
"use strict"; | ||
@@ -20,3 +18,3 @@ | ||
function JSXAttribute(node /*: Object*/) { | ||
function JSXAttribute(node) { | ||
this.print(node.name, node); | ||
@@ -29,7 +27,7 @@ if (node.value) { | ||
function JSXIdentifier(node /*: Object*/) { | ||
function JSXIdentifier(node) { | ||
this.push(node.name); | ||
} | ||
function JSXNamespacedName(node /*: Object*/) { | ||
function JSXNamespacedName(node) { | ||
this.print(node.namespace, node); | ||
@@ -40,3 +38,3 @@ this.push(":"); | ||
function JSXMemberExpression(node /*: Object*/) { | ||
function JSXMemberExpression(node) { | ||
this.print(node.object, node); | ||
@@ -47,3 +45,3 @@ this.push("."); | ||
function JSXSpreadAttribute(node /*: Object*/) { | ||
function JSXSpreadAttribute(node) { | ||
this.push("{..."); | ||
@@ -54,3 +52,3 @@ this.print(node.argument, node); | ||
function JSXExpressionContainer(node /*: Object*/) { | ||
function JSXExpressionContainer(node) { | ||
this.push("{"); | ||
@@ -61,7 +59,7 @@ this.print(node.expression, node); | ||
function JSXText(node /*: Object*/) { | ||
function JSXText(node) { | ||
this.push(node.value, true); | ||
} | ||
function JSXElement(node /*: Object*/) { | ||
function JSXElement(node) { | ||
var open = node.openingElement; | ||
@@ -72,3 +70,3 @@ this.print(open, node); | ||
this.indent(); | ||
for (var _iterator = (node.children /*: Array<Object>*/), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { | ||
for (var _iterator = node.children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { | ||
var _ref; | ||
@@ -94,3 +92,3 @@ | ||
function JSXOpeningElement(node /*: Object*/) { | ||
function JSXOpeningElement(node) { | ||
this.push("<"); | ||
@@ -105,3 +103,3 @@ this.print(node.name, node); | ||
function JSXClosingElement(node /*: Object*/) { | ||
function JSXClosingElement(node) { | ||
this.push("</"); | ||
@@ -108,0 +106,0 @@ this.print(node.name, node); |
@@ -1,3 +0,1 @@ | ||
/* @flow */ | ||
"use strict"; | ||
@@ -17,3 +15,3 @@ | ||
function _params(node /*: Object*/) { | ||
function _params(node) { | ||
// istanbul ignore next | ||
@@ -38,3 +36,3 @@ | ||
function _method(node /*: Object*/) { | ||
function _method(node) { | ||
var kind = node.kind; | ||
@@ -68,3 +66,3 @@ var key = node.key; | ||
function FunctionExpression(node /*: Object*/) { | ||
function FunctionExpression(node) { | ||
if (node.async) this.push("async "); | ||
@@ -88,3 +86,3 @@ this.push("function"); | ||
function ArrowFunctionExpression(node /*: Object*/) { | ||
function ArrowFunctionExpression(node) { | ||
if (node.async) this.push("async "); | ||
@@ -91,0 +89,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* @flow */ | ||
"use strict"; | ||
@@ -23,3 +21,3 @@ | ||
function ImportSpecifier(node /*: Object*/) { | ||
function ImportSpecifier(node) { | ||
this.print(node.imported, node); | ||
@@ -32,11 +30,11 @@ if (node.local && node.local.name !== node.imported.name) { | ||
function ImportDefaultSpecifier(node /*: Object*/) { | ||
function ImportDefaultSpecifier(node) { | ||
this.print(node.local, node); | ||
} | ||
function ExportDefaultSpecifier(node /*: Object*/) { | ||
function ExportDefaultSpecifier(node) { | ||
this.print(node.exported, node); | ||
} | ||
function ExportSpecifier(node /*: Object*/) { | ||
function ExportSpecifier(node) { | ||
this.print(node.local, node); | ||
@@ -49,3 +47,3 @@ if (node.exported && node.local.name !== node.exported.name) { | ||
function ExportNamespaceSpecifier(node /*: Object*/) { | ||
function ExportNamespaceSpecifier(node) { | ||
this.push("* as "); | ||
@@ -55,3 +53,3 @@ this.print(node.exported, node); | ||
function ExportAllDeclaration(node /*: Object*/) { | ||
function ExportAllDeclaration(node) { | ||
this.push("export *"); | ||
@@ -77,3 +75,3 @@ if (node.exported) { | ||
function ExportDeclaration(node /*: Object*/) { | ||
function ExportDeclaration(node) { | ||
if (node.declaration) { | ||
@@ -124,3 +122,3 @@ var declar = node.declaration; | ||
function ImportDeclaration(node /*: Object*/) { | ||
function ImportDeclaration(node) { | ||
this.push("import "); | ||
@@ -162,5 +160,5 @@ | ||
function ImportNamespaceSpecifier(node /*: Object*/) { | ||
function ImportNamespaceSpecifier(node) { | ||
this.push("* as "); | ||
this.print(node.local, node); | ||
} |
@@ -1,3 +0,1 @@ | ||
/* @noflow */ | ||
"use strict"; | ||
@@ -36,3 +34,3 @@ | ||
function WithStatement(node /*: Object*/) { | ||
function WithStatement(node) { | ||
this.keyword("with"); | ||
@@ -45,3 +43,3 @@ this.push("("); | ||
function IfStatement(node /*: Object*/) { | ||
function IfStatement(node) { | ||
this.keyword("if"); | ||
@@ -81,3 +79,3 @@ this.push("("); | ||
function ForStatement(node /*: Object*/) { | ||
function ForStatement(node) { | ||
this.keyword("for"); | ||
@@ -106,3 +104,3 @@ this.push("("); | ||
function WhileStatement(node /*: Object*/) { | ||
function WhileStatement(node) { | ||
this.keyword("while"); | ||
@@ -116,3 +114,3 @@ this.push("("); | ||
var buildForXStatement = function buildForXStatement(op) { | ||
return function (node /*: Object*/) { | ||
return function (node) { | ||
this.keyword("for"); | ||
@@ -134,3 +132,3 @@ this.push("("); | ||
function DoWhileStatement(node /*: Object*/) { | ||
function DoWhileStatement(node) { | ||
this.push("do "); | ||
@@ -148,3 +146,3 @@ this.print(node.body, node); | ||
return function (node /*: Object*/) { | ||
return function (node) { | ||
this.push(prefix); | ||
@@ -177,3 +175,3 @@ | ||
function LabeledStatement(node /*: Object*/) { | ||
function LabeledStatement(node) { | ||
this.print(node.label, node); | ||
@@ -184,3 +182,3 @@ this.push(": "); | ||
function TryStatement(node /*: Object*/) { | ||
function TryStatement(node) { | ||
this.keyword("try"); | ||
@@ -206,3 +204,3 @@ this.print(node.block, node); | ||
function CatchClause(node /*: Object*/) { | ||
function CatchClause(node) { | ||
this.keyword("catch"); | ||
@@ -216,3 +214,3 @@ this.push("("); | ||
function SwitchStatement(node /*: Object*/) { | ||
function SwitchStatement(node) { | ||
this.keyword("switch"); | ||
@@ -235,3 +233,3 @@ this.push("("); | ||
function SwitchCase(node /*: Object*/) { | ||
function SwitchCase(node) { | ||
if (node.test) { | ||
@@ -255,3 +253,3 @@ this.push("case "); | ||
function VariableDeclaration(node /*: Object*/, parent /*: Object*/) { | ||
function VariableDeclaration(node, parent) { | ||
this.push(node.kind + " "); | ||
@@ -262,3 +260,3 @@ | ||
if (!t.isFor(parent)) { | ||
for (var _iterator = (node.declarations /*: Array<Object>*/), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { | ||
for (var _iterator = node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _getIterator(_iterator);;) { | ||
var _ref; | ||
@@ -313,3 +311,3 @@ | ||
function VariableDeclarator(node /*: Object*/) { | ||
function VariableDeclarator(node) { | ||
this.print(node.id, node); | ||
@@ -316,0 +314,0 @@ this.print(node.id.typeAnnotation, node); |
@@ -1,3 +0,1 @@ | ||
/* @flow */ | ||
"use strict"; | ||
@@ -10,3 +8,3 @@ | ||
function TaggedTemplateExpression(node /*: Object*/) { | ||
function TaggedTemplateExpression(node) { | ||
this.print(node.tag, node); | ||
@@ -16,7 +14,7 @@ this.print(node.quasi, node); | ||
function TemplateElement(node /*: Object*/) { | ||
function TemplateElement(node) { | ||
this._push(node.value.raw); | ||
} | ||
function TemplateLiteral(node /*: Object*/) { | ||
function TemplateLiteral(node) { | ||
this.push("`"); | ||
@@ -23,0 +21,0 @@ |
@@ -1,2 +0,1 @@ | ||
/* @flow */ | ||
/* eslint max-len: 0 */ | ||
@@ -27,7 +26,7 @@ /* eslint quotes: 0 */ | ||
function Identifier(node /*: Object*/) { | ||
function Identifier(node) { | ||
this.push(node.name); | ||
} | ||
function RestElement(node /*: Object*/) { | ||
function RestElement(node) { | ||
this.push("..."); | ||
@@ -41,3 +40,3 @@ this.print(node.argument, node); | ||
function ObjectExpression(node /*: Object*/) { | ||
function ObjectExpression(node) { | ||
var props = node.properties; | ||
@@ -59,3 +58,3 @@ | ||
function ObjectMethod(node /*: Object*/) { | ||
function ObjectMethod(node) { | ||
this.printJoin(node.decorators, node, { separator: "" }); | ||
@@ -65,3 +64,3 @@ this._method(node); | ||
function ObjectProperty(node /*: Object*/) { | ||
function ObjectProperty(node) { | ||
this.printJoin(node.decorators, node, { separator: "" }); | ||
@@ -93,3 +92,3 @@ | ||
function ArrayExpression(node /*: Object*/) { | ||
function ArrayExpression(node) { | ||
var elems = node.elements; | ||
@@ -122,7 +121,7 @@ var len = elems.length; | ||
function RegExpLiteral(node /*: Object*/) { | ||
function RegExpLiteral(node) { | ||
this.push("/" + node.pattern + "/" + node.flags); | ||
} | ||
function BooleanLiteral(node /*: Object*/) { | ||
function BooleanLiteral(node) { | ||
this.push(node.value ? "true" : "false"); | ||
@@ -135,11 +134,11 @@ } | ||
function NumericLiteral(node /*: Object*/) { | ||
function NumericLiteral(node) { | ||
this.push(node.value + ""); | ||
} | ||
function StringLiteral(node /*: Object*/, parent /*: Object*/) { | ||
function StringLiteral(node, parent) { | ||
this.push(this._stringLiteral(node.value, parent)); | ||
} | ||
function _stringLiteral(val /*: string*/, parent /*: Object*/) /*: string*/ { | ||
function _stringLiteral(val, parent) { | ||
val = JSON.stringify(val); | ||
@@ -146,0 +145,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* @noflow */ | ||
"use strict"; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* @flow */ | ||
"use strict"; | ||
@@ -53,3 +51,3 @@ | ||
function NullableTypeAnnotation(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function NullableTypeAnnotation(node, parent) { | ||
return t.isArrayTypeAnnotation(parent); | ||
@@ -60,3 +58,3 @@ } | ||
function UpdateExpression(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function UpdateExpression(node, parent) { | ||
if (t.isMemberExpression(parent) && parent.object === node) { | ||
@@ -70,3 +68,3 @@ // (foo++).test() | ||
function ObjectExpression(node /*: Object*/, parent /*: Object*/, printStack /*: Array<Object>*/) /*: boolean*/ { | ||
function ObjectExpression(node, parent, printStack) { | ||
if (t.isExpressionStatement(parent)) { | ||
@@ -80,3 +78,3 @@ // ({ foo: "bar" }); | ||
function Binary(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function Binary(node, parent) { | ||
if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) { | ||
@@ -114,3 +112,3 @@ return true; | ||
function BinaryExpression(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function BinaryExpression(node, parent) { | ||
if (node.operator === "in") { | ||
@@ -131,3 +129,3 @@ // let i = (1 in []); | ||
function SequenceExpression(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function SequenceExpression(node, parent) { | ||
if (t.isForStatement(parent)) { | ||
@@ -174,3 +172,3 @@ // Although parentheses wouldn"t hurt around sequence | ||
function YieldExpression(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function YieldExpression(node, parent) { | ||
return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent); | ||
@@ -181,3 +179,3 @@ } | ||
function ClassExpression(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function ClassExpression(node, parent) { | ||
// (class {}); | ||
@@ -196,3 +194,3 @@ if (t.isExpressionStatement(parent)) { | ||
function UnaryLike(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function UnaryLike(node, parent) { | ||
if (t.isMemberExpression(parent, { object: node })) { | ||
@@ -209,3 +207,3 @@ return true; | ||
function FunctionExpression(node /*: Object*/, parent /*: Object*/, printStack /*: Array<Object>*/) /*: boolean*/ { | ||
function FunctionExpression(node, parent, printStack) { | ||
// (function () {}); | ||
@@ -224,3 +222,3 @@ if (t.isExpressionStatement(parent)) { | ||
function ArrowFunctionExpression(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function ArrowFunctionExpression(node, parent) { | ||
// export default (function () {}); | ||
@@ -235,6 +233,10 @@ if (t.isExportDeclaration(parent)) { | ||
if (t.isUnaryExpression(parent)) { | ||
return true; | ||
} | ||
return UnaryLike(node, parent); | ||
} | ||
function ConditionalExpression(node /*: Object*/, parent /*: Object*/) /*: boolean*/ { | ||
function ConditionalExpression(node, parent) { | ||
if (t.isUnaryLike(parent)) { | ||
@@ -255,3 +257,3 @@ return true; | ||
function AssignmentExpression(node /*: Object*/) /*: boolean*/ { | ||
function AssignmentExpression(node) { | ||
if (t.isObjectPattern(node.left)) { | ||
@@ -266,4 +268,4 @@ return true; | ||
// in statement. | ||
function isFirstInStatement(printStack /*: Array<Object>*/) /*: boolean*/ { | ||
var considerArrow /*: bool*/ = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; | ||
function isFirstInStatement(printStack) { | ||
var considerArrow = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; | ||
@@ -270,0 +272,0 @@ var i = printStack.length - 1; |
@@ -1,3 +0,1 @@ | ||
/* @noflow */ | ||
"use strict"; | ||
@@ -33,6 +31,3 @@ | ||
/*:: type WhitespaceObject = { | ||
before?: boolean, | ||
after?: boolean | ||
};*/function crawl(node) { | ||
function crawl(node) { | ||
var state = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
@@ -90,3 +85,3 @@ | ||
AssignmentExpression: function AssignmentExpression(node /*: Object*/) /*: ?WhitespaceObject*/ { | ||
AssignmentExpression: function AssignmentExpression(node) { | ||
var state = crawl(node.right); | ||
@@ -105,3 +100,3 @@ if (state.hasCall && state.hasHelper || state.hasFunction) { | ||
SwitchCase: function SwitchCase(node /*: Object*/, parent /*: Object*/) /*: ?WhitespaceObject*/ { | ||
SwitchCase: function SwitchCase(node, parent) { | ||
return { | ||
@@ -116,3 +111,3 @@ before: node.consequent.length || parent.cases[0] === node | ||
LogicalExpression: function LogicalExpression(node /*: Object*/) /*: ?WhitespaceObject*/ { | ||
LogicalExpression: function LogicalExpression(node) { | ||
if (t.isFunction(node.left) || t.isFunction(node.right)) { | ||
@@ -129,3 +124,3 @@ return { | ||
Literal: function Literal(node /*: Object*/) /*: ?WhitespaceObject*/ { | ||
Literal: function Literal(node) { | ||
if (node.value === "use strict") { | ||
@@ -142,3 +137,3 @@ return { | ||
CallExpression: function CallExpression(node /*: Object*/) /*: ?WhitespaceObject*/ { | ||
CallExpression: function CallExpression(node) { | ||
if (t.isFunction(node.callee) || isHelper(node)) { | ||
@@ -156,3 +151,3 @@ return { | ||
VariableDeclaration: function VariableDeclaration(node /*: Object*/) /*: ?WhitespaceObject*/ { | ||
VariableDeclaration: function VariableDeclaration(node) { | ||
for (var i = 0; i < node.declarations.length; i++) { | ||
@@ -180,3 +175,3 @@ var declar = node.declarations[i]; | ||
IfStatement: function IfStatement(node /*: Object*/) /*: ?WhitespaceObject*/ { | ||
IfStatement: function IfStatement(node) { | ||
if (t.isBlockStatement(node.consequent)) { | ||
@@ -195,3 +190,3 @@ return { | ||
exports.nodes.ObjectProperty = exports.nodes.ObjectMethod = exports.nodes.SpreadProperty = function (node /*: Object*/, parent) /*: ?WhitespaceObject*/ { | ||
exports.nodes.ObjectProperty = exports.nodes.ObjectMethod = exports.nodes.SpreadProperty = function (node, parent) { | ||
if (parent.properties[0] === node) { | ||
@@ -214,3 +209,3 @@ return { | ||
VariableDeclaration: function VariableDeclaration(node /*: Object*/) /*: Array<Object>*/ { | ||
VariableDeclaration: function VariableDeclaration(node) { | ||
return _lodashCollectionMap2["default"](node.declarations, "init"); | ||
@@ -223,3 +218,3 @@ }, | ||
ArrayExpression: function ArrayExpression(node /*: Object*/) /*: Array<Object>*/ { | ||
ArrayExpression: function ArrayExpression(node) { | ||
return node.elements; | ||
@@ -232,3 +227,3 @@ }, | ||
ObjectExpression: function ObjectExpression(node /*: Object*/) /*: Array<Object>*/ { | ||
ObjectExpression: function ObjectExpression(node) { | ||
return node.properties; | ||
@@ -235,0 +230,0 @@ } |
@@ -1,2 +0,1 @@ | ||
/* @flow */ | ||
@@ -25,3 +24,3 @@ /** | ||
Position.prototype.push = function push(str /*: string*/) /*: void*/ { | ||
Position.prototype.push = function push(str) { | ||
for (var i = 0; i < str.length; i++) { | ||
@@ -41,3 +40,3 @@ if (str[i] === "\n") { | ||
Position.prototype.unshift = function unshift(str /*: string*/) /*: void*/ { | ||
Position.prototype.unshift = function unshift(str) { | ||
for (var i = 0; i < str.length; i++) { | ||
@@ -44,0 +43,0 @@ if (str[i] === "\n") { |
{ | ||
"name": "babel-generator", | ||
"version": "6.5.2-canary.ab7533ed", | ||
"version": "6.6.0", | ||
"description": "Turns an AST into code.", | ||
@@ -14,5 +14,5 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"dependencies": { | ||
"babel-messages": "^6.3.18", | ||
"babel-messages": "^6.6.0", | ||
"babel-runtime": "^5.0.0", | ||
"babel-types": "^6.4.5", | ||
"babel-types": "^6.6.0", | ||
"detect-indent": "^3.0.1", | ||
@@ -27,4 +27,4 @@ "is-integer": "^1.0.4", | ||
"babel-helper-fixtures": "^6.3.13", | ||
"babylon": "^6.4.5" | ||
"babylon": "^6.6.0" | ||
} | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
86327
2642
Updatedbabel-messages@^6.6.0
Updatedbabel-types@^6.6.0