Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Side by Side Diff: src/d8.cc

Issue 7792055: Changed printing of immediate result in d8's interactive shell. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 && !result->IsUndefined()) {
176 // If all went well and the result wasn't undefined then print 176 // If all went well and the result wasn't undefined then print
177 // the returned value. 177 // the returned value.
178 v8::String::Utf8Value str(result); 178 v8::String::Utf8Value str(result);
179 const char* cstr = ToCString(str); 179 fwrite(*str, sizeof(**str), str.length(), stdout);
180 printf("%s\n", cstr); 180 printf("\n");
Yang 2011/09/01 12:04:06 Same behavior as Shell::Write now.
181 } 181 }
182 return true; 182 return true;
183 } 183 }
184 } 184 }
185 } 185 }
186 186
187 187
188 Handle<Value> Shell::Print(const Arguments& args) { 188 Handle<Value> Shell::Print(const Arguments& args) {
189 Handle<Value> val = Write(args); 189 Handle<Value> val = Write(args);
190 printf("\n"); 190 printf("\n");
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 } 1296 }
1297 1297
1298 } // namespace v8 1298 } // namespace v8
1299 1299
1300 1300
1301 #ifndef GOOGLE3 1301 #ifndef GOOGLE3
1302 int main(int argc, char* argv[]) { 1302 int main(int argc, char* argv[]) {
1303 return v8::Shell::Main(argc, argv); 1303 return v8::Shell::Main(argc, argv);
1304 } 1304 }
1305 #endif 1305 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698