| 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 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1568     i::PreParser::PreParseResult result = |  1568     i::PreParser::PreParseResult result = | 
|  1569         preparser.PreParseProgram(&preparser_materialized_literals, is_module); |  1569         preparser.PreParseProgram(&preparser_materialized_literals, is_module); | 
|  1570     CHECK_EQ(i::PreParser::kPreParseSuccess, result); |  1570     CHECK_EQ(i::PreParser::kPreParseSuccess, result); | 
|  1571   } |  1571   } | 
|  1572   bool preparse_error = log.HasError(); |  1572   bool preparse_error = log.HasError(); | 
|  1573  |  1573  | 
|  1574   // Parse the data |  1574   // Parse the data | 
|  1575   i::FunctionLiteral* function; |  1575   i::FunctionLiteral* function; | 
|  1576   { |  1576   { | 
|  1577     i::Handle<i::Script> script = factory->NewScript(source); |  1577     i::Handle<i::Script> script = factory->NewScript(source); | 
 |  1578     script->set_is_module(is_module); | 
|  1578     i::Zone zone(CcTest::i_isolate()->allocator()); |  1579     i::Zone zone(CcTest::i_isolate()->allocator()); | 
|  1579     i::ParseInfo info(&zone, script); |  1580     i::ParseInfo info(&zone, script); | 
|  1580     i::Parser parser(&info); |  1581     i::Parser parser(&info); | 
|  1581     SetParserFlags(&parser, flags); |  1582     SetParserFlags(&parser, flags); | 
|  1582     if (is_module) { |  1583     if (!is_module) { | 
|  1583       info.set_module(); |  | 
|  1584     } else { |  | 
|  1585       info.set_global(); |  1584       info.set_global(); | 
|  1586     } |  1585     } | 
|  1587     parser.Parse(&info); |  1586     parser.Parse(&info); | 
|  1588     function = info.literal(); |  1587     function = info.literal(); | 
|  1589     if (function) { |  1588     if (function) { | 
|  1590       parser_materialized_literals = function->materialized_literal_count(); |  1589       parser_materialized_literals = function->materialized_literal_count(); | 
|  1591     } |  1590     } | 
|  1592   } |  1591   } | 
|  1593  |  1592  | 
|  1594   // Check that preparsing fails iff parsing fails. |  1593   // Check that preparsing fails iff parsing fails. | 
| (...skipping 6345 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  7940     "(a,);", |  7939     "(a,);", | 
|  7941     "(a,b,c,);", |  7940     "(a,b,c,);", | 
|  7942     NULL |  7941     NULL | 
|  7943   }; |  7942   }; | 
|  7944   // clang-format on |  7943   // clang-format on | 
|  7945  |  7944  | 
|  7946   static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |  7945   static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 
|  7947   RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |  7946   RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 
|  7948                     arraysize(always_flags)); |  7947                     arraysize(always_flags)); | 
|  7949 } |  7948 } | 
| OLD | NEW |