lib/delorean/engine.rb in delorean_lang-0.3.2 vs lib/delorean/engine.rb in delorean_lang-0.3.3
- old
+ new
@@ -187,10 +187,17 @@
def err(exc, msg)
raise exc.new(msg, @module_name, curr_line)
end
def parse_check_call_fn(fn, argcount, class_name=nil)
- klass = class_name ? parse_class(class_name) : (@m::BaseClass)
+ klass = case class_name
+ when nil
+ @m::BaseClass
+ when String
+ parse_class(class_name)
+ else
+ class_name
+ end
err(UndefinedFunctionError, "Function #{fn} not found") unless
klass.methods.member? fn.to_sym
# signature methods must be named FUNCTION_NAME_SIG