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

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: Fix from review comments 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
« src/parsing/parser.cc ('K') | « 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 7118 matching lines...) Expand 10 before | Expand all | Expand 10 after
7129 "for (var i = 0; i < 1; i++) label: function f() { };", 7129 "for (var i = 0; i < 1; i++) label: function f() { };",
7130 "for (var x in {a: 1}) label: function f() { };", 7130 "for (var x in {a: 1}) label: function f() { };",
7131 "for (var x in {}) label: function f() { };", 7131 "for (var x in {}) label: function f() { };",
7132 "for (var x in {}) label: function foo() {}", 7132 "for (var x in {}) label: function foo() {}",
7133 "for (x in {a: 1}) label: function f() { };", 7133 "for (x in {a: 1}) label: function f() { };",
7134 "for (x in {}) label: function f() { };", 7134 "for (x in {}) label: function f() { };",
7135 "var x; for (x in {}) label: function foo() {}", 7135 "var x; for (x in {}) label: function foo() {}",
7136 "with ({}) label: function f() { };", 7136 "with ({}) label: function f() { };",
7137 "if (true) label: function f() {}", 7137 "if (true) label: function f() {}",
7138 "if (true) {} else label: function f() {}", 7138 "if (true) {} else label: function f() {}",
7139 "if (true) function* f() { }",
7140 "label: function* f() { }",
7141 // TODO(littledan, v8:4806): Ban duplicate generator declarations in
7142 // a block, maybe by tracking whether a Variable is a generator declaration
7143 // "{ function* f() {} function* f() {} }",
7144 // "{ function f() {} function* f() {} }",
7145 // "{ function* f() {} function f() {} }",
7139 NULL 7146 NULL
7140 }; 7147 };
7141 // Valid only in sloppy mode, with or without 7148 // Valid only in sloppy mode, with or without
7142 // --harmony-restrictive-declarations 7149 // --harmony-restrictive-declarations
7143 const char* sloppy_data[] = { 7150 const char* sloppy_data[] = {
7144 "if (true) function foo() {}", 7151 "if (true) function foo() {}",
7145 "if (false) {} else function f() { };", 7152 "if (false) {} else function f() { };",
7146 "label: function f() { }", 7153 "label: function f() { }",
7147 "label: if (true) function f() { }", 7154 "label: if (true) function f() { }",
7148 "label: if (true) {} else function f() { }", 7155 "label: if (true) {} else function f() { }",
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
7260 // "Array() **= 10", 7267 // "Array() **= 10",
7261 NULL 7268 NULL
7262 }; 7269 };
7263 // clang-format on 7270 // clang-format on
7264 7271
7265 static const ParserFlag always_flags[] = { 7272 static const ParserFlag always_flags[] = {
7266 kAllowHarmonyExponentiationOperator}; 7273 kAllowHarmonyExponentiationOperator};
7267 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, 7274 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags,
7268 arraysize(always_flags)); 7275 arraysize(always_flags));
7269 } 7276 }
OLDNEW
« src/parsing/parser.cc ('K') | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698