![]() |
ArkScript
A small, fast, functional and scripting language for video games
|
Namespaces | |
namespace | details |
Classes | |
struct | Contract |
A contract is a list of typed arguments that a function can follow. More... | |
struct | Typedef |
A type definition within a contract. More... | |
Functions | |
template<typename... Ts, typename = details::AllSame<ValueType, Ts...>> | |
bool | check (const std::vector< Value > &args, Ts... types) |
Helper to see if a builtin has been given a wanted set of types. | |
ARK_API void | generateError (const std::string_view &funcname, const std::vector< Contract > &contracts, const std::vector< Value > &args) |
Generate an error message based on a given set of types contracts provided argument list. | |
std::string | typeListToString (const std::vector< ValueType > &types) |
void | displayContract (const Contract &contract, const std::vector< Value > &args) |
|
nodiscard |
Helper to see if a builtin has been given a wanted set of types.
Ts | Variadic argument list composed of ValueTypes |
args | arguments passed to the function |
types | accepted types |
Definition at line 52 of file TypeChecker.hpp.
References Ark::types::details::checkN().
Definition at line 28 of file TypeChecker.cpp.
References Ark::Any, Ark::types::Contract::arguments, Ark::types::Typedef::name, typeListToString(), Ark::types::Typedef::types, Ark::types_to_str, and Ark::types::Typedef::variadic.
Referenced by generateError().
void Ark::types::generateError | ( | const std::string_view & | funcname, |
const std::vector< Contract > & | contracts, | ||
const std::vector< Value > & | args ) |
Generate an error message based on a given set of types contracts provided argument list.
funcname | ArkScript name of the function |
contracts | types contracts the function can follow |
args | provided argument list |
Definition at line 87 of file TypeChecker.cpp.
References displayContract(), Ark::Undefined, and Ark::Value::valueType().
Referenced by Ark::helper::head(), Ark::VM::safeRun(), and Ark::helper::tail().
std::string Ark::types::typeListToString | ( | const std::vector< ValueType > & | types | ) |
Definition at line 12 of file TypeChecker.cpp.
References Ark::Any, and Ark::types_to_str.
Referenced by displayContract().