Implements support for functions with the same name, but different parameters
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-29 19:59:42 +02:00
parent 24c560b52d
commit db2d731b06
23 changed files with 362 additions and 204 deletions

View File

@@ -17,8 +17,6 @@ namespace Porygon::Diagnostics {
CantAssignVariable,
VariableNotFound,
ExpressionIsNotAFunction,
ParameterCountMismatch,
ParameterTypeMismatch,
CantIndex,
InvalidReturnType,
ConditionNotABool,
@@ -27,7 +25,8 @@ namespace Porygon::Diagnostics {
UserDataFieldNoGetter,
UserDataFieldNoSetter,
NumericalForArgumentNotANumber,
CantIterateExpression
CantIterateExpression,
InvalidFunctionParameters
};
}
#endif //PORYGONLANG_DIAGNOSTICCODE_HPP

View File

@@ -48,16 +48,16 @@ size_t DiagnosticsHolder::GetLineFromPosition(size_t i) {
if (bottomLimit == topLimit){
return bottomLimit;
}
size_t half = (topLimit - bottomLimit) / 2;
size_t half = bottomLimit + ((topLimit - bottomLimit) / 2);
size_t pos = _lineStarts[half];
size_t length = _lineLength[half];
if (pos < i && pos + length > i){
return half;
}
if (pos > i){
bottomLimit = half;
} else if (pos < i){
topLimit = half;
} else if (pos < i){
bottomLimit = half;
} else{
return half;
}