| 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 7073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7084 "var x; [{ x = 10 }]", | 7084 "var x; [{ x = 10 }]", |
| 7085 "var x; (true ? { x = true } : { x = false })", | 7085 "var x; (true ? { x = true } : { x = false })", |
| 7086 "var q, x; (q, { x = 10 });", | 7086 "var q, x; (q, { x = 10 });", |
| 7087 "var { x = 10 } = { x = 20 };", | 7087 "var { x = 10 } = { x = 20 };", |
| 7088 "var { x = 10 } = (o = { x = 20 });", | 7088 "var { x = 10 } = (o = { x = 20 });", |
| 7089 "var x; (({ x = 10 } = { x = 20 }) => x)({})", | 7089 "var x; (({ x = 10 } = { x = 20 }) => x)({})", |
| 7090 NULL, | 7090 NULL, |
| 7091 }; | 7091 }; |
| 7092 RunParserSyncTest(empty_context_data, ambiguity_data, kError, NULL, 0, | 7092 RunParserSyncTest(empty_context_data, ambiguity_data, kError, NULL, 0, |
| 7093 always_flags, arraysize(always_flags)); | 7093 always_flags, arraysize(always_flags)); |
| 7094 |
| 7095 // Strict mode errors |
| 7096 const char* strict_context_data[][2] = {{"'use strict'; ", " = {}"}, |
| 7097 {"'use strict'; for (", " of {}) {}"}, |
| 7098 {"'use strict'; for (", " in {}) {}"}, |
| 7099 {NULL, NULL}}; |
| 7100 const char* strict_data[] = {"{ eval }", |
| 7101 "{ arguments }", |
| 7102 "{ foo: eval }", |
| 7103 "{ foo: arguments }", |
| 7104 "{ eval = 0 }", |
| 7105 "{ arguments = 0 }", |
| 7106 "{ foo: eval = 0 }", |
| 7107 "{ foo: arguments = 0 }", |
| 7108 "[ eval ]", |
| 7109 "[ arguments ]", |
| 7110 "[ eval = 0 ]", |
| 7111 "[ arguments = 0 ]", |
| 7112 NULL}; |
| 7113 RunParserSyncTest(strict_context_data, strict_data, kError, NULL, 0, |
| 7114 always_flags, arraysize(always_flags)); |
| 7094 } | 7115 } |
| 7095 | 7116 |
| 7096 | 7117 |
| 7097 TEST(DestructuringDisallowPatternsInForVarIn) { | 7118 TEST(DestructuringDisallowPatternsInForVarIn) { |
| 7098 i::FLAG_harmony_destructuring_bind = true; | 7119 i::FLAG_harmony_destructuring_bind = true; |
| 7099 static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring}; | 7120 static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring}; |
| 7100 const char* context_data[][2] = { | 7121 const char* context_data[][2] = { |
| 7101 {"", ""}, {"function f() {", "}"}, {NULL, NULL}}; | 7122 {"", ""}, {"function f() {", "}"}, {NULL, NULL}}; |
| 7102 // clang-format off | 7123 // clang-format off |
| 7103 const char* error_data[] = { | 7124 const char* error_data[] = { |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7773 } | 7794 } |
| 7774 | 7795 |
| 7775 | 7796 |
| 7776 TEST(MiscSyntaxErrors) { | 7797 TEST(MiscSyntaxErrors) { |
| 7777 const char* context_data[][2] = { | 7798 const char* context_data[][2] = { |
| 7778 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; | 7799 {"'use strict'", ""}, {"", ""}, {NULL, NULL}}; |
| 7779 const char* error_data[] = {"for (();;) {}", NULL}; | 7800 const char* error_data[] = {"for (();;) {}", NULL}; |
| 7780 | 7801 |
| 7781 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); | 7802 RunParserSyncTest(context_data, error_data, kError, NULL, 0, NULL, 0); |
| 7782 } | 7803 } |
| OLD | NEW |