Ensure that the arrow nodes have a location before using them. (#9003)

This commit is contained in:
Logan Smyth
2018-11-12 17:10:49 -08:00
committed by GitHub
parent 4fcee1751a
commit cbbb3c7962

View File

@@ -113,10 +113,12 @@ export function ArrowFunctionExpression(node: Object) {
) {
if (
this.format.retainLines &&
node.loc &&
node.body.loc &&
node.loc.start.line < node.body.loc.start.line
) {
this.token("(");
if (firstParam.loc.start.line > node.loc.start.line) {
if (firstParam.loc && firstParam.loc.start.line > node.loc.start.line) {
this.indent();
this.print(firstParam, node);
this.dedent();