Skip to content

Commit

Permalink
Updated some error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
loumadev committed Nov 29, 2023
1 parent 2aae2d2 commit 72d8a92
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/compiler/analyser/Analyser.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ AnalyserResult __Analyser_analyseBlock(Analyser *analyser, BlockASTNode *block)

if(function->node->parameterList->parameters->size == 0) {
return AnalyserError(
RESULT_ERROR_SEMANTIC_OTHER, // TODO
RESULT_ERROR_SEMANTIC_VARIABLE_REDEFINITION, // TODO: Fixed
String_fromFormat("invalid redeclaration of '%s'", declaration->name->value),
NULL
);
Expand Down Expand Up @@ -822,7 +822,7 @@ AnalyserResult __Analyser_analyseBlock(Analyser *analyser, BlockASTNode *block)

if(variable) {
return AnalyserError(
RESULT_ERROR_SEMANTIC_VARIABLE_REDEFINITION, // TODO ?
RESULT_ERROR_SEMANTIC_VARIABLE_REDEFINITION, // TODO: Fixed
String_fromFormat("invalid redeclaration of '%s'", declaration->node->id->name->value),
NULL
);
Expand Down Expand Up @@ -1015,8 +1015,8 @@ AnalyserResult Analyser_resolveExpressionType(Analyser *analyser, ExpressionASTN
}
}

Array /*<FunctionDeclaration>*/ *overloads = Analyser_getFunctionDeclarationsByName(analyser, call->id->name->value);
Array /*<FunctionDeclaration>*/ *candidates = NULL;
Array /*<FunctionDeclaration> | null*/ *overloads = Analyser_getFunctionDeclarationsByName(analyser, call->id->name->value);
Array /*<FunctionDeclaration> | null*/ *candidates = NULL;
bool hasMultipleCandidates = false;
FunctionDeclaration *declaration = NULL;

Expand Down Expand Up @@ -1742,6 +1742,15 @@ AnalyserResult __Analyser_collectFunctionDeclarations(Analyser *analyser) {
);
}

// External paramter is missing (this is required in the assignment)
if(!parameter->externalId) {
return AnalyserError(
RESULT_ERROR_SYNTACTIC_ANALYSIS,
String_fromFormat("external parameter name missing in parameter '%s'", name->value),
NULL
);
}

// Both name and label are the same
if(parameter->externalId && String_equals(name, parameter->externalId->name->value)) {
return AnalyserError(
Expand Down

0 comments on commit 72d8a92

Please sign in to comment.