diff options
Diffstat (limited to 'lib/utils.js')
-rw-r--r-- | lib/utils.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/utils.js b/lib/utils.js index 2a0df8c5..286266a2 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -238,13 +238,15 @@ function HOP(obj, prop) { // return true if the node at the top of the stack (that means the // innermost node in the current output) is lexically the first in // a statement. -function first_in_statement(stack) { +function first_in_statement(stack, arrow) { var node = stack.parent(-1); for (var i = 0, p; p = stack.parent(i++); node = p) { - if (p.TYPE == "Call") { - if (p.expression === node) continue; + if (p instanceof AST_Arrow) { + return arrow && p.value === node; } else if (p instanceof AST_Binary) { if (p.left === node) continue; + } else if (p.TYPE == "Call") { + if (p.expression === node) continue; } else if (p instanceof AST_Conditional) { if (p.condition === node) continue; } else if (p instanceof AST_PropAccess) { |