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 4187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4198 | 4198 |
4199 const char* name_data[] = { | 4199 const char* name_data[] = { |
4200 "function* g() { ({yield}); }", | 4200 "function* g() { ({yield}); }", |
4201 NULL | 4201 NULL |
4202 }; | 4202 }; |
4203 | 4203 |
4204 static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals}; | 4204 static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals}; |
4205 RunParserSyncTest(context_data, name_data, kError, NULL, 0, | 4205 RunParserSyncTest(context_data, name_data, kError, NULL, 0, |
4206 always_flags, arraysize(always_flags)); | 4206 always_flags, arraysize(always_flags)); |
4207 } | 4207 } |
| 4208 |
| 4209 |
| 4210 TEST(ConstParsingInForIn) { |
| 4211 const char* context_data[][2] = {{"'use strict';", ""}, |
| 4212 {"function foo(){ 'use strict';", "}"}, |
| 4213 {NULL, NULL}}; |
| 4214 |
| 4215 const char* data[] = { |
| 4216 "for(const x = 1; ; ) {}", |
| 4217 "for(const x = 1, y = 2;;){}", |
| 4218 "for(const x in [1,2,3]) {}", |
| 4219 "for(const x of [1,2,3]) {}", |
| 4220 NULL}; |
| 4221 static const ParserFlag always_flags[] = {kAllowHarmonyScoping}; |
| 4222 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
| 4223 arraysize(always_flags)); |
| 4224 } |
| 4225 |
| 4226 |
| 4227 TEST(ConstParsingInForInError) { |
| 4228 const char* context_data[][2] = {{"'use strict';", ""}, |
| 4229 {"function foo(){ 'use strict';", "}"}, |
| 4230 {NULL, NULL}}; |
| 4231 |
| 4232 const char* data[] = { |
| 4233 "for(const x,y = 1; ; ) {}", |
| 4234 "for(const x = 4 in [1,2,3]) {}", |
| 4235 "for(const x = 4, y in [1,2,3]) {}", |
| 4236 "for(const x = 4 of [1,2,3]) {}", |
| 4237 "for(const x = 4, y of [1,2,3]) {}", |
| 4238 "for(const x = 1, y = 2 in []) {}", |
| 4239 "for(const x,y in []) {}", |
| 4240 "for(const x = 1, y = 2 of []) {}", |
| 4241 "for(const x,y of []) {}", |
| 4242 NULL}; |
| 4243 static const ParserFlag always_flags[] = {kAllowHarmonyScoping}; |
| 4244 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
| 4245 arraysize(always_flags)); |
| 4246 } |
OLD | NEW |