From 28a8c05513fdfc11425ac222afd1dc78f2e53601 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Wed, 17 Feb 2010 23:51:43 -0500 Subject: [PATCH] light refactor for repl.coffee --- lib/repl.js | 8 +++----- src/repl.coffee | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 34238e6e..18caaef0 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -3,7 +3,6 @@ // A CoffeeScript port/version of the Node.js REPL. // Required modules. coffee = require('coffee-script'); - process.mixin(require('sys')); // Shortcut variables. prompt = 'coffee> '; quit = function quit() { @@ -12,13 +11,12 @@ // The main REPL function. Called everytime a line of code is entered. // Attempt to evaluate the command. If there's an exception, print it. readline = function readline(code) { - var js, val; + var val; try { - js = coffee.compile(code, { + val = eval(coffee.compile(code, { no_wrap: true, globals: true - }); - val = eval(js); + })); if (val !== undefined) { p(val); } diff --git a/src/repl.coffee b/src/repl.coffee index 2195f548..064ebbdb 100644 --- a/src/repl.coffee +++ b/src/repl.coffee @@ -2,7 +2,6 @@ # Required modules. coffee: require 'coffee-script' -process.mixin require 'sys' # Shortcut variables. prompt: 'coffee> ' @@ -12,8 +11,7 @@ quit: -> process.exit(0) # Attempt to evaluate the command. If there's an exception, print it. readline: (code) -> try - js: coffee.compile code, {no_wrap: true, globals: true} - val: eval(js) + val: eval coffee.compile code, {no_wrap: true, globals: true} p val if val isnt undefined catch err puts err.stack or err.toString()