Reviewers: rossberg,
Message:
Something to consider as prompted by Andreas. This only changes the
behavior of
the interactive shell, so running test cases is not affected by this change.
This is how it would look like, rather ugly imo:
yangguo@linea:~/localhome/v8$ ./d8
V8 version 3.5.9 (candidate) [console: dumb]
d8> var a
<undefined>
d8> a
<undefined>
d8> function a() { return 2}
<undefined>
d8> a
function a() { return 2}
d8> a()
2
d8> void 0
<undefined>
Description:
Print <undefined> in d8 when used as interactive shell.
Please review this at http://codereview.chromium.org/7753028/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/d8.cc
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index
120496eccce5921f887eafadf6ebd71e59867edc..6ce7cd1625d99b6dd6887e8f23fd678c332436ff
100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -172,7 +172,10 @@ bool Shell::ExecuteString(Handle<String> source,
return false;
} else {
ASSERT(!try_catch.HasCaught());
- if (print_result && !result->IsUndefined()) {
+ if (!print_result) return true;
+ if (result->IsUndefined()) {
+ printf("<undefined>\n");
+ } else {
// If all went well and the result wasn't undefined then print
// the returned value.
v8::String::Utf8Value str(result);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev