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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 full_source += "; }"; | 906 full_source += "; }"; |
907 | 907 |
908 i::Handle<i::String> source_code = | 908 i::Handle<i::String> source_code = |
909 factory->NewStringFromUtf8(i::CStrVector(full_source.c_str())) | 909 factory->NewStringFromUtf8(i::CStrVector(full_source.c_str())) |
910 .ToHandleChecked(); | 910 .ToHandleChecked(); |
911 | 911 |
912 i::Handle<i::Script> script = factory->NewScript(source_code); | 912 i::Handle<i::Script> script = factory->NewScript(source_code); |
913 | 913 |
914 i::ParseInfo info(handles.main_zone(), script); | 914 i::ParseInfo info(handles.main_zone(), script); |
915 i::Parser parser(&info); | 915 i::Parser parser(&info); |
916 info.set_lazy(false); | |
917 info.set_allow_lazy_parsing(false); | 916 info.set_allow_lazy_parsing(false); |
918 info.set_toplevel(true); | 917 info.set_toplevel(true); |
919 | 918 |
920 CHECK(i::Compiler::ParseAndAnalyze(&info)); | 919 CHECK(i::Compiler::ParseAndAnalyze(&info)); |
921 | 920 |
922 CHECK(info.scope()->declarations()->length() == 1); | 921 CHECK(info.scope()->declarations()->length() == 1); |
923 i::FunctionLiteral* fun = | 922 i::FunctionLiteral* fun = |
924 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); | 923 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); |
925 CHECK(fun->body()->length() == 1); | 924 CHECK(fun->body()->length() == 1); |
926 CHECK(fun->body()->at(0)->IsReturnStatement()); | 925 CHECK(fun->body()->at(0)->IsReturnStatement()); |
(...skipping 7395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8322 const char* data[] = { | 8321 const char* data[] = { |
8323 "const arguments = 1", | 8322 "const arguments = 1", |
8324 "let arguments", | 8323 "let arguments", |
8325 "var arguments", | 8324 "var arguments", |
8326 NULL | 8325 NULL |
8327 }; | 8326 }; |
8328 // clang-format on | 8327 // clang-format on |
8329 RunParserSyncTest(context_data, data, kSuccess); | 8328 RunParserSyncTest(context_data, data, kSuccess); |
8330 } | 8329 } |
8331 } | 8330 } |
OLD | NEW |