Initial work on implicit casting when calling a function
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-08-18 12:13:13 +02:00
parent 61d89bd21b
commit 0fde3d46df
8 changed files with 74 additions and 35 deletions

View File

@@ -585,14 +585,12 @@ namespace Porygon::Binder {
}
auto functionType = std::dynamic_pointer_cast<const GenericFunctionScriptType>(type);
auto givenParameters = expression->GetParameters();
auto givenParameterTypes = vector<shared_ptr<const ScriptType>>(givenParameters->size());
vector<BoundExpression *> boundParameters = vector<BoundExpression *>(givenParameters->size());
for (size_t i = 0; i < givenParameters->size(); i++){
boundParameters[i] = this -> BindExpression(givenParameters->at(i));
givenParameterTypes[i] = boundParameters[i]->GetType();
}
auto functionOption = functionType->GetFunctionOption(givenParameterTypes);
auto functionOption = functionType->GetFunctionOption(this->_scriptData->Diagnostics, boundParameters);
if (functionOption == nullptr){
this->_scriptData->Diagnostics->LogError(Diagnostics::DiagnosticCode::InvalidFunctionParameters,
expression->GetStartPosition(),