/// <summary> /// Gets Invokable object (Function) by a given name /// </summary> /// <param name="name">Name</param> /// <returns></returns> public virtual IInvokable GetFunctionDefinition(string name) { object result = GetVariableInternal(name, false); IInvokable function = result as IInvokable; if (function != null) { return(function); } if (Parent != null) { return(Parent.GetFunctionDefinition(name)); } else { throw new ScriptIdNotFoundException(string.Format(Strings.FunctionNotFound, name)); } }
/// <summary> /// Gets Invokable object (Function) by a given name /// </summary> /// <param name="name">Name</param> /// <returns></returns> public virtual IInvokable GetFunctionDefinition(string name) { object result = GetVariableInternal(name, false); IInvokable function = result as IInvokable; if (function != null) { return(function); } if (parent != null) { return(parent.GetFunctionDefinition(name)); } else { throw new ScriptIdNotFoundException("Function " + name + " not found"); } }
/// <summary> /// Finds function definition in current scope /// </summary> /// <param name="name">function name</param> /// <returns>IInvokable object</returns> public IInvokable GetFunctionDefinition(string name) { return(scope.GetFunctionDefinition(name)); }