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 7024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7035 "{ x: (foo()) }", | 7035 "{ x: (foo()) }", |
7036 "{ x: (function() {}) }", | 7036 "{ x: (function() {}) }", |
7037 "{ x: y } = 'str'", | 7037 "{ x: y } = 'str'", |
7038 "[x, y] = 'str'", | 7038 "[x, y] = 'str'", |
7039 "[(x,y) => z]", | 7039 "[(x,y) => z]", |
7040 "{x: (y) => z}", | 7040 "{x: (y) => z}", |
7041 "[x, ...y, z]", | 7041 "[x, ...y, z]", |
7042 "[...x,]", | 7042 "[...x,]", |
7043 "[x, y, ...z = 1]", | 7043 "[x, y, ...z = 1]", |
7044 "[...z = 1]", | 7044 "[...z = 1]", |
| 7045 |
| 7046 // v8:4657 |
| 7047 "({ x: x4, x: (x+=1e4) })", |
| 7048 "(({ x: x4, x: (x+=1e4) }))", |
| 7049 "({ x: x4, x: (x+=1e4) } = {})", |
| 7050 "(({ x: x4, x: (x+=1e4) } = {}))", |
| 7051 "(({ x: x4, x: (x+=1e4) }) = {})", |
| 7052 "({ x: y } = {})", |
| 7053 "(({ x: y } = {}))", |
| 7054 "(({ x: y }) = {})", |
| 7055 "([a])", |
| 7056 "(([a]))", |
| 7057 "([a] = [])", |
| 7058 "(([a] = []))", |
| 7059 "(([a]) = [])", |
7045 NULL}; | 7060 NULL}; |
7046 // clang-format on | 7061 // clang-format on |
7047 static const ParserFlag always_flags[] = { | 7062 static const ParserFlag always_flags[] = { |
7048 kAllowHarmonyDestructuringAssignment, kAllowHarmonyDestructuring, | 7063 kAllowHarmonyDestructuringAssignment, kAllowHarmonyDestructuring, |
7049 kAllowHarmonyDefaultParameters}; | 7064 kAllowHarmonyDefaultParameters}; |
7050 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 7065 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
7051 arraysize(always_flags)); | 7066 arraysize(always_flags)); |
7052 | 7067 |
7053 const char* empty_context_data[][2] = { | 7068 const char* empty_context_data[][2] = { |
7054 {"'use strict';", ""}, {"", ""}, {NULL, NULL}}; | 7069 {"'use strict';", ""}, {"", ""}, {NULL, NULL}}; |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7772 } | 7787 } |
7773 | 7788 |
7774 | 7789 |
7775 TEST(MiscSyntaxErrors) { | 7790 TEST(MiscSyntaxErrors) { |
7776 const char* context_data[][2] = { | 7791 const char* context_data[][2] = { |
7777 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; | 7792 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; |
7778 const char* error_data[] = {"for (();;) {}", NULL}; | 7793 const char* error_data[] = {"for (();;) {}", NULL}; |
7779 | 7794 |
7780 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); | 7795 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); |
7781 } | 7796 } |
OLD | NEW |