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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 SetParserFlags(&parser, flags); | 1332 SetParserFlags(&parser, flags); |
1333 info.MarkAsGlobal(); | 1333 info.MarkAsGlobal(); |
1334 parser.Parse(); | 1334 parser.Parse(); |
1335 function = info.function(); | 1335 function = info.function(); |
1336 } | 1336 } |
1337 | 1337 |
1338 // Check that preparsing fails iff parsing fails. | 1338 // Check that preparsing fails iff parsing fails. |
1339 if (function == NULL) { | 1339 if (function == NULL) { |
1340 // Extract exception from the parser. | 1340 // Extract exception from the parser. |
1341 CHECK(isolate->has_pending_exception()); | 1341 CHECK(isolate->has_pending_exception()); |
1342 i::MaybeObject* maybe_object = isolate->pending_exception(); | 1342 i::Handle<i::JSObject> exception_handle( |
1343 i::JSObject* exception = NULL; | 1343 i::JSObject::cast(isolate->pending_exception())); |
1344 CHECK(maybe_object->To(&exception)); | |
1345 i::Handle<i::JSObject> exception_handle(exception); | |
1346 i::Handle<i::String> message_string = | 1344 i::Handle<i::String> message_string = |
1347 i::Handle<i::String>::cast(i::GetProperty(exception_handle, "message")); | 1345 i::Handle<i::String>::cast(i::GetProperty(exception_handle, "message")); |
1348 | 1346 |
1349 if (result == kSuccess) { | 1347 if (result == kSuccess) { |
1350 i::OS::Print( | 1348 i::OS::Print( |
1351 "Parser failed on:\n" | 1349 "Parser failed on:\n" |
1352 "\t%s\n" | 1350 "\t%s\n" |
1353 "with error:\n" | 1351 "with error:\n" |
1354 "\t%s\n" | 1352 "\t%s\n" |
1355 "However, we expected no error.", | 1353 "However, we expected no error.", |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); | 2568 RunParserSyncTest(assignment_context_data, bad_statement_data_common, kError); |
2571 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, | 2569 RunParserSyncTest(assignment_context_data, bad_statement_data_for_assignment, |
2572 kError); | 2570 kError); |
2573 | 2571 |
2574 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); | 2572 RunParserSyncTest(prefix_context_data, good_statement_data, kSuccess); |
2575 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); | 2573 RunParserSyncTest(prefix_context_data, bad_statement_data_common, kError); |
2576 | 2574 |
2577 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); | 2575 RunParserSyncTest(postfix_context_data, good_statement_data, kSuccess); |
2578 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); | 2576 RunParserSyncTest(postfix_context_data, bad_statement_data_common, kError); |
2579 } | 2577 } |
OLD | NEW |