Changeset 195389 in webkit
- Timestamp:
- Jan 20, 2016, 3:38:08 PM (11 years ago)
- Location:
- tags/Safari-602.1.17
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/js/arrowfunction-syntax-errors-expected.txt (modified) (1 diff)
-
LayoutTests/js/arrowfunction-syntax-expected.txt (modified) (1 diff)
-
LayoutTests/js/script-tests/arrowfunction-syntax-errors.js (modified) (1 diff)
-
LayoutTests/js/script-tests/arrowfunction-syntax.js (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/parser/Parser.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/parser/Parser.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/Safari-602.1.17/LayoutTests/ChangeLog
r195336 r195389 1 2016-01-20 Babak Shafiei <bshafiei@apple.com> 2 3 Roll out r195178. 4 1 5 2016-01-19 Chris Dumez <cdumez@apple.com> 2 6 -
tags/Safari-602.1.17/LayoutTests/js/arrowfunction-syntax-errors-expected.txt
r195178 r195389 124 124 PASS var af3=(x, y) 125 125 =>y+1 threw exception SyntaxError: Unexpected token '=>'. 126 PASS ([a, b] => a + b)(["a_", "b_"]) threw exception SyntaxError: Unexpected token '=>'. Expected ')' to end a compound expression..127 PASS ({a, b} => a + b)({a:"a_", b:"b_"}) threw exception SyntaxError: Unexpected token '=>'. Expected ')' to end a compound expression..128 PASS ({c:a,d:b} => a + b)({c:"a_", d:"b_"}) threw exception SyntaxError: Unexpected token '=>'. Expected ')' to end a compound expression..129 PASS ({c:b,d:a} => a + b)({c:"a_", d:"b_"}) threw exception SyntaxError: Unexpected token '=>'. Expected ')' to end a compound expression..130 PASS var arr1 = [a, b] => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..131 PASS var arr2 = {a, b} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..132 PASS var arr3 = {c:a,d:b} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..133 PASS var arr3 = {c:b,d:a} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..134 126 PASS successfullyParsed is true 135 127 -
tags/Safari-602.1.17/LayoutTests/js/arrowfunction-syntax-expected.txt
r195178 r195389 41 41 PASS (function funcSelfExecAE3(value) { var f = (x) => { x++; return x + 1; }; return f(value);})(123); is 125 42 42 PASS (function funcSelfExecAE4(value) { var f = (x, y) => { x++; return x + y; }; return f(value, value * 2);})(123); is 370 43 PASS (([a, b]) => a + b)(["a_", "b_"]) is "a_b_"44 PASS (({a, b}) => a + b)({a:"a_", b:"b_"}) is "a_b_"45 PASS (({c:a, d:b}) => a + b)({c:"a_", d:"b_"}) is "a_b_"46 PASS (({c:b, d:a}) => a + b)({c:"a_", d:"b_"}) is "b_a_"47 PASS ((x, y, {c:b, d:a}) => x + y + a + b)("x_", "y_", {c:"a_", d:"b_"}) is "x_y_b_a_"48 PASS (({c:b, d:a}, x, y) => x + y + a + b)({c:"a_", d:"b_"}, "x_", "y_") is "x_y_b_a_"49 PASS ((x, y, {c:b, d:a}, [e, f]) => x + y + a + b + e + f)("x_", "y_", {c:"a_", d:"b_"}, ["e_", "f_"]) is "x_y_b_a_e_f_"50 PASS ((x, y, {c:b, d:a}, [e, f], ...theArgs) => x + y + a + b + e + f + theArgs[0] + theArgs[1])("x_", "y_", {c:"a_", d:"b_"}, ["e_", "f_"], "g_", "h_") is "x_y_b_a_e_f_g_h_"51 PASS arr1(["a_", "b_"]) is "a_b_"52 PASS arr2({a:"a_", b:"b_"}) is "a_b_"53 PASS arr3({c:"a_", d:"b_"}) is "a_b_"54 PASS arr4({c:"a_", d:"b_"}) is "b_a_"55 PASS arr5("x_", "y_", {c:"a_", d:"b_"}) is "x_y_b_a_"56 PASS arr6({c:"a_", d:"b_"}, "x_", "y_") is "x_y_b_a_"57 PASS arr7("x_", "y_", {c:"a_", d:"b_"}, ["e_", "f_"]) is "x_y_b_a_e_f_"58 PASS arr8("x_", "y_", {c:"a_", d:"b_"}, ["e_", "f_"], "g_", "h_") is "x_y_b_a_e_f_g_h_"59 43 PASS successfullyParsed is true 60 44 -
tags/Safari-602.1.17/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js
r195178 r195389 39 39 shouldThrow("var af3=(x, y)\n=>y+1"); 40 40 41 shouldThrow('([a, b] => a + b)(["a_", "b_"])' );42 shouldThrow('({a, b} => a + b)({a:"a_", b:"b_"})');43 shouldThrow('({c:a,d:b} => a + b)({c:"a_", d:"b_"})');44 shouldThrow('({c:b,d:a} => a + b)({c:"a_", d:"b_"})');45 46 shouldThrow('var arr1 = [a, b] => a + b;');47 shouldThrow('var arr2 = {a, b} => a + b;');48 shouldThrow('var arr3 = {c:a,d:b} => a + b;');49 shouldThrow('var arr3 = {c:b,d:a} => a + b;');50 51 41 var successfullyParsed = true; -
tags/Safari-602.1.17/LayoutTests/js/script-tests/arrowfunction-syntax.js
r195178 r195389 80 80 shouldBe('(function funcSelfExecAE4(value) { var f = (x, y) => { x++; return x + y; }; return f(value, value * 2);})(123);', '370'); 81 81 82 shouldBe('(([a, b]) => a + b)(["a_", "b_"])', '"a_b_"');83 shouldBe('(({a, b}) => a + b)({a:"a_", b:"b_"})', '"a_b_"');84 shouldBe('(({c:a, d:b}) => a + b)({c:"a_", d:"b_"})', '"a_b_"');85 shouldBe('(({c:b, d:a}) => a + b)({c:"a_", d:"b_"})', '"b_a_"');86 shouldBe('((x, y, {c:b, d:a}) => x + y + a + b)("x_", "y_", {c:"a_", d:"b_"})', '"x_y_b_a_"');87 shouldBe('(({c:b, d:a}, x, y) => x + y + a + b)({c:"a_", d:"b_"}, "x_", "y_")', '"x_y_b_a_"');88 shouldBe('((x, y, {c:b, d:a}, [e, f]) => x + y + a + b + e + f)("x_", "y_", {c:"a_", d:"b_"}, ["e_", "f_"])', '"x_y_b_a_e_f_"');89 shouldBe('((x, y, {c:b, d:a}, [e, f], ...theArgs) => x + y + a + b + e + f + theArgs[0] + theArgs[1])("x_", "y_", {c:"a_", d:"b_"}, ["e_", "f_"], "g_", "h_")', '"x_y_b_a_e_f_g_h_"');90 91 var arr1 = ([a, b]) => a + b;92 shouldBe('arr1(["a_", "b_"])', '"a_b_"');93 94 var arr2 = ({a, b}) => a + b;95 shouldBe('arr2({a:"a_", b:"b_"})', '"a_b_"');96 97 var arr3 = ({c:a, d:b}) => a + b;98 shouldBe('arr3({c:"a_", d:"b_"})', '"a_b_"');99 100 var arr4 = ({c:b, d:a}) => a + b;101 shouldBe('arr4({c:"a_", d:"b_"})', '"b_a_"');102 103 var arr5 = (x, y, {c:b, d:a}) => x + y + a + b;104 shouldBe('arr5("x_", "y_", {c:"a_", d:"b_"})', '"x_y_b_a_"');105 106 var arr6 = ({c:b, d:a}, x, y) => x + y + a + b;107 shouldBe('arr6({c:"a_", d:"b_"}, "x_", "y_")', '"x_y_b_a_"');108 109 var arr7 = (x, y, {c:b, d:a}, [e, f]) => x + y + a + b + e + f;110 shouldBe('arr7("x_", "y_", {c:"a_", d:"b_"}, ["e_", "f_"])', '"x_y_b_a_e_f_"');111 112 var arr8 = (x, y, {c:b, d:a}, [e, f], ...theArgs) => x + y + a + b + e + f + theArgs[0] + theArgs[1];113 shouldBe('arr8("x_", "y_", {c:"a_", d:"b_"}, ["e_", "f_"], "g_", "h_")', '"x_y_b_a_e_f_g_h_"');114 115 82 var successfullyParsed = true; -
tags/Safari-602.1.17/Source/JavaScriptCore/ChangeLog
r195330 r195389 1 2016-01-20 Babak Shafiei <bshafiei@apple.com> 2 3 Roll out r195178. 4 1 5 2016-01-19 Andy VanWagoner <thetalecrafter@gmail.com> 2 6 -
tags/Safari-602.1.17/Source/JavaScriptCore/parser/Parser.cpp
r195178 r195389 372 372 m_features = features; 373 373 m_numConstants = numConstants; 374 }375 376 template <typename LexerType>377 bool Parser<LexerType>::isArrowFunctionParameters()378 {379 bool isArrowFunction = false;380 381 if (match(EOFTOK))382 return false;383 384 bool isOpenParen = match(OPENPAREN);385 bool isIdent = match(IDENT);386 387 if (!isOpenParen && !isIdent)388 return false;389 390 SavePoint saveArrowFunctionPoint = createSavePoint();391 392 if (isIdent) {393 next();394 isArrowFunction = match(ARROWFUNCTION);395 } else {396 RELEASE_ASSERT(isOpenParen);397 next();398 if (match(CLOSEPAREN)) {399 next();400 isArrowFunction = match(ARROWFUNCTION);401 } else {402 SyntaxChecker syntaxChecker(const_cast<VM*>(m_vm), m_lexer.get());403 // We make fake scope, otherwise parseFormalParameters will add variable to current scope that lead to errors404 AutoPopScopeRef fakeScope(this, pushScope());405 fakeScope->setSourceParseMode(SourceParseMode::ArrowFunctionMode);406 407 unsigned parametersCount = 0;408 isArrowFunction = parseFormalParameters(syntaxChecker, syntaxChecker.createFormalParameterList(), parametersCount) && consume(CLOSEPAREN) && match(ARROWFUNCTION);409 410 popScope(fakeScope, syntaxChecker.NeedsFreeVariableInfo);411 }412 }413 414 restoreSavePoint(saveArrowFunctionPoint);415 416 return isArrowFunction;417 374 } 418 375 … … 2931 2888 2932 2889 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX) 2933 if (isArrowFunctionParam eters())2890 if (isArrowFunctionParamters()) 2934 2891 return parseArrowFunctionExpression(context); 2935 2892 #endif -
tags/Safari-602.1.17/Source/JavaScriptCore/parser/Parser.h
r195178 r195389 1028 1028 return match(SEMICOLON) || match(COMMA) || match(CLOSEPAREN) || match(CLOSEBRACE) || match(CLOSEBRACKET) || match(EOFTOK) || m_lexer->prevTerminator(); 1029 1029 } 1030 1030 1031 ALWAYS_INLINE bool isArrowFunctionParamters() 1032 { 1033 bool isArrowFunction = false; 1034 1035 if (match(EOFTOK)) 1036 return isArrowFunction; 1037 1038 SavePoint saveArrowFunctionPoint = createSavePoint(); 1039 1040 if (consume(OPENPAREN)) { 1041 bool isArrowFunctionParamters = true; 1042 1043 while (consume(IDENT)) { 1044 if (consume(COMMA)) { 1045 if (!match(IDENT)) { 1046 isArrowFunctionParamters = false; 1047 break; 1048 } 1049 } else 1050 break; 1051 } 1052 1053 if (isArrowFunctionParamters) { 1054 if (consume(CLOSEPAREN) && match(ARROWFUNCTION)) 1055 isArrowFunction = true; 1056 } 1057 } else if (consume(IDENT) && match(ARROWFUNCTION)) 1058 isArrowFunction = true; 1059 1060 restoreSavePoint(saveArrowFunctionPoint); 1061 1062 return isArrowFunction; 1063 } 1064 1031 1065 ALWAYS_INLINE unsigned tokenStart() 1032 1066 { … … 1225 1259 template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, SourceParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&, FunctionDefinitionType); 1226 1260 1227 ALWAYS_INLINE bool isArrowFunctionParameters();1228 1229 1261 template <class TreeBuilder> NEVER_INLINE int parseFunctionParameters(TreeBuilder&, SourceParseMode, ParserFunctionInfo<TreeBuilder>&); 1230 1262 template <class TreeBuilder> NEVER_INLINE typename TreeBuilder::FormalParameterList createGeneratorParameters(TreeBuilder&);
Note:
See TracChangeset
for help on using the changeset viewer.