OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |