Bug 975484 - Reflect.parse location information is inaccurate for CallExpressions. r=luke.

This commit is contained in:
Jason Orendorff 2014-02-26 08:55:35 -06:00
parent 725edb2c81
commit 84b29bf104
2 changed files with 11 additions and 1 deletions

View File

@ -6429,8 +6429,10 @@ template <typename ParseHandler>
bool
Parser<ParseHandler>::argumentList(Node listNode, bool *isSpread)
{
if (tokenStream.matchToken(TOK_RP, TokenStream::Operand))
if (tokenStream.matchToken(TOK_RP, TokenStream::Operand)) {
handler.setEndPosition(listNode, pos().end);
return true;
}
uint32_t startYieldOffset = pc->lastYieldOffset;
bool arg0 = true;
@ -6483,6 +6485,7 @@ Parser<ParseHandler>::argumentList(Node listNode, bool *isSpread)
report(ParseError, false, null(), JSMSG_PAREN_AFTER_ARGS);
return false;
}
handler.setEndPosition(listNode, pos().end);
return true;
}

View File

@ -0,0 +1,7 @@
var loc = Reflect.parse("f()").body[0].expression.loc;
assertEq(loc.start.column, 0);
assertEq(loc.end.column, 3);
loc = Reflect.parse("f(x)").body[0].expression.loc;
assertEq(loc.start.column, 0);
assertEq(loc.end.column, 4);