Permalink
Browse files

Handle no-forms case in eval explicitly.

This way we avoid invoking the compiler (it used to call
eval_form(nil, file, line) when there were no forms).
  • Loading branch information...
1 parent e74e6a6 commit 0fd638ab3c6aa3dc21de2a18ef2650a331dd8623 Scott Olson committed Apr 25, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/apricot/compiler.rb
View
@@ -76,6 +76,8 @@ def eval_form(form, file = "(eval)", line = 1)
def eval(code, file = "(eval)", line = 1)
forms = Reader.read_string(code, file,line)
+ return nil if forms.empty?
+
forms[0..-2].each do |form|
eval_form(form, file, line)
end

0 comments on commit 0fd638a

Please sign in to comment.