This commit is contained in:
@@ -15,13 +15,13 @@
|
||||
|
||||
namespace Porygon::StandardLibraries{
|
||||
class BasicLibrary{
|
||||
static Evaluation::EvalValue* _error(void*, Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
static const Evaluation::EvalValue* _error(void*, const Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
auto message = parameters[0]->EvaluateString();
|
||||
auto conv = Utilities::StringUtils::FromUTF8(message);
|
||||
throw Evaluation::EvaluationException(conv);
|
||||
}
|
||||
|
||||
static Evaluation::EvalValue* _assert(void*, Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
static const Evaluation::EvalValue* _assert(void*, const Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
auto assertion = parameters[0]->EvaluateBool();
|
||||
if (!assertion){
|
||||
if (parameterCount >= 2){
|
||||
@@ -34,13 +34,13 @@ namespace Porygon::StandardLibraries{
|
||||
return new Evaluation::BooleanEvalValue(true);
|
||||
}
|
||||
|
||||
static Evaluation::EvalValue* _print(void*, Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
static const Evaluation::EvalValue* _print(void*, const Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
auto message = parameters[0]->EvaluateString();
|
||||
GlobalScriptOptions::Print(message.c_str());
|
||||
return new Evaluation::NilEvalValue();
|
||||
}
|
||||
|
||||
static Evaluation::EvalValue* _toInt(void*, Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
static const Evaluation::EvalValue* _toInt(void*, const Evaluation::EvalValue* parameters[], int parameterCount){
|
||||
auto parameter = parameters[0]->EvaluateString();
|
||||
auto parsed = Utilities::StringUtils::ParseInteger(parameter);
|
||||
return new Evaluation::IntegerEvalValue(parsed);
|
||||
@@ -75,10 +75,10 @@ namespace Porygon::StandardLibraries{
|
||||
|
||||
|
||||
static shared_ptr<Evaluation::EvalValue> GetFuncEvalValue(
|
||||
Evaluation::EvalValue* (*func)(void* obj, Evaluation::EvalValue* parameters[], int parameterCount),
|
||||
shared_ptr<GenericFunctionScriptType> type, size_t optionLength){
|
||||
const Evaluation::EvalValue* (*func)(void* obj, const Evaluation::EvalValue* parameters[], int parameterCount),
|
||||
const shared_ptr<GenericFunctionScriptType>& type, size_t optionLength){
|
||||
auto f = make_shared<Evaluation::GenericFunctionEvalValue>(type, rand());
|
||||
for (int i = 0; i < optionLength; i++){
|
||||
for (size_t i = 0; i < optionLength; i++){
|
||||
auto funcOption = new UserData::UserDataFunction(func, nullptr);
|
||||
f->RegisterOption(funcOption);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user