Source/JavaScriptCore:
 [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function.
 https://bugs.webkit.org/show_bug.cgi?id=144955

 Reviewed by Yusuke Suzuki.

 Added support of ES6 arrow function. Changes were made according to following spec http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax. Patch does not include any arrow function specific behavior e.g. lexical bind this, arguments and etc.
This patch implements the simplest cases of arrow function declaration:
   parameters             () => 10 + 20
   parameter               x => x + 20
   parameters         (x, y) => x + y
   function with block     x => { return x*10; }

Not implemented:
   bind of the this, arguments, super and etc.
   exception in case of trying to use 'new' with arrow function

Patch by Aleksandr Skachkov <gskachkov@gmail.com> on 2015-06-26

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createFunctionExpr):
(JSC::ASTBuilder::createArrowFunctionExpr):
(JSC::ASTBuilder::createGetterOrSetterProperty):
(JSC::ASTBuilder::createFuncDeclStatement):
* parser/Lexer.cpp:
(JSC::Lexer<T>::setTokenPosition):
(JSC::Lexer<T>::lex):
* parser/Lexer.h:
(JSC::Lexer::lastTokenLocation):
(JSC::Lexer::setTerminator):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::parseSourceElements):
(JSC::Parser<LexerType>::parseArrowFunctionSingleExpressionBody):
(JSC::Parser<LexerType>::parseSwitchClauses):
(JSC::Parser<LexerType>::parseSwitchDefaultClause):
(JSC::Parser<LexerType>::parseBlockStatement):
(JSC::Parser<LexerType>::parseFunctionBody):
(JSC::stringForFunctionMode):
(JSC::Parser<LexerType>::parseFunctionParameters):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseFunctionDeclaration):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parsePropertyMethod):
(JSC::Parser<LexerType>::parseGetterSetter):
(JSC::Parser<LexerType>::parseArrowFunctionExpression):
* parser/Parser.h:
(JSC::Parser::locationBeforeLastToken):
(JSC::Parser::isEndOfArrowFunction):
(JSC::Parser::isArrowFunctionParamters):
(JSC::Parser::setEndOfStatement):
* parser/ParserFunctionInfo.h:
* parser/ParserTokens.h:
* parser/SourceCode.h:
(JSC::SourceCode::subArrowExpression):
* parser/SourceProviderCacheItem.h:
(JSC::SourceProviderCacheItem::endFunctionToken):
(JSC::SourceProviderCacheItem::SourceProviderCacheItem):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createArrowFunctionExpr):
(JSC::SyntaxChecker::setFunctionNameStart):

LayoutTests:
 [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function
 https://bugs.webkit.org/show_bug.cgi?id=144955

 Reviewed by Yusuke Suzuki.

 Added arrow function tests

Patch by Aleksandr Skachkov <gskachkov@gmail.com> on 2015-06-26

* js/arrowfunction-asparamter-1-expected.txt: Added.
* js/arrowfunction-asparamter-1.html: Added.
* js/arrowfunction-asparamter-2-expected.txt: Added.
* js/arrowfunction-asparamter-2.html: Added.
* js/arrowfunction-associativity-1-expected.txt: Added.
* js/arrowfunction-associativity-1.html: Added.
* js/arrowfunction-associativity-2-expected.txt: Added.
* js/arrowfunction-associativity-2.html: Added.
* js/arrowfunction-block-1-expected.txt: Added.
* js/arrowfunction-block-1.html: Added.
* js/arrowfunction-block-2-expected.txt: Added.
* js/arrowfunction-block-2.html: Added.
* js/arrowfunction-syntax-endings-expected.txt: Added.
* js/arrowfunction-syntax-endings.html: Added.
* js/arrowfunction-syntax-errors-expected.txt: Added.
* js/arrowfunction-syntax-errors.html: Added.
* js/arrowfunction-syntax-expected.txt: Added.
* js/arrowfunction-syntax.html: Added.
* js/script-tests/arrowfunction-asparamter-1.js: Added.
* js/script-tests/arrowfunction-asparamter-2.js: Added.
* js/script-tests/arrowfunction-associativity-1.js: Added.
* js/script-tests/arrowfunction-associativity-2.js: Added.
* js/script-tests/arrowfunction-block-1.js: Added.
* js/script-tests/arrowfunction-block-2.js: Added.
* js/script-tests/arrowfunction-syntax-endings.js: Added.
* js/script-tests/arrowfunction-syntax-errors.js: Added.
* js/script-tests/arrowfunction-syntax.js: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@185989 268f45cc-cd09-0410-ab3c-d52691b4dbfc
39 files changed