Skip to content

Instantly share code, notes, and snippets.

@joek13
Created August 18, 2017 15:58
Show Gist options
  • Save joek13/4829f0a37296dae42a2c432386bab891 to your computer and use it in GitHub Desktop.
Save joek13/4829f0a37296dae42a2c432386bab891 to your computer and use it in GitHub Desktop.
if let Some(value_or_func) = scope.find(&expression.function) {
if let &ValueOrFunc::Func(ref func) = value_or_func {
match *func {
Func::Builtin(f) => {
return f(scope, expression.parameters);
}
Func::UserDefined(ref block) => Ok(Value::Nil),
}
} else {
return Err(format!("'{}' is not callable", expression.function));
}
} else {
return Err(format!("Undeclared identifier '{}'", expression.function));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment