lib/fasterer/method_call.rb in fasterer-0.1.10 vs lib/fasterer/method_call.rb in fasterer-0.1.11
- old
+ new
@@ -86,10 +86,12 @@
case receiver_info.sexp_type
when :lvar
return VariableReference.new(receiver_info)
when :call, :iter
return MethodCall.new(receiver_info)
+ when :array, :dot2, :dot3, :lit
+ return Primitive.new(receiver_info)
end
end
end
class VariableReference
@@ -112,8 +114,28 @@
@type ||= @element[0]
end
def value
@value ||= @element[1]
+ end
+ end
+
+ class Primitive
+ attr_reader :element
+
+ def initialize(element)
+ @element = element
+ end
+
+ def type
+ @type ||= @element[0]
+ end
+
+ def range?
+ [:dot2, :dot3, :lit].include?(type)
+ end
+
+ def array?
+ type == :array
end
end
end