Work on making userdata work through extern C entry points
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -7,15 +7,15 @@
|
||||
using namespace std;
|
||||
|
||||
class TableEvalValue : public EvalValue {
|
||||
shared_ptr<unordered_map<size_t, shared_ptr<EvalValue>>> _table;
|
||||
shared_ptr<unordered_map<uint32_t, shared_ptr<EvalValue>>> _table;
|
||||
size_t _hash;
|
||||
|
||||
explicit TableEvalValue(shared_ptr<unordered_map<size_t, shared_ptr<EvalValue>>> table, size_t hash){
|
||||
explicit TableEvalValue(shared_ptr<unordered_map<uint32_t, shared_ptr<EvalValue>>> table, size_t hash){
|
||||
_table = std::move(table);
|
||||
_hash = hash;
|
||||
}
|
||||
public:
|
||||
explicit TableEvalValue(shared_ptr<unordered_map<size_t, shared_ptr<EvalValue>>> table){
|
||||
explicit TableEvalValue(shared_ptr<unordered_map<uint32_t, shared_ptr<EvalValue>>> table){
|
||||
_table = std::move(table);
|
||||
_hash = rand();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "EvaluationScope.hpp"
|
||||
#include <memory>
|
||||
|
||||
EvaluationScope::EvaluationScope(unordered_map<size_t, shared_ptr<EvalValue>> *scriptVariables, int localVariableCount) {
|
||||
EvaluationScope::EvaluationScope(unordered_map<uint32_t, shared_ptr<EvalValue>> *scriptVariables, int localVariableCount) {
|
||||
_scriptScope = scriptVariables;
|
||||
_localScope = unordered_map<uint64_t, shared_ptr<EvalValue>>(localVariableCount);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include "../EvalValues/EvalValue.hpp"
|
||||
|
||||
class EvaluationScope {
|
||||
unordered_map<size_t, shared_ptr<EvalValue>>* _scriptScope;
|
||||
unordered_map<uint32_t, shared_ptr<EvalValue>>* _scriptScope;
|
||||
unordered_map<uint64_t, shared_ptr<EvalValue>> _localScope;
|
||||
public:
|
||||
explicit EvaluationScope(unordered_map<size_t, shared_ptr<EvalValue>>* scriptVariables, int deepestScope);
|
||||
explicit EvaluationScope(unordered_map<uint32_t, shared_ptr<EvalValue>>* scriptVariables, int deepestScope);
|
||||
~EvaluationScope() = default;
|
||||
|
||||
void CreateVariable(const BoundVariableKey* key, const shared_ptr<EvalValue>& value);
|
||||
|
||||
@@ -279,12 +279,12 @@ shared_ptr<EvalValue> Evaluator::EvaluateIndexExpression(const BoundExpression *
|
||||
shared_ptr<EvalValue> Evaluator::EvaluateNumericTableExpression(const BoundExpression *expression) {
|
||||
auto tableExpression = (BoundNumericalTableExpression*)expression;
|
||||
auto valueExpressions = tableExpression->GetExpressions();
|
||||
auto values = new unordered_map<size_t, shared_ptr<EvalValue>>(valueExpressions->size());
|
||||
auto values = new unordered_map<uint32_t, shared_ptr<EvalValue>>(valueExpressions->size());
|
||||
for (int i = 0; i < valueExpressions->size(); i++){
|
||||
auto val = this -> EvaluateExpression(valueExpressions -> at(i));
|
||||
values -> insert({i + 1, val});
|
||||
}
|
||||
auto valuesPointer = shared_ptr<unordered_map<size_t, shared_ptr<EvalValue>>>(values);
|
||||
auto valuesPointer = shared_ptr<unordered_map<uint32_t, shared_ptr<EvalValue>>>(values);
|
||||
return make_shared<TableEvalValue>(valuesPointer);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ shared_ptr<EvalValue> Evaluator::EvaluateComplexTableExpression(const BoundExpre
|
||||
auto tableExpression = (BoundTableExpression*)expression;
|
||||
auto type = dynamic_pointer_cast<TableScriptType>(tableExpression->GetType());
|
||||
auto declaredVars = type -> GetValues();
|
||||
auto variables = make_shared<unordered_map<size_t, shared_ptr<EvalValue>>>(declaredVars->size());
|
||||
auto variables = make_shared<unordered_map<uint32_t, shared_ptr<EvalValue>>>(declaredVars->size());
|
||||
for (auto i : *declaredVars){
|
||||
variables->insert({i.first, nullptr});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user