| 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 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3336 | 3336 |
| 3337 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {}) | 3337 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {}) |
| 3338 "foo ? bar : baz => {}", | 3338 "foo ? bar : baz => {}", |
| 3339 NULL | 3339 NULL |
| 3340 }; | 3340 }; |
| 3341 | 3341 |
| 3342 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; | 3342 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; |
| 3343 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, | 3343 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, |
| 3344 always_flags, ARRAY_SIZE(always_flags)); | 3344 always_flags, ARRAY_SIZE(always_flags)); |
| 3345 } | 3345 } |
| 3346 |
| 3347 |
| 3348 TEST(NoErrorsSuper) { |
| 3349 // Tests that parser and preparser accept valid arrow functions syntax. |
| 3350 const char* context_data[][2] = {{"", ";"}, |
| 3351 {"bar ? (", ") : baz;"}, |
| 3352 {"bar ? baz : (", ");"}, |
| 3353 {"bar, ", ";"}, |
| 3354 {"", ", bar;"}, |
| 3355 {NULL, NULL}}; |
| 3356 |
| 3357 const char* statement_data[] = { |
| 3358 "super.x", |
| 3359 "super[27]", |
| 3360 "new super", |
| 3361 "new super()", |
| 3362 "new super(12, 45)", |
| 3363 "new new super", |
| 3364 "new new super()", |
| 3365 "new new super()()", |
| 3366 NULL}; |
| 3367 |
| 3368 RunParserSyncTest(context_data, statement_data, kSuccess); |
| 3369 } |
| 3370 |
| 3371 |
| 3372 TEST(ErrorsSuper) { |
| 3373 // Tests that parser and preparser accept valid arrow functions syntax. |
| 3374 const char* context_data[][2] = {{"", ";"}, |
| 3375 {"bar ? (", ") : baz;"}, |
| 3376 {"bar ? baz : (", ");"}, |
| 3377 {"bar, ", ";"}, |
| 3378 {"", ", bar;"}, |
| 3379 {NULL, NULL}}; |
| 3380 |
| 3381 const char* statement_data[] = { |
| 3382 "super = x", |
| 3383 "y = super", |
| 3384 "f(super)", |
| 3385 // "z.super", |
| 3386 NULL}; |
| 3387 |
| 3388 RunParserSyncTest(context_data, statement_data, kError); |
| 3389 } |
| OLD | NEW |