v8/test
marja@chromium.org e5991fc373 Implement handling of arrow functions in the parser
Arrow functions are parsed from ParseAssignmentExpression(). Handling the
parameter list is done by letting ParseConditionalExpression() parse a comma
separated list of identifiers, and it returns a tree of BinaryOperation nodes
with VariableProxy leaves, or a single VariableProxy if there is only one
parameter. When the arrow token "=>" is found, the VariableProxy nodes are
passed to ParseArrowFunctionLiteral(), which will then skip parsing the
paramaeter list. This avoids having to rewind when the arrow is found and
restart parsing the parameter list.

Note that the empty parameter list "()" is handled directly in
ParsePrimaryExpression(): after is has consumed the opening parenthesis,
if a closing parenthesis follows, then the only valid input is an arrow
function. In this case, ParsePrimaryExpression() directly calls
ParseArrowFunctionLiteral(), to avoid needing to return a sentinel value
to signal the empty parameter list. Because it will consume the body of
the arrow function, ParseAssignmentExpression() will not see the arrow
"=>" token as next, and return the already-parser expression.

The implementation is done in ParserBase, so it was needed to do some
additions to ParserBase, ParserTraits and PreParserTraits. Some of the
glue code can be removed later on when more more functionality is moved
to ParserBase.

Additionally, this adds a runtime flag "harmony_arrow_functions"
(disabled by default); enabling "harmony" will enable it as well.

BUG=v8:2700
LOG=N
R=marja@chromium.org

Review URL: https://codereview.chromium.org/385553003

Patch from Adrián Pérez de Castro <aperez@igalia.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22320 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-07-10 12:27:07 +00:00
..
benchmarks Merge experimental/a64 to bleeding_edge. 2014-02-12 09:19:30 +00:00
cctest Implement handling of arrow functions in the parser 2014-07-10 12:27:07 +00:00
fuzz-natives Make fuzz-natives test generator more robust. 2014-07-09 11:39:22 +00:00
intl Store i18n meta data in hidden symbols instead of js accessible properties 2014-04-01 10:56:16 +00:00
message Clean up some A64 specific code in common code that was introduced by A64 merge 2014-02-12 13:27:13 +00:00
mjsunit Drop deprecated --es5-readonly flag from test suite. 2014-07-09 14:37:58 +00:00
mozilla Add mips64 port. 2014-07-09 11:08:26 +00:00
preparser Throw syntax error when a getter/setter has the wrong number of params 2014-06-17 07:23:26 +00:00
promises-aplus Stop using urllib.urlretrieve() directly. 2014-05-21 09:25:05 +00:00
test262 Add mips64 port. 2014-07-09 11:08:26 +00:00
webkit Throw syntax error when a getter/setter has the wrong number of params 2014-06-17 07:23:26 +00:00