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 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 | 1119 |
1120 i::Handle<i::Script> script = factory->NewScript(source_code); | 1120 i::Handle<i::Script> script = factory->NewScript(source_code); |
1121 | 1121 |
1122 i::ParseInfo info(handles.main_zone(), script); | 1122 i::ParseInfo info(handles.main_zone(), script); |
1123 i::Parser parser(&info); | 1123 i::Parser parser(&info); |
1124 info.set_global(); | 1124 info.set_global(); |
1125 info.set_lazy(false); | 1125 info.set_lazy(false); |
1126 info.set_allow_lazy_parsing(false); | 1126 info.set_allow_lazy_parsing(false); |
1127 info.set_toplevel(true); | 1127 info.set_toplevel(true); |
1128 | 1128 |
1129 i::CompilationInfo compilation_info(&info); | |
1130 CHECK(i::Compiler::ParseAndAnalyze(&info)); | 1129 CHECK(i::Compiler::ParseAndAnalyze(&info)); |
1131 | 1130 |
1132 CHECK(info.scope()->declarations()->length() == 1); | 1131 CHECK(info.scope()->declarations()->length() == 1); |
1133 i::FunctionLiteral* fun = | 1132 i::FunctionLiteral* fun = |
1134 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); | 1133 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); |
1135 CHECK(fun->body()->length() == 1); | 1134 CHECK(fun->body()->length() == 1); |
1136 CHECK(fun->body()->at(0)->IsReturnStatement()); | 1135 CHECK(fun->body()->at(0)->IsReturnStatement()); |
1137 i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement(); | 1136 i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement(); |
1138 i::Literal* lit = ret->expression()->AsLiteral(); | 1137 i::Literal* lit = ret->expression()->AsLiteral(); |
1139 if (lit != NULL) { | 1138 if (lit != NULL) { |
(...skipping 6084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7224 // "Array() **= 10", | 7223 // "Array() **= 10", |
7225 NULL | 7224 NULL |
7226 }; | 7225 }; |
7227 // clang-format on | 7226 // clang-format on |
7228 | 7227 |
7229 static const ParserFlag always_flags[] = { | 7228 static const ParserFlag always_flags[] = { |
7230 kAllowHarmonyExponentiationOperator}; | 7229 kAllowHarmonyExponentiationOperator}; |
7231 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, | 7230 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, |
7232 arraysize(always_flags)); | 7231 arraysize(always_flags)); |
7233 } | 7232 } |
OLD | NEW |