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 6994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7005 NULL}; | 7005 NULL}; |
7006 | 7006 |
7007 static const ParserFlag always_flags[] = { | 7007 static const ParserFlag always_flags[] = { |
7008 kAllowHarmonyArrowFunctions, kAllowHarmonyDefaultParameters, | 7008 kAllowHarmonyArrowFunctions, kAllowHarmonyDefaultParameters, |
7009 kAllowHarmonyDestructuring, kAllowHarmonyRestParameters, | 7009 kAllowHarmonyDestructuring, kAllowHarmonyRestParameters, |
7010 kAllowHarmonySloppy, kAllowStrongMode | 7010 kAllowHarmonySloppy, kAllowStrongMode |
7011 }; | 7011 }; |
7012 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 7012 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
7013 arraysize(always_flags)); | 7013 arraysize(always_flags)); |
7014 } | 7014 } |
| 7015 |
| 7016 |
| 7017 TEST(LetSloppyOnly) { |
| 7018 // clang-format off |
| 7019 const char* context_data[][2] = { |
| 7020 {"", ""}, |
| 7021 {"{", "}"}, |
| 7022 {NULL, NULL} |
| 7023 }; |
| 7024 |
| 7025 const char* data[] = { |
| 7026 "let let", |
| 7027 "let", |
| 7028 "let let = 1", |
| 7029 "let = 1", |
| 7030 "for (let let = 1; let < 1; let++) {}", |
| 7031 "for (let = 1; let < 1; let++) {}", |
| 7032 "for (let let in {}) {}", |
| 7033 "for (let let of []) {}", |
| 7034 "for (let in {}) {}", |
| 7035 NULL |
| 7036 }; |
| 7037 // clang-format on |
| 7038 |
| 7039 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
| 7040 kAllowHarmonySloppyLet}; |
| 7041 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
| 7042 arraysize(always_flags)); |
| 7043 } |
OLD | NEW |