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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 | 1094 |
1095 // Check that preparsing fails iff parsing fails. | 1095 // Check that preparsing fails iff parsing fails. |
1096 if (function == NULL) { | 1096 if (function == NULL) { |
1097 // Extract exception from the parser. | 1097 // Extract exception from the parser. |
1098 CHECK(i::Isolate::Current()->has_pending_exception()); | 1098 CHECK(i::Isolate::Current()->has_pending_exception()); |
1099 i::MaybeObject* maybe_object = i::Isolate::Current()->pending_exception(); | 1099 i::MaybeObject* maybe_object = i::Isolate::Current()->pending_exception(); |
1100 i::JSObject* exception = NULL; | 1100 i::JSObject* exception = NULL; |
1101 CHECK(maybe_object->To(&exception)); | 1101 CHECK(maybe_object->To(&exception)); |
1102 i::Handle<i::JSObject> exception_handle(exception); | 1102 i::Handle<i::JSObject> exception_handle(exception); |
1103 i::Handle<i::String> message_string = | 1103 i::Handle<i::String> message_string = |
1104 i::GetProperty(exception_handle, "message"); | 1104 i::Handle<i::String>::cast(i::GetProperty(exception_handle, "message")); |
1105 | 1105 |
1106 if (!data.has_error()) { | 1106 if (!data.has_error()) { |
1107 i::OS::Print( | 1107 i::OS::Print( |
1108 "Parser failed on:\n" | 1108 "Parser failed on:\n" |
1109 "\t%s\n" | 1109 "\t%s\n" |
1110 "with error:\n" | 1110 "with error:\n" |
1111 "\t%s\n" | 1111 "\t%s\n" |
1112 "However, the preparser succeeded", | 1112 "However, the preparser succeeded", |
1113 *source->ToCString(), *message_string->ToCString()); | 1113 *source->ToCString(), *message_string->ToCString()); |
1114 CHECK(false); | 1114 CHECK(false); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 " b = function() { \n" | 1276 " b = function() { \n" |
1277 " 01; \n" | 1277 " 01; \n" |
1278 " }; \n" | 1278 " }; \n" |
1279 "}; \n"; | 1279 "}; \n"; |
1280 v8::Script::Compile(v8::String::New(script)); | 1280 v8::Script::Compile(v8::String::New(script)); |
1281 CHECK(try_catch.HasCaught()); | 1281 CHECK(try_catch.HasCaught()); |
1282 v8::String::Utf8Value exception(try_catch.Exception()); | 1282 v8::String::Utf8Value exception(try_catch.Exception()); |
1283 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", | 1283 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", |
1284 *exception); | 1284 *exception); |
1285 } | 1285 } |
OLD | NEW |