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 | |
adamk
2016/01/08 16:24:23
Please add a few tests with multiple levels of par
caitp (gmail)
2016/01/08 16:36:01
Done
| |
7047 "({ x: x4, x: (x+=1e4) })", | |
7048 "({ x: x4, x: (x+=1e4) } = {})", | |
7049 "({ x: y } = {})", | |
7050 "([a])", | |
7051 "([a] = [])", | |
7045 NULL}; | 7052 NULL}; |
7046 // clang-format on | 7053 // clang-format on |
7047 static const ParserFlag always_flags[] = { | 7054 static const ParserFlag always_flags[] = { |
7048 kAllowHarmonyDestructuringAssignment, kAllowHarmonyDestructuring, | 7055 kAllowHarmonyDestructuringAssignment, kAllowHarmonyDestructuring, |
7049 kAllowHarmonyDefaultParameters}; | 7056 kAllowHarmonyDefaultParameters}; |
7050 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 7057 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
7051 arraysize(always_flags)); | 7058 arraysize(always_flags)); |
7052 | 7059 |
7053 const char* empty_context_data[][2] = { | 7060 const char* empty_context_data[][2] = { |
7054 {"'use strict';", ""}, {"", ""}, {NULL, NULL}}; | 7061 {"'use strict';", ""}, {"", ""}, {NULL, NULL}}; |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7772 } | 7779 } |
7773 | 7780 |
7774 | 7781 |
7775 TEST(MiscSyntaxErrors) { | 7782 TEST(MiscSyntaxErrors) { |
7776 const char* context_data[][2] = { | 7783 const char* context_data[][2] = { |
7777 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; | 7784 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; |
7778 const char* error_data[] = {"for (();;) {}", NULL}; | 7785 const char* error_data[] = {"for (();;) {}", NULL}; |
7779 | 7786 |
7780 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); | 7787 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); |
7781 } | 7788 } |
OLD | NEW |