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

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

Issue 1149043005: [destructuring] Grand for statement parsing unification. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase feedback Created 5 years, 7 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/pattern-rewriter.cc ('k') | test/mjsunit/es6/debug-stepnext-for.js » ('j') | 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 6507 matching lines...) Expand 10 before | Expand all | Expand 10 after
6518 "[yield]", 6518 "[yield]",
6519 "{ x : yield }", 6519 "{ x : yield }",
6520 NULL}; 6520 NULL};
6521 // clang-format on 6521 // clang-format on
6522 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 6522 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
6523 arraysize(always_flags)); 6523 arraysize(always_flags));
6524 } 6524 }
6525 } 6525 }
6526 6526
6527 6527
6528 TEST(DestructuringDisallowPatternsInForVarIn) {
6529 i::FLAG_harmony_destructuring = true;
6530 static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
6531 const char* context_data[][2] = {
6532 {"", ""}, {"function f() {", "}"}, {NULL, NULL}};
6533 // clang-format off
6534 const char* error_data[] = {
6535 "for (var {x} = {} in null);",
6536 "for (var {x} = {} of null);",
6537 "for (let x = {} in null);",
6538 "for (let x = {} of null);",
6539 NULL};
6540 // clang-format on
6541 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags,
6542 arraysize(always_flags));
6543
6544 // clang-format off
6545 const char* success_data[] = {
6546 "for (var x = {} in null);",
6547 NULL};
6548 // clang-format on
6549 RunParserSyncTest(context_data, success_data, kSuccess, NULL, 0, always_flags,
6550 arraysize(always_flags));
6551 }
6552
6553
6528 TEST(SpreadArray) { 6554 TEST(SpreadArray) {
6529 i::FLAG_harmony_spread_arrays = true; 6555 i::FLAG_harmony_spread_arrays = true;
6530 6556
6531 const char* context_data[][2] = { 6557 const char* context_data[][2] = {
6532 {"'use strict';", ""}, {"", ""}, {NULL, NULL}}; 6558 {"'use strict';", ""}, {"", ""}, {NULL, NULL}};
6533 6559
6534 // clang-format off 6560 // clang-format off
6535 const char* data[] = { 6561 const char* data[] = {
6536 "[...a]", 6562 "[...a]",
6537 "[a, ...b]", 6563 "[a, ...b]",
(...skipping 25 matching lines...) Expand all
6563 "[a, ...]", 6589 "[a, ...]",
6564 "[..., ]", 6590 "[..., ]",
6565 "[..., ...]", 6591 "[..., ...]",
6566 "[ (...a)]", 6592 "[ (...a)]",
6567 NULL}; 6593 NULL};
6568 // clang-format on 6594 // clang-format on
6569 static const ParserFlag always_flags[] = {kAllowHarmonySpreadArrays}; 6595 static const ParserFlag always_flags[] = {kAllowHarmonySpreadArrays};
6570 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 6596 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
6571 arraysize(always_flags)); 6597 arraysize(always_flags));
6572 } 6598 }
OLDNEW
« no previous file with comments | « src/pattern-rewriter.cc ('k') | test/mjsunit/es6/debug-stepnext-for.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698