Work on making userdata work through extern C entry points
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-14 22:21:33 +02:00
parent 2c313791d9
commit 7c345d85e8
22 changed files with 128 additions and 51 deletions

View File

@@ -17,7 +17,7 @@ Script::Script() {
Diagnostics = new DiagnosticsHolder();
_evaluator = new Evaluator(this);
_boundScript = nullptr;
_scriptVariables = new unordered_map<size_t, shared_ptr<EvalValue>>(0);
_scriptVariables = new unordered_map<uint32_t, shared_ptr<EvalValue>>(0);
}
EvalValue* Script::Evaluate() {
@@ -42,7 +42,7 @@ void Script::Parse(const string& script) {
}
lexResult.clear();
if (!Diagnostics->HasErrors()){
unordered_map<int, BoundVariable*> scriptScope;
unordered_map<uint32_t, BoundVariable*> scriptScope;
auto bindScope = new BoundScope(&scriptScope);
this->_boundScript = Binder::Bind(this, parseResult, bindScope);
for (const auto& v : scriptScope){
@@ -72,9 +72,9 @@ bool Script::HasFunction(const string &key) {
return f != _scriptVariables->end() && f.operator->()->second->GetTypeClass() == TypeClass ::Function;
}
shared_ptr<EvalValue> Script::CallFunction(const string &key, vector<EvalValue *> variables) {
shared_ptr<EvalValue> Script::CallFunction(const string &key, const vector<EvalValue *>& variables) {
auto var = (ScriptFunctionEvalValue*)GetVariable(key);
return this->_evaluator->EvaluateFunction(var, std::move(variables));
return this->_evaluator->EvaluateFunction(var, variables);
}
extern "C" {