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:
@@ -83,11 +83,16 @@ BoundStatement *Binder::BindIndexAssignmentStatement(const ParsedStatement *stat
|
||||
}
|
||||
|
||||
std::shared_ptr<ScriptType> ParseTypeIdentifier(HashedString s){
|
||||
switch (s.GetHash()){
|
||||
auto hash = s.GetHash();
|
||||
switch (hash){
|
||||
case HashedString::ConstHash("number"): return std::make_shared<NumericScriptType>(false, false);
|
||||
case HashedString::ConstHash("bool"): return std::make_shared<ScriptType>(TypeClass::Bool);
|
||||
case HashedString::ConstHash("string"): return std::make_shared<StringScriptType>(false, 0);
|
||||
default: return std::make_shared<UserDataScriptType>(s.GetHash());
|
||||
default:
|
||||
if (!UserDataStorage::HasUserDataType(hash)){
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_shared<UserDataScriptType>(hash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +107,10 @@ BoundStatement *Binder::BindFunctionDeclarationStatement(const ParsedStatement *
|
||||
for (int i = 0; i < parameters->size(); i++){
|
||||
auto var = parameters -> at(i);
|
||||
auto parsedType = ParseTypeIdentifier(var->GetType());
|
||||
if (parsedType == nullptr){
|
||||
this -> _scriptData -> Diagnostics -> LogError(DiagnosticCode::InvalidTypeName, statement->GetStartPosition(), statement->GetLength());
|
||||
return new BoundBadStatement();
|
||||
}
|
||||
parameterTypes.at(i) = parsedType;
|
||||
auto parameterAssignment = this->_scope->CreateExplicitLocal(var->GetIdentifier().GetHash(), parsedType);
|
||||
if (parameterAssignment.GetResult() == VariableAssignmentResult::Ok){
|
||||
@@ -442,7 +451,7 @@ BoundExpression* Binder::BindNumericalTableExpression(const ParsedNumericalTable
|
||||
}
|
||||
|
||||
BoundExpression *Binder::BindTableExpression(const ParsedTableExpression *expression) {
|
||||
auto tableScope = new unordered_map<int, BoundVariable*>();
|
||||
auto tableScope = new unordered_map<uint32_t, BoundVariable*>();
|
||||
auto innerScope = new BoundScope(tableScope);
|
||||
auto currentScope = this -> _scope;
|
||||
this -> _scope = innerScope;
|
||||
|
||||
Reference in New Issue
Block a user