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

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

Issue 501323002: Replace our homegrown ARRAY_SIZE() with Chrome's arraysize(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Removing characters will make keyword matching fail. 80 // Removing characters will make keyword matching fail.
81 { 81 {
82 i::Utf8ToUtf16CharacterStream stream(keyword, length - 1); 82 i::Utf8ToUtf16CharacterStream stream(keyword, length - 1);
83 i::Scanner scanner(&unicode_cache); 83 i::Scanner scanner(&unicode_cache);
84 scanner.Initialize(&stream); 84 scanner.Initialize(&stream);
85 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); 85 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
86 CHECK_EQ(i::Token::EOS, scanner.Next()); 86 CHECK_EQ(i::Token::EOS, scanner.Next());
87 } 87 }
88 // Adding characters will make keyword matching fail. 88 // Adding characters will make keyword matching fail.
89 static const char chars_to_append[] = { 'z', '0', '_' }; 89 static const char chars_to_append[] = { 'z', '0', '_' };
90 for (int j = 0; j < static_cast<int>(ARRAY_SIZE(chars_to_append)); ++j) { 90 for (int j = 0; j < static_cast<int>(arraysize(chars_to_append)); ++j) {
91 i::MemMove(buffer, keyword, length); 91 i::MemMove(buffer, keyword, length);
92 buffer[length] = chars_to_append[j]; 92 buffer[length] = chars_to_append[j];
93 i::Utf8ToUtf16CharacterStream stream(buffer, length + 1); 93 i::Utf8ToUtf16CharacterStream stream(buffer, length + 1);
94 i::Scanner scanner(&unicode_cache); 94 i::Scanner scanner(&unicode_cache);
95 scanner.Initialize(&stream); 95 scanner.Initialize(&stream);
96 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); 96 CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
97 CHECK_EQ(i::Token::EOS, scanner.Next()); 97 CHECK_EQ(i::Token::EOS, scanner.Next());
98 } 98 }
99 // Replacing characters will make keyword matching fail. 99 // Replacing characters will make keyword matching fail.
100 { 100 {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 "function this_is_lazy() { var a; } function foo() { return 25; } foo();", 258 "function this_is_lazy() { var a; } function foo() { return 25; } foo();",
259 "var this_is_lazy = () => { var a; }; var foo = () => 25; foo();", 259 "var this_is_lazy = () => { var a; }; var foo = () => 25; foo();",
260 }; 260 };
261 261
262 // Insert a syntax error inside the lazy function. 262 // Insert a syntax error inside the lazy function.
263 const char* bad_code[] = { 263 const char* bad_code[] = {
264 "function this_is_lazy() { if ( } function foo() { return 25; } foo();", 264 "function this_is_lazy() { if ( } function foo() { return 25; } foo();",
265 "var this_is_lazy = () => { if ( }; var foo = () => 25; foo();", 265 "var this_is_lazy = () => { if ( }; var foo = () => 25; foo();",
266 }; 266 };
267 267
268 for (unsigned i = 0; i < ARRAY_SIZE(good_code); i++) { 268 for (unsigned i = 0; i < arraysize(good_code); i++) {
269 v8::ScriptCompiler::Source good_source(v8_str(good_code[i])); 269 v8::ScriptCompiler::Source good_source(v8_str(good_code[i]));
270 v8::ScriptCompiler::Compile(isolate, &good_source, 270 v8::ScriptCompiler::Compile(isolate, &good_source,
271 v8::ScriptCompiler::kProduceDataToCache); 271 v8::ScriptCompiler::kProduceDataToCache);
272 272
273 const v8::ScriptCompiler::CachedData* cached_data = 273 const v8::ScriptCompiler::CachedData* cached_data =
274 good_source.GetCachedData(); 274 good_source.GetCachedData();
275 CHECK(cached_data->data != NULL); 275 CHECK(cached_data->data != NULL);
276 CHECK_GT(cached_data->length, 0); 276 CHECK_GT(cached_data->length, 0);
277 277
278 // Now compile the erroneous code with the good preparse data. If the 278 // Now compile the erroneous code with the good preparse data. If the
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 1452
1453 // Plug the source code pieces together. 1453 // Plug the source code pieces together.
1454 i::ScopedVector<char> program(kProgramSize + 1); 1454 i::ScopedVector<char> program(kProgramSize + 1);
1455 int length = i::SNPrintF(program, 1455 int length = i::SNPrintF(program,
1456 "label: for (;;) { %s%s%s%s }", 1456 "label: for (;;) { %s%s%s%s }",
1457 context_data[i][0], 1457 context_data[i][0],
1458 statement_data[j], 1458 statement_data[j],
1459 termination_data[k], 1459 termination_data[k],
1460 context_data[i][1]); 1460 context_data[i][1]);
1461 CHECK(length == kProgramSize); 1461 CHECK(length == kProgramSize);
1462 TestParserSync(program.start(), flags1, ARRAY_SIZE(flags1)); 1462 TestParserSync(program.start(), flags1, arraysize(flags1));
1463 } 1463 }
1464 } 1464 }
1465 } 1465 }
1466 1466
1467 // Neither Harmony numeric literals nor our natives syntax have any 1467 // Neither Harmony numeric literals nor our natives syntax have any
1468 // interaction with the flags above, so test these separately to reduce 1468 // interaction with the flags above, so test these separately to reduce
1469 // the combinatorial explosion. 1469 // the combinatorial explosion.
1470 static const ParserFlag flags2[] = { kAllowHarmonyNumericLiterals }; 1470 static const ParserFlag flags2[] = { kAllowHarmonyNumericLiterals };
1471 TestParserSync("0o1234", flags2, ARRAY_SIZE(flags2)); 1471 TestParserSync("0o1234", flags2, arraysize(flags2));
1472 TestParserSync("0b1011", flags2, ARRAY_SIZE(flags2)); 1472 TestParserSync("0b1011", flags2, arraysize(flags2));
1473 1473
1474 static const ParserFlag flags3[] = { kAllowNativesSyntax }; 1474 static const ParserFlag flags3[] = { kAllowNativesSyntax };
1475 TestParserSync("%DebugPrint(123)", flags3, ARRAY_SIZE(flags3)); 1475 TestParserSync("%DebugPrint(123)", flags3, arraysize(flags3));
1476 } 1476 }
1477 1477
1478 1478
1479 TEST(StrictOctal) { 1479 TEST(StrictOctal) {
1480 // Test that syntax error caused by octal literal is reported correctly as 1480 // Test that syntax error caused by octal literal is reported correctly as
1481 // such (issue 2220). 1481 // such (issue 2220).
1482 v8::V8::Initialize(); 1482 v8::V8::Initialize();
1483 v8::HandleScope scope(CcTest::isolate()); 1483 v8::HandleScope scope(CcTest::isolate());
1484 v8::Context::Scope context_scope( 1484 v8::Context::Scope context_scope(
1485 v8::Context::New(CcTest::isolate())); 1485 v8::Context::New(CcTest::isolate()));
(...skipping 27 matching lines...) Expand all
1513 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() - 1513 CcTest::i_isolate()->stack_guard()->SetStackLimit(GetCurrentStackPosition() -
1514 128 * 1024); 1514 128 * 1024);
1515 1515
1516 static const ParserFlag default_flags[] = { 1516 static const ParserFlag default_flags[] = {
1517 kAllowLazy, kAllowHarmonyScoping, kAllowModules, 1517 kAllowLazy, kAllowHarmonyScoping, kAllowModules,
1518 kAllowGenerators, kAllowNativesSyntax, kAllowArrowFunctions, 1518 kAllowGenerators, kAllowNativesSyntax, kAllowArrowFunctions,
1519 kAllowClasses}; 1519 kAllowClasses};
1520 ParserFlag* generated_flags = NULL; 1520 ParserFlag* generated_flags = NULL;
1521 if (flags == NULL) { 1521 if (flags == NULL) {
1522 flags = default_flags; 1522 flags = default_flags;
1523 flags_len = ARRAY_SIZE(default_flags); 1523 flags_len = arraysize(default_flags);
1524 if (always_true_flags != NULL) { 1524 if (always_true_flags != NULL) {
1525 // Remove always_true_flags from default_flags. 1525 // Remove always_true_flags from default_flags.
1526 CHECK(always_true_flags_len < flags_len); 1526 CHECK(always_true_flags_len < flags_len);
1527 generated_flags = new ParserFlag[flags_len - always_true_flags_len]; 1527 generated_flags = new ParserFlag[flags_len - always_true_flags_len];
1528 int flag_index = 0; 1528 int flag_index = 0;
1529 for (int i = 0; i < flags_len; ++i) { 1529 for (int i = 0; i < flags_len; ++i) {
1530 bool use_flag = true; 1530 bool use_flag = true;
1531 for (int j = 0; j < always_true_flags_len; ++j) { 1531 for (int j = 0; j < always_true_flags_len; ++j) {
1532 if (flags[i] == always_true_flags[j]) { 1532 if (flags[i] == always_true_flags[j]) {
1533 use_flag = false; 1533 use_flag = false;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 "var foo = arguments;", 1663 "var foo = arguments;",
1664 "var foo = { eval: 1 };", 1664 "var foo = { eval: 1 };",
1665 "var foo = { arguments: 1 };", 1665 "var foo = { arguments: 1 };",
1666 "var foo = { }; foo.eval = {};", 1666 "var foo = { }; foo.eval = {};",
1667 "var foo = { }; foo.arguments = {};", 1667 "var foo = { }; foo.arguments = {};",
1668 NULL 1668 NULL
1669 }; 1669 };
1670 1670
1671 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; 1671 static const ParserFlag always_flags[] = {kAllowArrowFunctions};
1672 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 1672 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
1673 always_flags, ARRAY_SIZE(always_flags)); 1673 always_flags, arraysize(always_flags));
1674 } 1674 }
1675 1675
1676 1676
1677 TEST(ErrorsFutureStrictReservedWords) { 1677 TEST(ErrorsFutureStrictReservedWords) {
1678 // Tests that both preparsing and parsing produce the right kind of errors for 1678 // Tests that both preparsing and parsing produce the right kind of errors for
1679 // using future strict reserved words as identifiers. Without the strict mode, 1679 // using future strict reserved words as identifiers. Without the strict mode,
1680 // it's ok to use future strict reserved words as identifiers. With the strict 1680 // it's ok to use future strict reserved words as identifiers. With the strict
1681 // mode, it isn't. 1681 // mode, it isn't.
1682 const char* context_data[][2] = { 1682 const char* context_data[][2] = {
1683 { "\"use strict\";", "" }, 1683 { "\"use strict\";", "" },
(...skipping 12 matching lines...) Expand all
1696 "interface = 1;", 1696 "interface = 1;",
1697 "var foo = interface = 1;", 1697 "var foo = interface = 1;",
1698 "++interface;", 1698 "++interface;",
1699 "interface++;", 1699 "interface++;",
1700 "var yield = 13;", 1700 "var yield = 13;",
1701 NULL 1701 NULL
1702 }; 1702 };
1703 1703
1704 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; 1704 static const ParserFlag always_flags[] = {kAllowArrowFunctions};
1705 RunParserSyncTest(context_data, statement_data, kError, NULL, 0, always_flags, 1705 RunParserSyncTest(context_data, statement_data, kError, NULL, 0, always_flags,
1706 ARRAY_SIZE(always_flags)); 1706 arraysize(always_flags));
1707 } 1707 }
1708 1708
1709 1709
1710 TEST(NoErrorsFutureStrictReservedWords) { 1710 TEST(NoErrorsFutureStrictReservedWords) {
1711 const char* context_data[][2] = { 1711 const char* context_data[][2] = {
1712 { "", "" }, 1712 { "", "" },
1713 { "function test_func() {", "}"}, 1713 { "function test_func() {", "}"},
1714 { "() => {", "}" }, 1714 { "() => {", "}" },
1715 { NULL, NULL } 1715 { NULL, NULL }
1716 }; 1716 };
1717 1717
1718 const char* statement_data[] = { 1718 const char* statement_data[] = {
1719 "var interface;", 1719 "var interface;",
1720 "var foo, interface;", 1720 "var foo, interface;",
1721 "try { } catch (interface) { }", 1721 "try { } catch (interface) { }",
1722 "function interface() { }", 1722 "function interface() { }",
1723 "function foo(interface) { }", 1723 "function foo(interface) { }",
1724 "function foo(bar, interface) { }", 1724 "function foo(bar, interface) { }",
1725 "interface = 1;", 1725 "interface = 1;",
1726 "var foo = interface = 1;", 1726 "var foo = interface = 1;",
1727 "++interface;", 1727 "++interface;",
1728 "interface++;", 1728 "interface++;",
1729 "var yield = 13;", 1729 "var yield = 13;",
1730 NULL 1730 NULL
1731 }; 1731 };
1732 1732
1733 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; 1733 static const ParserFlag always_flags[] = {kAllowArrowFunctions};
1734 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 1734 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
1735 always_flags, ARRAY_SIZE(always_flags)); 1735 always_flags, arraysize(always_flags));
1736 } 1736 }
1737 1737
1738 1738
1739 TEST(ErrorsReservedWords) { 1739 TEST(ErrorsReservedWords) {
1740 // Tests that both preparsing and parsing produce the right kind of errors for 1740 // Tests that both preparsing and parsing produce the right kind of errors for
1741 // using future reserved words as identifiers. These tests don't depend on the 1741 // using future reserved words as identifiers. These tests don't depend on the
1742 // strict mode. 1742 // strict mode.
1743 const char* context_data[][2] = { 1743 const char* context_data[][2] = {
1744 { "", "" }, 1744 { "", "" },
1745 { "\"use strict\";", "" }, 1745 { "\"use strict\";", "" },
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 2150
2151 const char* statement_data[] = { 2151 const char* statement_data[] = {
2152 "mylabel: while(true) { break mylabel; }", 2152 "mylabel: while(true) { break mylabel; }",
2153 "eval: while(true) { break eval; }", 2153 "eval: while(true) { break eval; }",
2154 "arguments: while(true) { break arguments; }", 2154 "arguments: while(true) { break arguments; }",
2155 NULL 2155 NULL
2156 }; 2156 };
2157 2157
2158 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; 2158 static const ParserFlag always_flags[] = {kAllowArrowFunctions};
2159 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 2159 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
2160 always_flags, ARRAY_SIZE(always_flags)); 2160 always_flags, arraysize(always_flags));
2161 } 2161 }
2162 2162
2163 2163
2164 TEST(ErrorsParenthesizedLabels) { 2164 TEST(ErrorsParenthesizedLabels) {
2165 // Parenthesized identifiers shouldn't be recognized as labels. 2165 // Parenthesized identifiers shouldn't be recognized as labels.
2166 const char* context_data[][2] = { 2166 const char* context_data[][2] = {
2167 { "", ""}, 2167 { "", ""},
2168 { "function test_func() {", "}" }, 2168 { "function test_func() {", "}" },
2169 { "() => {", "}" }, 2169 { "() => {", "}" },
2170 { NULL, NULL } 2170 { NULL, NULL }
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 { "(function(x) { eval(''); })", true, false }, 3091 { "(function(x) { eval(''); })", true, false },
3092 }; 3092 };
3093 3093
3094 // Used to trigger lazy compilation of function 3094 // Used to trigger lazy compilation of function
3095 int comment_len = 2048; 3095 int comment_len = 2048;
3096 i::ScopedVector<char> comment(comment_len + 1); 3096 i::ScopedVector<char> comment(comment_len + 1);
3097 i::SNPrintF(comment, "/*%0*d*/", comment_len - 4, 0); 3097 i::SNPrintF(comment, "/*%0*d*/", comment_len - 4, 0);
3098 int prefix_len = Utf8LengthHelper(prefix); 3098 int prefix_len = Utf8LengthHelper(prefix);
3099 int midfix_len = Utf8LengthHelper(midfix); 3099 int midfix_len = Utf8LengthHelper(midfix);
3100 int suffix_len = Utf8LengthHelper(suffix); 3100 int suffix_len = Utf8LengthHelper(suffix);
3101 for (unsigned i = 0; i < ARRAY_SIZE(outers); ++i) { 3101 for (unsigned i = 0; i < arraysize(outers); ++i) {
3102 const char* outer = outers[i].source; 3102 const char* outer = outers[i].source;
3103 int outer_len = Utf8LengthHelper(outer); 3103 int outer_len = Utf8LengthHelper(outer);
3104 for (unsigned j = 0; j < ARRAY_SIZE(inners); ++j) { 3104 for (unsigned j = 0; j < arraysize(inners); ++j) {
3105 for (unsigned outer_lazy = 0; outer_lazy < 2; ++outer_lazy) { 3105 for (unsigned outer_lazy = 0; outer_lazy < 2; ++outer_lazy) {
3106 for (unsigned inner_lazy = 0; inner_lazy < 2; ++inner_lazy) { 3106 for (unsigned inner_lazy = 0; inner_lazy < 2; ++inner_lazy) {
3107 if (outers[i].strict && inners[j].with) continue; 3107 if (outers[i].strict && inners[j].with) continue;
3108 const char* inner = inners[j].source; 3108 const char* inner = inners[j].source;
3109 int inner_len = Utf8LengthHelper(inner); 3109 int inner_len = Utf8LengthHelper(inner);
3110 3110
3111 int outer_comment_len = outer_lazy ? comment_len : 0; 3111 int outer_comment_len = outer_lazy ? comment_len : 0;
3112 int inner_comment_len = inner_lazy ? comment_len : 0; 3112 int inner_comment_len = inner_lazy ? comment_len : 0;
3113 const char* outer_comment = outer_lazy ? comment.start() : ""; 3113 const char* outer_comment = outer_lazy ? comment.start() : "";
3114 const char* inner_comment = inner_lazy ? comment.start() : ""; 3114 const char* inner_comment = inner_lazy ? comment.start() : "";
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
3273 "(foo ? bar : baz, a) => {}", 3273 "(foo ? bar : baz, a) => {}",
3274 NULL 3274 NULL
3275 }; 3275 };
3276 3276
3277 // The test is quite slow, so run it with a reduced set of flags. 3277 // The test is quite slow, so run it with a reduced set of flags.
3278 static const ParserFlag flags[] = { 3278 static const ParserFlag flags[] = {
3279 kAllowLazy, kAllowHarmonyScoping, kAllowGenerators 3279 kAllowLazy, kAllowHarmonyScoping, kAllowGenerators
3280 }; 3280 };
3281 static const ParserFlag always_flags[] = { kAllowArrowFunctions }; 3281 static const ParserFlag always_flags[] = { kAllowArrowFunctions };
3282 RunParserSyncTest(context_data, statement_data, kError, flags, 3282 RunParserSyncTest(context_data, statement_data, kError, flags,
3283 ARRAY_SIZE(flags), always_flags, ARRAY_SIZE(always_flags)); 3283 arraysize(flags), always_flags, arraysize(always_flags));
3284 } 3284 }
3285 3285
3286 3286
3287 TEST(NoErrorsArrowFunctions) { 3287 TEST(NoErrorsArrowFunctions) {
3288 // Tests that parser and preparser accept valid arrow functions syntax. 3288 // Tests that parser and preparser accept valid arrow functions syntax.
3289 const char* context_data[][2] = { 3289 const char* context_data[][2] = {
3290 {"", ";"}, 3290 {"", ";"},
3291 {"bar ? (", ") : baz;"}, 3291 {"bar ? (", ") : baz;"},
3292 {"bar ? baz : (", ");"}, 3292 {"bar ? baz : (", ");"},
3293 {"bar, ", ";"}, 3293 {"bar, ", ";"},
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3327 "((a, b) => {}, (a => a + 1))", 3327 "((a, b) => {}, (a => a + 1))",
3328 "(a, (a, (b, c) => 0))", 3328 "(a, (a, (b, c) => 0))",
3329 3329
3330 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {}) 3330 // Arrow has more precedence, this is the same as: foo ? bar : (baz = {})
3331 "foo ? bar : baz => {}", 3331 "foo ? bar : baz => {}",
3332 NULL 3332 NULL
3333 }; 3333 };
3334 3334
3335 static const ParserFlag always_flags[] = {kAllowArrowFunctions}; 3335 static const ParserFlag always_flags[] = {kAllowArrowFunctions};
3336 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 3336 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
3337 always_flags, ARRAY_SIZE(always_flags)); 3337 always_flags, arraysize(always_flags));
3338 } 3338 }
3339 3339
3340 3340
3341 TEST(NoErrorsSuper) { 3341 TEST(NoErrorsSuper) {
3342 // Tests that parser and preparser accept 'super' keyword in right places. 3342 // Tests that parser and preparser accept 'super' keyword in right places.
3343 const char* context_data[][2] = {{"", ";"}, 3343 const char* context_data[][2] = {{"", ";"},
3344 {"k = ", ";"}, 3344 {"k = ", ";"},
3345 {"foo(", ");"}, 3345 {"foo(", ");"},
3346 {NULL, NULL}}; 3346 {NULL, NULL}};
3347 3347
3348 const char* statement_data[] = { 3348 const char* statement_data[] = {
3349 "super.x", 3349 "super.x",
3350 "super[27]", 3350 "super[27]",
3351 "new super", 3351 "new super",
3352 "new super()", 3352 "new super()",
3353 "new super(12, 45)", 3353 "new super(12, 45)",
3354 "new new super", 3354 "new new super",
3355 "new new super()", 3355 "new new super()",
3356 "new new super()()", 3356 "new new super()()",
3357 "z.super", // Ok, property lookup. 3357 "z.super", // Ok, property lookup.
3358 NULL}; 3358 NULL};
3359 3359
3360 static const ParserFlag always_flags[] = {kAllowClasses}; 3360 static const ParserFlag always_flags[] = {kAllowClasses};
3361 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, 3361 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
3362 always_flags, ARRAY_SIZE(always_flags)); 3362 always_flags, arraysize(always_flags));
3363 } 3363 }
3364 3364
3365 3365
3366 TEST(ErrorsSuper) { 3366 TEST(ErrorsSuper) {
3367 // Tests that parser and preparser generate same errors for 'super'. 3367 // Tests that parser and preparser generate same errors for 'super'.
3368 const char* context_data[][2] = {{"", ";"}, 3368 const char* context_data[][2] = {{"", ";"},
3369 {"k = ", ";"}, 3369 {"k = ", ";"},
3370 {"foo(", ");"}, 3370 {"foo(", ");"},
3371 {NULL, NULL}}; 3371 {NULL, NULL}};
3372 3372
3373 const char* statement_data[] = { 3373 const char* statement_data[] = {
3374 "super = x", 3374 "super = x",
3375 "y = super", 3375 "y = super",
3376 "f(super)", 3376 "f(super)",
3377 NULL}; 3377 NULL};
3378 3378
3379 static const ParserFlag always_flags[] = {kAllowClasses}; 3379 static const ParserFlag always_flags[] = {kAllowClasses};
3380 RunParserSyncTest(context_data, statement_data, kError, NULL, 0, 3380 RunParserSyncTest(context_data, statement_data, kError, NULL, 0,
3381 always_flags, ARRAY_SIZE(always_flags)); 3381 always_flags, arraysize(always_flags));
3382 } 3382 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698