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

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

Issue 1002253002: [strong] Check super constructor calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Should be ReferenceError Created 5 years, 9 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/preparser.cc ('k') | test/mjsunit/strong/classes.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 5530 matching lines...) Expand 10 before | Expand all | Expand 10 after
5541 }; 5541 };
5542 RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags, 5542 RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags,
5543 arraysize(always_flags)); 5543 arraysize(always_flags));
5544 RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags, 5544 RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags,
5545 arraysize(always_flags)); 5545 arraysize(always_flags));
5546 RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags, 5546 RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags,
5547 arraysize(always_flags)); 5547 arraysize(always_flags));
5548 } 5548 }
5549 5549
5550 5550
5551 TEST(StrongSuperCalls) {
5552 const char* sloppy_context_data[][2] = {{"", ""}, {NULL}};
5553 const char* strict_context_data[][2] = {{"'use strict';", ""}, {NULL}};
5554 const char* strong_context_data[][2] = {{"'use strong';", ""}, {NULL}};
5555
5556 const char* data[] = {
5557 "class C extends Object { constructor() {} }",
5558 "class C extends Object { constructor() { (super()); } }",
5559 "class C extends Object { constructor() { (() => super())(); } }",
5560 "class C extends Object { constructor() { { super(); } } }",
5561 "class C extends Object { constructor() { if (1) super(); } }",
5562 "class C extends Object { constructor() { super(), super(); } }",
5563 "class C extends Object { constructor() { super(); super(); } }",
5564 "class C extends Object { constructor() { super(); (super()); } }",
5565 "class C extends Object { constructor() { super(); { super() } } }",
5566 NULL};
5567
5568 static const ParserFlag always_flags[] = {
5569 kAllowStrongMode, kAllowHarmonyClasses, kAllowHarmonyObjectLiterals,
5570 kAllowHarmonyArrowFunctions
5571 };
5572 RunParserSyncTest(sloppy_context_data, data, kError, NULL, 0, always_flags,
5573 arraysize(always_flags));
5574 RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags,
5575 arraysize(always_flags));
5576 RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags,
5577 arraysize(always_flags));
5578 }
5579
5580
5551 TEST(ArrowFunctionASIErrors) { 5581 TEST(ArrowFunctionASIErrors) {
5552 const char* context_data[][2] = {{"'use strict';", ""}, {"", ""}, 5582 const char* context_data[][2] = {{"'use strict';", ""}, {"", ""},
5553 {NULL, NULL}}; 5583 {NULL, NULL}};
5554 5584
5555 const char* data[] = { 5585 const char* data[] = {
5556 "(a\n=> a)(1)", 5586 "(a\n=> a)(1)",
5557 "(a/*\n*/=> a)(1)", 5587 "(a/*\n*/=> a)(1)",
5558 "((a)\n=> a)(1)", 5588 "((a)\n=> a)(1)",
5559 "((a)/*\n*/=> a)(1)", 5589 "((a)/*\n*/=> a)(1)",
5560 "((a, b)\n=> a + b)(1, 2)", 5590 "((a, b)\n=> a + b)(1, 2)",
5561 "((a, b)/*\n*/=> a + b)(1, 2)", 5591 "((a, b)/*\n*/=> a + b)(1, 2)",
5562 NULL}; 5592 NULL};
5563 static const ParserFlag always_flags[] = {kAllowHarmonyArrowFunctions}; 5593 static const ParserFlag always_flags[] = {kAllowHarmonyArrowFunctions};
5564 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 5594 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
5565 arraysize(always_flags)); 5595 arraysize(always_flags));
5566 } 5596 }
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/strong/classes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698