| 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 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 data.Dispose(); | 1499 data.Dispose(); |
| 1500 return i::MessageTemplate::FormatMessage(isolate, message, arg_object); | 1500 return i::MessageTemplate::FormatMessage(isolate, message, arg_object); |
| 1501 } | 1501 } |
| 1502 | 1502 |
| 1503 enum ParserFlag { | 1503 enum ParserFlag { |
| 1504 kAllowLazy, | 1504 kAllowLazy, |
| 1505 kAllowNatives, | 1505 kAllowNatives, |
| 1506 kAllowHarmonySloppy, | 1506 kAllowHarmonySloppy, |
| 1507 kAllowHarmonySloppyLet, | 1507 kAllowHarmonySloppyLet, |
| 1508 kAllowHarmonyNewTarget, | 1508 kAllowHarmonyNewTarget, |
| 1509 kNoLegacyConst, | |
| 1510 kAllowHarmonyFunctionSent, | 1509 kAllowHarmonyFunctionSent, |
| 1511 kAllowHarmonyRestrictiveDeclarations, | 1510 kAllowHarmonyRestrictiveDeclarations, |
| 1512 kAllowHarmonyExponentiationOperator | 1511 kAllowHarmonyExponentiationOperator |
| 1513 }; | 1512 }; |
| 1514 | 1513 |
| 1515 enum ParserSyncTestResult { | 1514 enum ParserSyncTestResult { |
| 1516 kSuccessOrError, | 1515 kSuccessOrError, |
| 1517 kSuccess, | 1516 kSuccess, |
| 1518 kError | 1517 kError |
| 1519 }; | 1518 }; |
| 1520 | 1519 |
| 1521 template <typename Traits> | 1520 template <typename Traits> |
| 1522 void SetParserFlags(i::ParserBase<Traits>* parser, | 1521 void SetParserFlags(i::ParserBase<Traits>* parser, |
| 1523 i::EnumSet<ParserFlag> flags) { | 1522 i::EnumSet<ParserFlag> flags) { |
| 1524 parser->set_allow_lazy(flags.Contains(kAllowLazy)); | 1523 parser->set_allow_lazy(flags.Contains(kAllowLazy)); |
| 1525 parser->set_allow_natives(flags.Contains(kAllowNatives)); | 1524 parser->set_allow_natives(flags.Contains(kAllowNatives)); |
| 1526 parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); | 1525 parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); |
| 1527 parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet)); | 1526 parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet)); |
| 1528 parser->set_allow_legacy_const(!flags.Contains(kNoLegacyConst)); | |
| 1529 parser->set_allow_harmony_function_sent( | 1527 parser->set_allow_harmony_function_sent( |
| 1530 flags.Contains(kAllowHarmonyFunctionSent)); | 1528 flags.Contains(kAllowHarmonyFunctionSent)); |
| 1531 parser->set_allow_harmony_restrictive_declarations( | 1529 parser->set_allow_harmony_restrictive_declarations( |
| 1532 flags.Contains(kAllowHarmonyRestrictiveDeclarations)); | 1530 flags.Contains(kAllowHarmonyRestrictiveDeclarations)); |
| 1533 parser->set_allow_harmony_exponentiation_operator( | 1531 parser->set_allow_harmony_exponentiation_operator( |
| 1534 flags.Contains(kAllowHarmonyExponentiationOperator)); | 1532 flags.Contains(kAllowHarmonyExponentiationOperator)); |
| 1535 } | 1533 } |
| 1536 | 1534 |
| 1537 | 1535 |
| 1538 void TestParserSyncWithFlags(i::Handle<i::String> source, | 1536 void TestParserSyncWithFlags(i::Handle<i::String> source, |
| (...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3519 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); | 3517 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); |
| 3520 CompileRun("\"use asm\";\n" | 3518 CompileRun("\"use asm\";\n" |
| 3521 "var foo = 1;\n" | 3519 "var foo = 1;\n" |
| 3522 "\"use asm\";\n" // Only the first one counts. | 3520 "\"use asm\";\n" // Only the first one counts. |
| 3523 "function bar() { \"use asm\"; var baz = 1; }"); | 3521 "function bar() { \"use asm\"; var baz = 1; }"); |
| 3524 // Optimizing will double-count because the source is parsed twice. | 3522 // Optimizing will double-count because the source is parsed twice. |
| 3525 CHECK_EQ(i::FLAG_always_opt ? 4 : 2, use_counts[v8::Isolate::kUseAsm]); | 3523 CHECK_EQ(i::FLAG_always_opt ? 4 : 2, use_counts[v8::Isolate::kUseAsm]); |
| 3526 } | 3524 } |
| 3527 | 3525 |
| 3528 | 3526 |
| 3529 TEST(UseConstLegacyCount) { | |
| 3530 i::FLAG_legacy_const = true; | |
| 3531 i::Isolate* isolate = CcTest::i_isolate(); | |
| 3532 i::HandleScope scope(isolate); | |
| 3533 LocalContext env; | |
| 3534 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; | |
| 3535 global_use_counts = use_counts; | |
| 3536 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); | |
| 3537 CompileRun( | |
| 3538 "const x = 1;\n" | |
| 3539 "var foo = 1;\n" | |
| 3540 "const y = 1;\n" | |
| 3541 "function bar() {\n" | |
| 3542 " const z = 1; var baz = 1;\n" | |
| 3543 " function q() { const k = 42; }\n" | |
| 3544 "}"); | |
| 3545 // Optimizing will double-count because the source is parsed twice. | |
| 3546 CHECK_EQ(i::FLAG_always_opt ? 8 : 4, use_counts[v8::Isolate::kLegacyConst]); | |
| 3547 } | |
| 3548 | |
| 3549 | |
| 3550 TEST(StrictModeUseCount) { | 3527 TEST(StrictModeUseCount) { |
| 3551 i::Isolate* isolate = CcTest::i_isolate(); | 3528 i::Isolate* isolate = CcTest::i_isolate(); |
| 3552 i::HandleScope scope(isolate); | 3529 i::HandleScope scope(isolate); |
| 3553 LocalContext env; | 3530 LocalContext env; |
| 3554 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; | 3531 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; |
| 3555 global_use_counts = use_counts; | 3532 global_use_counts = use_counts; |
| 3556 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); | 3533 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); |
| 3557 CompileRun( | 3534 CompileRun( |
| 3558 "\"use strict\";\n" | 3535 "\"use strict\";\n" |
| 3559 "function bar() { var baz = 1; }"); // strict mode inherits | 3536 "function bar() { var baz = 1; }"); // strict mode inherits |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4869 TEST(StatementParsingInForIn) { | 4846 TEST(StatementParsingInForIn) { |
| 4870 const char* context_data[][2] = {{"", ""}, | 4847 const char* context_data[][2] = {{"", ""}, |
| 4871 {"'use strict';", ""}, | 4848 {"'use strict';", ""}, |
| 4872 {"function foo(){ 'use strict';", "}"}, | 4849 {"function foo(){ 'use strict';", "}"}, |
| 4873 {NULL, NULL}}; | 4850 {NULL, NULL}}; |
| 4874 | 4851 |
| 4875 const char* data[] = {"for(x in {}, {}) {}", "for(var x in {}, {}) {}", | 4852 const char* data[] = {"for(x in {}, {}) {}", "for(var x in {}, {}) {}", |
| 4876 "for(let x in {}, {}) {}", "for(const x in {}, {}) {}", | 4853 "for(let x in {}, {}) {}", "for(const x in {}, {}) {}", |
| 4877 NULL}; | 4854 NULL}; |
| 4878 | 4855 |
| 4879 static const ParserFlag always_flags[] = { | 4856 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
| 4880 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst}; | 4857 kAllowHarmonySloppyLet}; |
| 4881 RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, | 4858 RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, |
| 4882 arraysize(always_flags)); | 4859 arraysize(always_flags)); |
| 4883 } | 4860 } |
| 4884 | 4861 |
| 4885 | 4862 |
| 4886 TEST(ConstParsingInForInError) { | 4863 TEST(ConstParsingInForInError) { |
| 4887 const char* context_data[][2] = {{"'use strict';", ""}, | 4864 const char* context_data[][2] = {{"'use strict';", ""}, |
| 4888 {"function foo(){ 'use strict';", "}"}, | 4865 {"function foo(){ 'use strict';", "}"}, |
| 4889 {NULL, NULL}}; | 4866 {NULL, NULL}}; |
| 4890 | 4867 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5059 TEST(ForOfInOperator) { | 5036 TEST(ForOfInOperator) { |
| 5060 const char* context_data[][2] = {{"", ""}, | 5037 const char* context_data[][2] = {{"", ""}, |
| 5061 {"'use strict';", ""}, | 5038 {"'use strict';", ""}, |
| 5062 {"function foo(){ 'use strict';", "}"}, | 5039 {"function foo(){ 'use strict';", "}"}, |
| 5063 {NULL, NULL}}; | 5040 {NULL, NULL}}; |
| 5064 | 5041 |
| 5065 const char* data[] = { | 5042 const char* data[] = { |
| 5066 "for(x of 'foo' in {}) {}", "for(var x of 'foo' in {}) {}", | 5043 "for(x of 'foo' in {}) {}", "for(var x of 'foo' in {}) {}", |
| 5067 "for(let x of 'foo' in {}) {}", "for(const x of 'foo' in {}) {}", NULL}; | 5044 "for(let x of 'foo' in {}) {}", "for(const x of 'foo' in {}) {}", NULL}; |
| 5068 | 5045 |
| 5069 static const ParserFlag always_flags[] = { | 5046 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
| 5070 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst}; | 5047 kAllowHarmonySloppyLet}; |
| 5071 RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, | 5048 RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, |
| 5072 arraysize(always_flags)); | 5049 arraysize(always_flags)); |
| 5073 } | 5050 } |
| 5074 | 5051 |
| 5075 | 5052 |
| 5076 TEST(ForOfYieldIdentifier) { | 5053 TEST(ForOfYieldIdentifier) { |
| 5077 const char* context_data[][2] = {{"", ""}, {NULL, NULL}}; | 5054 const char* context_data[][2] = {{"", ""}, {NULL, NULL}}; |
| 5078 | 5055 |
| 5079 const char* data[] = {"for(x of yield) {}", "for(var x of yield) {}", | 5056 const char* data[] = {"for(x of yield) {}", "for(var x of yield) {}", |
| 5080 "for(let x of yield) {}", "for(const x of yield) {}", | 5057 "for(let x of yield) {}", "for(const x of yield) {}", |
| 5081 NULL}; | 5058 NULL}; |
| 5082 | 5059 |
| 5083 static const ParserFlag always_flags[] = { | 5060 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
| 5084 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst}; | 5061 kAllowHarmonySloppyLet}; |
| 5085 RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, | 5062 RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, |
| 5086 arraysize(always_flags)); | 5063 arraysize(always_flags)); |
| 5087 } | 5064 } |
| 5088 | 5065 |
| 5089 | 5066 |
| 5090 TEST(ForOfYieldExpression) { | 5067 TEST(ForOfYieldExpression) { |
| 5091 const char* context_data[][2] = {{"", ""}, | 5068 const char* context_data[][2] = {{"", ""}, |
| 5092 {"'use strict';", ""}, | 5069 {"'use strict';", ""}, |
| 5093 {"function foo(){ 'use strict';", "}"}, | 5070 {"function foo(){ 'use strict';", "}"}, |
| 5094 {NULL, NULL}}; | 5071 {NULL, NULL}}; |
| 5095 | 5072 |
| 5096 const char* data[] = {"function* g() { for(x of yield) {} }", | 5073 const char* data[] = {"function* g() { for(x of yield) {} }", |
| 5097 "function* g() { for(var x of yield) {} }", | 5074 "function* g() { for(var x of yield) {} }", |
| 5098 "function* g() { for(let x of yield) {} }", | 5075 "function* g() { for(let x of yield) {} }", |
| 5099 "function* g() { for(const x of yield) {} }", NULL}; | 5076 "function* g() { for(const x of yield) {} }", NULL}; |
| 5100 | 5077 |
| 5101 static const ParserFlag always_flags[] = { | 5078 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
| 5102 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst}; | 5079 kAllowHarmonySloppyLet}; |
| 5103 RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, | 5080 RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, always_flags, |
| 5104 arraysize(always_flags)); | 5081 arraysize(always_flags)); |
| 5105 } | 5082 } |
| 5106 | 5083 |
| 5107 | 5084 |
| 5108 TEST(ForOfExpressionError) { | 5085 TEST(ForOfExpressionError) { |
| 5109 const char* context_data[][2] = {{"", ""}, | 5086 const char* context_data[][2] = {{"", ""}, |
| 5110 {"'use strict';", ""}, | 5087 {"'use strict';", ""}, |
| 5111 {"function foo(){ 'use strict';", "}"}, | 5088 {"function foo(){ 'use strict';", "}"}, |
| 5112 {NULL, NULL}}; | 5089 {NULL, NULL}}; |
| 5113 | 5090 |
| 5114 const char* data[] = { | 5091 const char* data[] = { |
| 5115 "for(x of [], []) {}", "for(var x of [], []) {}", | 5092 "for(x of [], []) {}", "for(var x of [], []) {}", |
| 5116 "for(let x of [], []) {}", "for(const x of [], []) {}", | 5093 "for(let x of [], []) {}", "for(const x of [], []) {}", |
| 5117 | 5094 |
| 5118 // AssignmentExpression should be validated statically: | 5095 // AssignmentExpression should be validated statically: |
| 5119 "for(x of { y = 23 }) {}", "for(var x of { y = 23 }) {}", | 5096 "for(x of { y = 23 }) {}", "for(var x of { y = 23 }) {}", |
| 5120 "for(let x of { y = 23 }) {}", "for(const x of { y = 23 }) {}", NULL}; | 5097 "for(let x of { y = 23 }) {}", "for(const x of { y = 23 }) {}", NULL}; |
| 5121 | 5098 |
| 5122 static const ParserFlag always_flags[] = { | 5099 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
| 5123 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst}; | 5100 kAllowHarmonySloppyLet}; |
| 5124 RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, | 5101 RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags, |
| 5125 arraysize(always_flags)); | 5102 arraysize(always_flags)); |
| 5126 } | 5103 } |
| 5127 | 5104 |
| 5128 | 5105 |
| 5129 TEST(InvalidUnicodeEscapes) { | 5106 TEST(InvalidUnicodeEscapes) { |
| 5130 const char* context_data[][2] = {{"", ""}, | 5107 const char* context_data[][2] = {{"", ""}, |
| 5131 {"'use strict';", ""}, | 5108 {"'use strict';", ""}, |
| 5132 {NULL, NULL}}; | 5109 {NULL, NULL}}; |
| 5133 const char* data[] = { | 5110 const char* data[] = { |
| (...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6814 }; | 6791 }; |
| 6815 // clang-format on | 6792 // clang-format on |
| 6816 | 6793 |
| 6817 RunParserSyncTest(good_context_data, data, kSuccess, NULL, 0, always_flags, | 6794 RunParserSyncTest(good_context_data, data, kSuccess, NULL, 0, always_flags, |
| 6818 arraysize(always_flags)); | 6795 arraysize(always_flags)); |
| 6819 RunParserSyncTest(bad_context_data, data, kError, NULL, 0, always_flags, | 6796 RunParserSyncTest(bad_context_data, data, kError, NULL, 0, always_flags, |
| 6820 arraysize(always_flags)); | 6797 arraysize(always_flags)); |
| 6821 } | 6798 } |
| 6822 | 6799 |
| 6823 | 6800 |
| 6824 TEST(ConstLegacy) { | |
| 6825 // clang-format off | |
| 6826 const char* context_data[][2] = { | |
| 6827 {"", ""}, | |
| 6828 {"{", "}"}, | |
| 6829 {NULL, NULL} | |
| 6830 }; | |
| 6831 | |
| 6832 const char* data[] = { | |
| 6833 "const x", | |
| 6834 "const x = 1", | |
| 6835 "for (const x = 1; x < 1; x++) {}", | |
| 6836 "for (const x in {}) {}", | |
| 6837 "for (const x of []) {}", | |
| 6838 NULL | |
| 6839 }; | |
| 6840 // clang-format on | |
| 6841 | |
| 6842 | |
| 6843 static const ParserFlag always_flags[] = {kNoLegacyConst}; | |
| 6844 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | |
| 6845 arraysize(always_flags)); | |
| 6846 RunParserSyncTest(context_data, data, kSuccess); | |
| 6847 } | |
| 6848 | |
| 6849 | |
| 6850 TEST(ConstSloppy) { | 6801 TEST(ConstSloppy) { |
| 6851 // clang-format off | 6802 // clang-format off |
| 6852 const char* context_data[][2] = { | 6803 const char* context_data[][2] = { |
| 6853 {"", ""}, | 6804 {"", ""}, |
| 6854 {"{", "}"}, | 6805 {"{", "}"}, |
| 6855 {NULL, NULL} | 6806 {NULL, NULL} |
| 6856 }; | 6807 }; |
| 6857 | 6808 |
| 6858 const char* data[] = { | 6809 const char* data[] = { |
| 6859 "const x = 1", | 6810 "const x = 1", |
| 6860 "for (const x = 1; x < 1; x++) {}", | 6811 "for (const x = 1; x < 1; x++) {}", |
| 6861 "for (const x in {}) {}", | 6812 "for (const x in {}) {}", |
| 6862 "for (const x of []) {}", | 6813 "for (const x of []) {}", |
| 6863 NULL | 6814 NULL |
| 6864 }; | 6815 }; |
| 6865 // clang-format on | 6816 // clang-format on |
| 6866 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, | 6817 static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; |
| 6867 kNoLegacyConst}; | |
| 6868 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | 6818 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
| 6869 arraysize(always_flags)); | 6819 arraysize(always_flags)); |
| 6870 } | 6820 } |
| 6871 | 6821 |
| 6872 | 6822 |
| 6873 TEST(LetSloppy) { | 6823 TEST(LetSloppy) { |
| 6874 // clang-format off | 6824 // clang-format off |
| 6875 const char* context_data[][2] = { | 6825 const char* context_data[][2] = { |
| 6876 {"", ""}, | 6826 {"", ""}, |
| 6877 {"'use strict';", ""}, | 6827 {"'use strict';", ""}, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6957 "let", | 6907 "let", |
| 6958 "let = 1", | 6908 "let = 1", |
| 6959 "for (let = 1; let < 1; let++) {}", | 6909 "for (let = 1; let < 1; let++) {}", |
| 6960 "for (let in {}) {}", | 6910 "for (let in {}) {}", |
| 6961 "for (var let = 1; let < 1; let++) {}", | 6911 "for (var let = 1; let < 1; let++) {}", |
| 6962 "for (var let in {}) {}", | 6912 "for (var let in {}) {}", |
| 6963 "for (var [let] = 1; let < 1; let++) {}", | 6913 "for (var [let] = 1; let < 1; let++) {}", |
| 6964 "for (var [let] in {}) {}", | 6914 "for (var [let] in {}) {}", |
| 6965 "var let", | 6915 "var let", |
| 6966 "var [let] = []", | 6916 "var [let] = []", |
| 6967 "for (const let = 1; let < 1; let++) {}", | |
| 6968 "for (const let in {}) {}", | |
| 6969 "for (const [let] = 1; let < 1; let++) {}", | |
| 6970 "for (const [let] in {}) {}", | |
| 6971 "const let", | |
| 6972 "const [let] = []", | |
| 6973 NULL | 6917 NULL |
| 6974 }; | 6918 }; |
| 6975 // clang-format on | 6919 // clang-format on |
| 6976 | 6920 |
| 6977 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, | 6921 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
| 6978 kAllowHarmonySloppyLet}; | 6922 kAllowHarmonySloppyLet}; |
| 6979 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | 6923 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
| 6980 arraysize(always_flags)); | 6924 arraysize(always_flags)); |
| 6981 | 6925 |
| 6982 // Some things should be rejected even in sloppy mode | 6926 // Some things should be rejected even in sloppy mode |
| (...skipping 21 matching lines...) Expand all Loading... |
| 7004 // Sprinkle in the escaped version too. | 6948 // Sprinkle in the escaped version too. |
| 7005 "let l\\u0065t = 1", | 6949 "let l\\u0065t = 1", |
| 7006 "const l\\u0065t = 1", | 6950 "const l\\u0065t = 1", |
| 7007 "let [l\\u0065t] = 1", | 6951 "let [l\\u0065t] = 1", |
| 7008 "const [l\\u0065t] = 1", | 6952 "const [l\\u0065t] = 1", |
| 7009 "for (let l\\u0065t in {}) {}", | 6953 "for (let l\\u0065t in {}) {}", |
| 7010 NULL | 6954 NULL |
| 7011 }; | 6955 }; |
| 7012 // clang-format on | 6956 // clang-format on |
| 7013 | 6957 |
| 7014 static const ParserFlag fail_flags[] = { | 6958 static const ParserFlag fail_flags[] = {kAllowHarmonySloppy, |
| 7015 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst}; | 6959 kAllowHarmonySloppyLet}; |
| 7016 RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags, | 6960 RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags, |
| 7017 arraysize(fail_flags)); | 6961 arraysize(fail_flags)); |
| 7018 } | 6962 } |
| 7019 | 6963 |
| 7020 | 6964 |
| 7021 TEST(EscapedKeywords) { | 6965 TEST(EscapedKeywords) { |
| 7022 // clang-format off | 6966 // clang-format off |
| 7023 const char* sloppy_context_data[][2] = { | 6967 const char* sloppy_context_data[][2] = { |
| 7024 {"", ""}, | 6968 {"", ""}, |
| 7025 {NULL, NULL} | 6969 {NULL, NULL} |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7410 // "Array() **= 10", | 7354 // "Array() **= 10", |
| 7411 NULL | 7355 NULL |
| 7412 }; | 7356 }; |
| 7413 // clang-format on | 7357 // clang-format on |
| 7414 | 7358 |
| 7415 static const ParserFlag always_flags[] = { | 7359 static const ParserFlag always_flags[] = { |
| 7416 kAllowHarmonyExponentiationOperator}; | 7360 kAllowHarmonyExponentiationOperator}; |
| 7417 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, | 7361 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, |
| 7418 arraysize(always_flags)); | 7362 arraysize(always_flags)); |
| 7419 } | 7363 } |
| OLD | NEW |