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

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

Issue 1522693002: [es6] strict eval/arguments and strong undefined in AssignmentPattern (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« src/parsing/parser-base.h ('K') | « src/parsing/preparser.h ('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 7073 matching lines...) Expand 10 before | Expand all | Expand 10 after
7084 "var x; [{ x = 10 }]", 7084 "var x; [{ x = 10 }]",
7085 "var x; (true ? { x = true } : { x = false })", 7085 "var x; (true ? { x = true } : { x = false })",
7086 "var q, x; (q, { x = 10 });", 7086 "var q, x; (q, { x = 10 });",
7087 "var { x = 10 } = { x = 20 };", 7087 "var { x = 10 } = { x = 20 };",
7088 "var { x = 10 } = (o = { x = 20 });", 7088 "var { x = 10 } = (o = { x = 20 });",
7089 "var x; (({ x = 10 } = { x = 20 }) => x)({})", 7089 "var x; (({ x = 10 } = { x = 20 }) => x)({})",
7090 NULL, 7090 NULL,
7091 }; 7091 };
7092 RunParserSyncTest(empty_context_data, ambiguity_data, kError, NULL, 0, 7092 RunParserSyncTest(empty_context_data, ambiguity_data, kError, NULL, 0,
7093 always_flags, arraysize(always_flags)); 7093 always_flags, arraysize(always_flags));
7094
7095 // Strict mode errors
7096 const char* strict_context_data[][2] = {{"'use strict'; ", " = {}"},
7097 {"'use strict'; for (", " of {}) {}"},
7098 {"'use strict'; for (", " in {}) {}"},
7099 {NULL, NULL}};
7100 const char* strict_data[] = {"{ eval }",
7101 "{ arguments }",
7102 "{ foo: eval }",
7103 "{ foo: arguments }",
7104 "{ eval = 0 }",
7105 "{ arguments = 0 }",
7106 "{ foo: eval = 0 }",
7107 "{ foo: arguments = 0 }",
7108 "[ eval ]",
7109 "[ arguments ]",
7110 "[ eval = 0 ]",
7111 "[ arguments = 0 ]",
7112 NULL};
7113 RunParserSyncTest(strict_context_data, strict_data, kError, NULL, 0,
7114 always_flags, arraysize(always_flags));
7094 } 7115 }
7095 7116
7096 7117
7097 TEST(DestructuringDisallowPatternsInForVarIn) { 7118 TEST(DestructuringDisallowPatternsInForVarIn) {
7098 i::FLAG_harmony_destructuring_bind = true; 7119 i::FLAG_harmony_destructuring_bind = true;
7099 static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring}; 7120 static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
7100 const char* context_data[][2] = { 7121 const char* context_data[][2] = {
7101 {"", ""}, {"function f() {", "}"}, {NULL, NULL}}; 7122 {"", ""}, {"function f() {", "}"}, {NULL, NULL}};
7102 // clang-format off 7123 // clang-format off
7103 const char* error_data[] = { 7124 const char* error_data[] = {
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
7773 } 7794 }
7774 7795
7775 7796
7776 TEST(MiscSyntaxErrors) { 7797 TEST(MiscSyntaxErrors) {
7777 const char* context_data[][2] = { 7798 const char* context_data[][2] = {
7778 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; 7799 {"'use strict'", ""}, {"", ""}, {NULL, NULL}};
7779 const char* error_data[] = {"for (();;) {}", NULL}; 7800 const char* error_data[] = {"for (();;) {}", NULL};
7780 7801
7781 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); 7802 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0);
7782 } 7803 }
OLDNEW
« src/parsing/parser-base.h ('K') | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698