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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 i::Handle<i::Script> script = factory->NewScript(source_code); | 1121 i::Handle<i::Script> script = factory->NewScript(source_code); |
1122 | 1122 |
1123 i::ParseInfo info(handles.main_zone(), script); | 1123 i::ParseInfo info(handles.main_zone(), script); |
1124 i::Parser parser(&info); | 1124 i::Parser parser(&info); |
1125 parser.set_allow_harmony_sloppy(true); | 1125 parser.set_allow_harmony_sloppy(true); |
1126 info.set_global(); | 1126 info.set_global(); |
1127 info.set_lazy(false); | 1127 info.set_lazy(false); |
1128 info.set_allow_lazy_parsing(false); | 1128 info.set_allow_lazy_parsing(false); |
1129 info.set_toplevel(true); | 1129 info.set_toplevel(true); |
1130 | 1130 |
1131 i::CompilationInfo compilation_info(&info); | |
1132 CHECK(i::Compiler::ParseAndAnalyze(&info)); | 1131 CHECK(i::Compiler::ParseAndAnalyze(&info)); |
1133 | 1132 |
1134 CHECK(info.scope()->declarations()->length() == 1); | 1133 CHECK(info.scope()->declarations()->length() == 1); |
1135 i::FunctionLiteral* fun = | 1134 i::FunctionLiteral* fun = |
1136 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); | 1135 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); |
1137 CHECK(fun->body()->length() == 1); | 1136 CHECK(fun->body()->length() == 1); |
1138 CHECK(fun->body()->at(0)->IsReturnStatement()); | 1137 CHECK(fun->body()->at(0)->IsReturnStatement()); |
1139 i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement(); | 1138 i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement(); |
1140 i::Literal* lit = ret->expression()->AsLiteral(); | 1139 i::Literal* lit = ret->expression()->AsLiteral(); |
1141 if (lit != NULL) { | 1140 if (lit != NULL) { |
(...skipping 6238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7380 // "Array() **= 10", | 7379 // "Array() **= 10", |
7381 NULL | 7380 NULL |
7382 }; | 7381 }; |
7383 // clang-format on | 7382 // clang-format on |
7384 | 7383 |
7385 static const ParserFlag always_flags[] = { | 7384 static const ParserFlag always_flags[] = { |
7386 kAllowHarmonyExponentiationOperator}; | 7385 kAllowHarmonyExponentiationOperator}; |
7387 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, | 7386 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, |
7388 arraysize(always_flags)); | 7387 arraysize(always_flags)); |
7389 } | 7388 } |
OLD | NEW |