102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/fable/native_function_call.rb', line 102
def call!(parameters)
if parameters.size != self.number_of_parameters
raise StoryError, "Unexpected number of parameters"
end
has_list = false
parameters.each do |parameter|
case parameter
when Void
raise StoryError, "Attempting to perform operation on a void value. Did you forget to 'return' a value from a function you called here?"
when ListValue
has_list = true
end
end
if parameters.size == 2 && has_list
return call_binary_list_operation(parameters)
end
coerced_parameters = coerce_values_to_single_type(parameters)
return underlying_function_call(coerced_parameters)
end
|