Permalink
Browse files

Fix situation where not operator methods needed an argument

  • Loading branch information...
vidarh committed Sep 11, 2014
1 parent e31a44e commit 1d54cec485182349e8696efac912a6c0ad0c6468
Showing with 5 additions and 9 deletions.
  1. +1 −2 lib/core/false.rb
  2. +1 −1 lib/core/nil.rb
  3. +1 −2 lib/core/string.rb
  4. +1 −1 lib/core/true.rb
  5. +1 −3 transform.rb
View
@@ -9,8 +9,7 @@ def to_s
"false"
end
def ! *args
# FIXME: true is a keyword
def !
true
end
View
@@ -13,7 +13,7 @@ def nil?
true
end
def ! *args
def !
true
end
View
@@ -32,8 +32,7 @@ def initialize *str
)
end
# FIXME: Shouldnt need arg
def ! *arg
def !
false
end
View
@@ -1,7 +1,7 @@
class TrueClass
def ! x # FIXME: Why is it called with an argument?
def !
false
end
View
@@ -115,7 +115,7 @@ def rewrite_operators(exp)
next :skip if e[0] == :sexp
if e[0].is_a?(Symbol) && OPER_METHOD.member?(e[0].to_s)
e[3] = E[e[2]]
e[3] = E[e[2]] if e[2]
e[2] = e[0]
e[0] = :callm
end
@@ -210,7 +210,6 @@ def find_vars(e, scopes, env, freq, in_lambda = false, in_assign = false)
def rewrite_env_vars(exp, env)
exp.depth_first do |e|
STDERR.puts e.inspect
e.each_with_index do |ex, i|
num = env.index(ex)
if num
@@ -287,7 +286,6 @@ def rewrite_let_env(exp)
def rewrite_range(exp)
exp.depth_first do |e|
if e[0] == :range
STDERR.puts e.inspect
e.replace(E[:callm, :Range, :new, e[1..-1]])
end
:next

0 comments on commit 1d54cec

Please sign in to comment.