Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2232633002: Function name variable does not need a VariableDeclaration (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 parser.Parse(&info); 1488 parser.Parse(&info);
1489 function = info.literal(); 1489 function = info.literal();
1490 CHECK_NOT_NULL(function); 1490 CHECK_NOT_NULL(function);
1491 CHECK_NOT_NULL(function->body()); 1491 CHECK_NOT_NULL(function->body());
1492 CHECK_EQ(1, function->body()->length()); 1492 CHECK_EQ(1, function->body()->length());
1493 i::FunctionLiteral* inner = 1493 i::FunctionLiteral* inner =
1494 function->body()->first()->AsExpressionStatement()->expression()-> 1494 function->body()->first()->AsExpressionStatement()->expression()->
1495 AsCall()->expression()->AsFunctionLiteral(); 1495 AsCall()->expression()->AsFunctionLiteral();
1496 i::Scope* inner_scope = inner->scope(); 1496 i::Scope* inner_scope = inner->scope();
1497 i::FunctionLiteral* fun = nullptr; 1497 i::FunctionLiteral* fun = nullptr;
1498 if (inner_scope->declarations()->length() > 1) { 1498 if (inner_scope->declarations()->length() > 0) {
1499 fun = inner_scope->declarations()->at(1)->AsFunctionDeclaration()->fun(); 1499 fun = inner_scope->declarations()->at(0)->AsFunctionDeclaration()->fun();
1500 } else { 1500 } else {
1501 // TODO(conradw): This path won't be hit until the other test cases can be 1501 // TODO(conradw): This path won't be hit until the other test cases can be
1502 // uncommented. 1502 // uncommented.
1503 UNREACHABLE(); 1503 UNREACHABLE();
1504 CHECK_NOT_NULL(inner->body()); 1504 CHECK_NOT_NULL(inner->body());
1505 CHECK_GE(2, inner->body()->length()); 1505 CHECK_GE(2, inner->body()->length());
1506 i::Expression* exp = inner->body()->at(1)->AsExpressionStatement()-> 1506 i::Expression* exp = inner->body()->at(1)->AsExpressionStatement()->
1507 expression()->AsBinaryOperation()->right(); 1507 expression()->AsBinaryOperation()->right();
1508 if (exp->IsFunctionLiteral()) { 1508 if (exp->IsFunctionLiteral()) {
1509 fun = exp->AsFunctionLiteral(); 1509 fun = exp->AsFunctionLiteral();
(...skipping 6631 matching lines...) Expand 10 before | Expand all | Expand 10 after
8141 "(a,);", 8141 "(a,);",
8142 "(a,b,c,);", 8142 "(a,b,c,);",
8143 NULL 8143 NULL
8144 }; 8144 };
8145 // clang-format on 8145 // clang-format on
8146 8146
8147 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; 8147 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas};
8148 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 8148 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
8149 arraysize(always_flags)); 8149 arraysize(always_flags));
8150 } 8150 }
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698