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

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

Issue 2065453002: [module] Track script "module code" status Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
« test/cctest/test-api.cc ('K') | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 i::PreParser::PreParseResult result = 1565 i::PreParser::PreParseResult result =
1566 preparser.PreParseProgram(&preparser_materialized_literals, is_module); 1566 preparser.PreParseProgram(&preparser_materialized_literals, is_module);
1567 CHECK_EQ(i::PreParser::kPreParseSuccess, result); 1567 CHECK_EQ(i::PreParser::kPreParseSuccess, result);
1568 } 1568 }
1569 bool preparse_error = log.HasError(); 1569 bool preparse_error = log.HasError();
1570 1570
1571 // Parse the data 1571 // Parse the data
1572 i::FunctionLiteral* function; 1572 i::FunctionLiteral* function;
1573 { 1573 {
1574 i::Handle<i::Script> script = factory->NewScript(source); 1574 i::Handle<i::Script> script = factory->NewScript(source);
1575 script->set_is_module(is_module);
1575 i::Zone zone(CcTest::i_isolate()->allocator()); 1576 i::Zone zone(CcTest::i_isolate()->allocator());
1576 i::ParseInfo info(&zone, script); 1577 i::ParseInfo info(&zone, script);
1577 i::Parser parser(&info); 1578 i::Parser parser(&info);
1578 SetParserFlags(&parser, flags); 1579 SetParserFlags(&parser, flags);
1579 if (is_module) {
1580 info.set_module();
1581 } else {
1582 info.set_global();
1583 }
1584 parser.Parse(&info); 1580 parser.Parse(&info);
1585 function = info.literal(); 1581 function = info.literal();
1586 if (function) { 1582 if (function) {
1587 parser_materialized_literals = function->materialized_literal_count(); 1583 parser_materialized_literals = function->materialized_literal_count();
1588 } 1584 }
1589 } 1585 }
1590 1586
1591 // Check that preparsing fails iff parsing fails. 1587 // Check that preparsing fails iff parsing fails.
1592 if (function == NULL) { 1588 if (function == NULL) {
1593 // Extract exception from the parser. 1589 // Extract exception from the parser.
(...skipping 6190 matching lines...) Expand 10 before | Expand all | Expand 10 after
7784 NULL}; 7780 NULL};
7785 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; 7781 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait};
7786 // The preparser doesn't enforce the restriction, so turn it off. 7782 // The preparser doesn't enforce the restriction, so turn it off.
7787 bool test_preparser = false; 7783 bool test_preparser = false;
7788 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0, 7784 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0,
7789 always_flags, arraysize(always_flags), NULL, 0, false, 7785 always_flags, arraysize(always_flags), NULL, 0, false,
7790 test_preparser); 7786 test_preparser);
7791 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0, 7787 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0,
7792 always_flags, arraysize(always_flags)); 7788 always_flags, arraysize(always_flags));
7793 } 7789 }
OLDNEW
« test/cctest/test-api.cc ('K') | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698