Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 1271073002: Delete --harmony-unicode flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 1425
1426 1426
1427 enum ParserFlag { 1427 enum ParserFlag {
1428 kAllowLazy, 1428 kAllowLazy,
1429 kAllowNatives, 1429 kAllowNatives,
1430 kAllowHarmonyModules, 1430 kAllowHarmonyModules,
1431 kAllowHarmonyArrowFunctions, 1431 kAllowHarmonyArrowFunctions,
1432 kAllowHarmonyRestParameters, 1432 kAllowHarmonyRestParameters,
1433 kAllowHarmonySloppy, 1433 kAllowHarmonySloppy,
1434 kAllowHarmonySloppyLet, 1434 kAllowHarmonySloppyLet,
1435 kAllowHarmonyUnicode,
1436 kAllowHarmonyComputedPropertyNames, 1435 kAllowHarmonyComputedPropertyNames,
1437 kAllowHarmonySpreadCalls, 1436 kAllowHarmonySpreadCalls,
1438 kAllowHarmonyDestructuring, 1437 kAllowHarmonyDestructuring,
1439 kAllowHarmonySpreadArrays, 1438 kAllowHarmonySpreadArrays,
1440 kAllowHarmonyNewTarget, 1439 kAllowHarmonyNewTarget,
1441 kAllowStrongMode, 1440 kAllowStrongMode,
1442 kNoLegacyConst 1441 kNoLegacyConst
1443 }; 1442 };
1444 1443
1445 1444
(...skipping 10 matching lines...) Expand all
1456 parser->set_allow_natives(flags.Contains(kAllowNatives)); 1455 parser->set_allow_natives(flags.Contains(kAllowNatives));
1457 parser->set_allow_harmony_modules(flags.Contains(kAllowHarmonyModules)); 1456 parser->set_allow_harmony_modules(flags.Contains(kAllowHarmonyModules));
1458 parser->set_allow_harmony_arrow_functions( 1457 parser->set_allow_harmony_arrow_functions(
1459 flags.Contains(kAllowHarmonyArrowFunctions)); 1458 flags.Contains(kAllowHarmonyArrowFunctions));
1460 parser->set_allow_harmony_rest_parameters( 1459 parser->set_allow_harmony_rest_parameters(
1461 flags.Contains(kAllowHarmonyRestParameters)); 1460 flags.Contains(kAllowHarmonyRestParameters));
1462 parser->set_allow_harmony_spreadcalls( 1461 parser->set_allow_harmony_spreadcalls(
1463 flags.Contains(kAllowHarmonySpreadCalls)); 1462 flags.Contains(kAllowHarmonySpreadCalls));
1464 parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); 1463 parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy));
1465 parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet)); 1464 parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet));
1466 parser->set_allow_harmony_unicode(flags.Contains(kAllowHarmonyUnicode));
1467 parser->set_allow_harmony_computed_property_names( 1465 parser->set_allow_harmony_computed_property_names(
1468 flags.Contains(kAllowHarmonyComputedPropertyNames)); 1466 flags.Contains(kAllowHarmonyComputedPropertyNames));
1469 parser->set_allow_harmony_destructuring( 1467 parser->set_allow_harmony_destructuring(
1470 flags.Contains(kAllowHarmonyDestructuring)); 1468 flags.Contains(kAllowHarmonyDestructuring));
1471 parser->set_allow_harmony_spread_arrays( 1469 parser->set_allow_harmony_spread_arrays(
1472 flags.Contains(kAllowHarmonySpreadArrays)); 1470 flags.Contains(kAllowHarmonySpreadArrays));
1473 parser->set_allow_harmony_new_target(flags.Contains(kAllowHarmonyNewTarget)); 1471 parser->set_allow_harmony_new_target(flags.Contains(kAllowHarmonyNewTarget));
1474 parser->set_allow_strong_mode(flags.Contains(kAllowStrongMode)); 1472 parser->set_allow_strong_mode(flags.Contains(kAllowStrongMode));
1475 parser->set_allow_legacy_const(!flags.Contains(kNoLegacyConst)); 1473 parser->set_allow_legacy_const(!flags.Contains(kNoLegacyConst));
1476 } 1474 }
(...skipping 3381 matching lines...) Expand 10 before | Expand all | Expand 10 after
4858 "\"foob\\u{c481r\"", 4856 "\"foob\\u{c481r\"",
4859 "var foob\\u{}ar = 0;", 4857 "var foob\\u{}ar = 0;",
4860 // Too high value for the unicode escape 4858 // Too high value for the unicode escape
4861 "\"\\u{110000}\"", 4859 "\"\\u{110000}\"",
4862 // Not an unicode escape 4860 // Not an unicode escape
4863 "var foob\\v1234r = 0;", 4861 "var foob\\v1234r = 0;",
4864 "var foob\\U1234r = 0;", 4862 "var foob\\U1234r = 0;",
4865 "var foob\\v{1234}r = 0;", 4863 "var foob\\v{1234}r = 0;",
4866 "var foob\\U{1234}r = 0;", 4864 "var foob\\U{1234}r = 0;",
4867 NULL}; 4865 NULL};
4868 static const ParserFlag always_flags[] = {kAllowHarmonyUnicode}; 4866 RunParserSyncTest(context_data, data, kError);
4869 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
4870 arraysize(always_flags));
4871 } 4867 }
4872 4868
4873 4869
4874 TEST(UnicodeEscapes) { 4870 TEST(UnicodeEscapes) {
4875 const char* context_data[][2] = {{"", ""}, 4871 const char* context_data[][2] = {{"", ""},
4876 {"'use strict';", ""}, 4872 {"'use strict';", ""},
4877 {NULL, NULL}}; 4873 {NULL, NULL}};
4878 const char* data[] = { 4874 const char* data[] = {
4879 // Identifier starting with escape 4875 // Identifier starting with escape
4880 "var \\u0052oo = 0;", 4876 "var \\u0052oo = 0;",
4881 "var \\u{0052}oo = 0;", 4877 "var \\u{0052}oo = 0;",
4882 "var \\u{52}oo = 0;", 4878 "var \\u{52}oo = 0;",
4883 "var \\u{00000000052}oo = 0;", 4879 "var \\u{00000000052}oo = 0;",
4884 // Identifier with an escape but not starting with an escape 4880 // Identifier with an escape but not starting with an escape
4885 "var foob\\uc481r = 0;", 4881 "var foob\\uc481r = 0;",
4886 "var foob\\u{c481}r = 0;", 4882 "var foob\\u{c481}r = 0;",
4887 // String with an escape 4883 // String with an escape
4888 "\"foob\\uc481r\"", 4884 "\"foob\\uc481r\"",
4889 "\"foob\\{uc481}r\"", 4885 "\"foob\\{uc481}r\"",
4890 // This character is a valid unicode character, representable as a surrogate 4886 // This character is a valid unicode character, representable as a surrogate
4891 // pair, not representable as 4 hex digits. 4887 // pair, not representable as 4 hex digits.
4892 "\"foo\\u{10e6d}\"", 4888 "\"foo\\u{10e6d}\"",
4893 // Max value for the unicode escape 4889 // Max value for the unicode escape
4894 "\"\\u{10ffff}\"", 4890 "\"\\u{10ffff}\"",
4895 NULL}; 4891 NULL};
4896 static const ParserFlag always_flags[] = {kAllowHarmonyUnicode}; 4892 RunParserSyncTest(context_data, data, kSuccess);
4897 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
4898 arraysize(always_flags));
4899 } 4893 }
4900 4894
4901 4895
4902 TEST(ScanTemplateLiterals) { 4896 TEST(ScanTemplateLiterals) {
4903 const char* context_data[][2] = {{"'use strict';", ""}, 4897 const char* context_data[][2] = {{"'use strict';", ""},
4904 {"function foo(){ 'use strict';" 4898 {"function foo(){ 'use strict';"
4905 " var a, b, c; return ", "}"}, 4899 " var a, b, c; return ", "}"},
4906 {NULL, NULL}}; 4900 {NULL, NULL}};
4907 4901
4908 const char* data[] = { 4902 const char* data[] = {
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
6841 "for (let x of []) {}", 6835 "for (let x of []) {}",
6842 NULL 6836 NULL
6843 }; 6837 };
6844 // clang-format on 6838 // clang-format on
6845 6839
6846 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, 6840 static const ParserFlag always_flags[] = {kAllowHarmonySloppy,
6847 kAllowHarmonySloppyLet}; 6841 kAllowHarmonySloppyLet};
6848 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, 6842 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
6849 arraysize(always_flags)); 6843 arraysize(always_flags));
6850 } 6844 }
OLDNEW
« src/scanner.cc ('K') | « src/scanner.cc ('k') | test/mjsunit/es6/templates.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698