| Index: test/cctest/test-parsing.cc
|
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
|
| index 31651904e3a2ca7dc42862bba55188d9de89b1e6..939bd4bb8513bdbabb98890278863f4f6e215001 100644
|
| --- a/test/cctest/test-parsing.cc
|
| +++ b/test/cctest/test-parsing.cc
|
| @@ -1211,7 +1211,8 @@ enum ParserFlag {
|
| kAllowGenerators,
|
| kAllowHarmonyNumericLiterals,
|
| kAllowArrowFunctions,
|
| - kAllowClasses
|
| + kAllowClasses,
|
| + kAllowHarmonyObjectLiterals
|
| };
|
|
|
|
|
| @@ -1231,6 +1232,8 @@ void SetParserFlags(i::ParserBase<Traits>* parser,
|
| parser->set_allow_generators(flags.Contains(kAllowGenerators));
|
| parser->set_allow_harmony_numeric_literals(
|
| flags.Contains(kAllowHarmonyNumericLiterals));
|
| + parser->set_allow_harmony_object_literals(
|
| + flags.Contains(kAllowHarmonyObjectLiterals));
|
| parser->set_allow_arrow_functions(flags.Contains(kAllowArrowFunctions));
|
| parser->set_allow_classes(flags.Contains(kAllowClasses));
|
| }
|
| @@ -1437,9 +1440,11 @@ TEST(ParserSync) {
|
| CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
|
| 128 * 1024);
|
|
|
| - static const ParserFlag flags1[] = {kAllowLazy, kAllowHarmonyScoping,
|
| - kAllowModules, kAllowGenerators,
|
| - kAllowArrowFunctions};
|
| + static const ParserFlag flags1[] = {
|
| + kAllowLazy, kAllowHarmonyScoping,
|
| + kAllowModules, kAllowGenerators,
|
| + kAllowArrowFunctions, kAllowHarmonyNumericLiterals,
|
| + kAllowHarmonyObjectLiterals};
|
| for (int i = 0; context_data[i][0] != NULL; ++i) {
|
| for (int j = 0; statement_data[j] != NULL; ++j) {
|
| for (int k = 0; termination_data[k] != NULL; ++k) {
|
| @@ -1514,9 +1519,12 @@ void RunParserSyncTest(const char* context_data[][2],
|
| 128 * 1024);
|
|
|
| static const ParserFlag default_flags[] = {
|
| - kAllowLazy, kAllowHarmonyScoping, kAllowModules,
|
| - kAllowGenerators, kAllowNativesSyntax, kAllowArrowFunctions,
|
| - kAllowClasses};
|
| + kAllowArrowFunctions, kAllowClasses,
|
| + kAllowGenerators, kAllowHarmonyNumericLiterals,
|
| + kAllowHarmonyObjectLiterals, kAllowHarmonyScoping,
|
| + kAllowLazy, kAllowModules,
|
| + kAllowNativesSyntax,
|
| + };
|
| ParserFlag* generated_flags = NULL;
|
| if (flags == NULL) {
|
| flags = default_flags;
|
| @@ -3392,3 +3400,29 @@ TEST(ErrorsSuper) {
|
| RunParserSyncTest(context_data, statement_data, kError, NULL, 0,
|
| always_flags, ARRAY_SIZE(always_flags));
|
| }
|
| +
|
| +
|
| +TEST(NoErrorsMethodDefinition) {
|
| + const char* context_data[][2] = {{"({", "});"}, {NULL, NULL}};
|
| +
|
| + const char* statement_data[] = {"m() {}", "m(x) { return x; }",
|
| + "m(x, y) {}, n() {}", "set(x, y) {}",
|
| + "get(x, y) {}", NULL};
|
| +
|
| + static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals};
|
| + RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
|
| + always_flags, ARRAY_SIZE(always_flags));
|
| +}
|
| +
|
| +
|
| +TEST(MethodDefinitionNames) {
|
| + const char* context_data[][2] = {{"({", "(x, y) {}});"}, {NULL, NULL}};
|
| +
|
| + const char* statement_data[] = {"m", "'m'", "\"m\"", "true", "false",
|
| + "null", "0", "1.2", "1e1", "1E1",
|
| + "1e+1", "1e-1", NULL};
|
| +
|
| + static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals};
|
| + RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
|
| + always_flags, ARRAY_SIZE(always_flags));
|
| +}
|
|
|