[seed] REPL: Avoid printing out the results of simple assignments. Also do not print out things that return



commit 45f6834e6b3d30ac6a64784f721f5d56f7880628
Author: Robert Carr <racarr svn gnome org>
Date:   Mon May 11 02:06:33 2009 -0400

    REPL: Avoid printing out the results of simple assignments. Also do not print out things that return undefined
---
 examples/repl.js |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/examples/repl.js b/examples/repl.js
index ad410d6..db5f66f 100755
--- a/examples/repl.js
+++ b/examples/repl.js
@@ -32,10 +32,15 @@ readline.bind('\t', function(){
     readline.insert("\t");
 });
 
+var re = /[^=<>*-^/]=[^=<>*-^/]\s*(\s*new\s*)?[^:punct:]|'|"+$/
+
 while(1){
     try{
 	item = readline.readline("> ");
-	Seed.print(context.eval(item));
+	result = context.eval(item);
+	if (!re.exec(item) && (result != undefined))
+	    Seed.print(result)
+
     }
     catch(e){
 	Seed.print(e.name + " " + e.message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]