Merge branch 'main' of gitlab.aliens-lyon.fr:alucas03/c-repl into main
This commit is contained in:
commit
b5e51b8ebc
@ -277,6 +277,13 @@ AnalysisResult analyze(Node &ast, Memory &memory) {
|
|||||||
throw RuntimeError(ErrorType::NestedFunction, token.pos, {});
|
throw RuntimeError(ErrorType::NestedFunction, token.pos, {});
|
||||||
} catch (const InternalError& _) {}
|
} catch (const InternalError& _) {}
|
||||||
|
|
||||||
|
if (memory.contains(function_name)) {
|
||||||
|
// Il existe une variable non fonction à ce nom
|
||||||
|
if (memory.get(function_name).type.type != TypeType::Function) {
|
||||||
|
throw RuntimeError(ErrorType::IncompatibleRedefinition, token.pos, function_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
memory.declare(function_name, {
|
memory.declare(function_name, {
|
||||||
.type = TypeType::Function,
|
.type = TypeType::Function,
|
||||||
.data = make_fn_prototype(node)
|
.data = make_fn_prototype(node)
|
||||||
|
Loading…
Reference in New Issue
Block a user