repl: remove double calls where possible
authorFedor Indutny <fedor.indutny@gmail.com>
Fri, 17 Feb 2012 18:18:11 +0000 (00:18 +0600)
committerFedor Indutny <fedor.indutny@gmail.com>
Fri, 17 Feb 2012 18:30:52 +0000 (00:30 +0600)
commitae5e23310e64db99ddefbf4904f74a42906d6451
tree99515958dc5e7c922d0f81a5e63eb5dafdc6dc54
parentce485791db5507d160cbc204b8a58e770ac60a50
repl: remove double calls where possible

Repl is doing double evaluation of code: wrapped in parens and without
them. That's needed to allow users typing multiline chunks of code by
handling syntax errors on repl side. However if function declaration is
wrapped in parens (`(function a() {})`) calling it will be impossible,
so we're evaluating functions twice. That works fine for declaration,
but if entered code chunk returns function - it should not be called
twice.

fix #2773
lib/repl.js
test/simple/test-repl.js