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

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

Issue 1900033003: Disallow generator declarations in certain locations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 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/parsing/preparser.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 7124 matching lines...) Expand 10 before | Expand all | Expand 10 after
7135 "for (var i = 0; i < 1; i++) label: function f() { };", 7135 "for (var i = 0; i < 1; i++) label: function f() { };",
7136 "for (var x in {a: 1}) label: function f() { };", 7136 "for (var x in {a: 1}) label: function f() { };",
7137 "for (var x in {}) label: function f() { };", 7137 "for (var x in {}) label: function f() { };",
7138 "for (var x in {}) label: function foo() {}", 7138 "for (var x in {}) label: function foo() {}",
7139 "for (x in {a: 1}) label: function f() { };", 7139 "for (x in {a: 1}) label: function f() { };",
7140 "for (x in {}) label: function f() { };", 7140 "for (x in {}) label: function f() { };",
7141 "var x; for (x in {}) label: function foo() {}", 7141 "var x; for (x in {}) label: function foo() {}",
7142 "with ({}) label: function f() { };", 7142 "with ({}) label: function f() { };",
7143 "if (true) label: function f() {}", 7143 "if (true) label: function f() {}",
7144 "if (true) {} else label: function f() {}", 7144 "if (true) {} else label: function f() {}",
7145 "if (true) function* f() { }",
7146 "label: function* f() { }",
7147 // TODO(littledan, v8:4806): Ban duplicate generator declarations in
7148 // a block, maybe by tracking whether a Variable is a generator declaration
7149 // "{ function* f() {} function* f() {} }",
7150 // "{ function f() {} function* f() {} }",
7151 // "{ function* f() {} function f() {} }",
7145 NULL 7152 NULL
7146 }; 7153 };
7147 // Valid only in sloppy mode, with or without 7154 // Valid only in sloppy mode, with or without
7148 // --harmony-restrictive-declarations 7155 // --harmony-restrictive-declarations
7149 const char* sloppy_data[] = { 7156 const char* sloppy_data[] = {
7150 "if (true) function foo() {}", 7157 "if (true) function foo() {}",
7151 "if (false) {} else function f() { };", 7158 "if (false) {} else function f() { };",
7152 "label: function f() { }", 7159 "label: function f() { }",
7153 "label: if (true) function f() { }", 7160 "label: if (true) function f() { }",
7154 "label: if (true) {} else function f() { }", 7161 "label: if (true) {} else function f() { }",
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
7286 "for (const x = 0 in {});", 7293 "for (const x = 0 in {});",
7287 "for (let x = 0 in {});", 7294 "for (let x = 0 in {});",
7288 NULL 7295 NULL
7289 }; 7296 };
7290 // clang-format on 7297 // clang-format on
7291 7298
7292 static const ParserFlag always_flags[] = {kAllowHarmonyForIn}; 7299 static const ParserFlag always_flags[] = {kAllowHarmonyForIn};
7293 RunParserSyncTest(context_data, error_data, kError, nullptr, 0, always_flags, 7300 RunParserSyncTest(context_data, error_data, kError, nullptr, 0, always_flags,
7294 arraysize(always_flags)); 7301 arraysize(always_flags));
7295 } 7302 }
OLDNEW
« no previous file with comments | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698