| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } else { | 165 } else { |
| 166 Handle<Value> result = script->Run(); | 166 Handle<Value> result = script->Run(); |
| 167 if (result.IsEmpty()) { | 167 if (result.IsEmpty()) { |
| 168 ASSERT(try_catch.HasCaught()); | 168 ASSERT(try_catch.HasCaught()); |
| 169 // Print errors that happened during execution. | 169 // Print errors that happened during execution. |
| 170 if (report_exceptions && !FLAG_debugger) | 170 if (report_exceptions && !FLAG_debugger) |
| 171 ReportException(&try_catch); | 171 ReportException(&try_catch); |
| 172 return false; | 172 return false; |
| 173 } else { | 173 } else { |
| 174 ASSERT(!try_catch.HasCaught()); | 174 ASSERT(!try_catch.HasCaught()); |
| 175 if (print_result && !result->IsUndefined()) { | 175 if (!print_result) return true; |
| 176 if (result->IsUndefined()) { |
| 177 printf("<undefined>\n"); |
| 178 } else { |
| 176 // If all went well and the result wasn't undefined then print | 179 // If all went well and the result wasn't undefined then print |
| 177 // the returned value. | 180 // the returned value. |
| 178 v8::String::Utf8Value str(result); | 181 v8::String::Utf8Value str(result); |
| 179 const char* cstr = ToCString(str); | 182 const char* cstr = ToCString(str); |
| 180 printf("%s\n", cstr); | 183 printf("%s\n", cstr); |
| 181 } | 184 } |
| 182 return true; | 185 return true; |
| 183 } | 186 } |
| 184 } | 187 } |
| 185 } | 188 } |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 } | 1299 } |
| 1297 | 1300 |
| 1298 } // namespace v8 | 1301 } // namespace v8 |
| 1299 | 1302 |
| 1300 | 1303 |
| 1301 #ifndef GOOGLE3 | 1304 #ifndef GOOGLE3 |
| 1302 int main(int argc, char* argv[]) { | 1305 int main(int argc, char* argv[]) { |
| 1303 return v8::Shell::Main(argc, argv); | 1306 return v8::Shell::Main(argc, argv); |
| 1304 } | 1307 } |
| 1305 #endif | 1308 #endif |
| OLD | NEW |