From 6bdf1fc6c1b7afe18ffcae05f8fb11eca0f51258 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 25 Jun 2024 11:33:41 +0200 Subject: wip --- src/ast/nodes/FuncdefNode.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/ast/nodes/FuncdefNode.java') diff --git a/src/ast/nodes/FuncdefNode.java b/src/ast/nodes/FuncdefNode.java index 67bc772..e50e35c 100644 --- a/src/ast/nodes/FuncdefNode.java +++ b/src/ast/nodes/FuncdefNode.java @@ -1,6 +1,7 @@ package ast.nodes; import java.util.ArrayList; +import java.util.HashMap; import semanticanalysis.SemanticError; import semanticanalysis.SymbolTable; @@ -24,11 +25,20 @@ public class FuncdefNode implements Node { @Override public ArrayList checkSemantics(SymbolTable ST, int _nesting) { ArrayList errors = new ArrayList(); + ST.insert(this.name.toString(), this.block.typeCheck(), _nesting, ""); + + HashMap HM = new HashMap(); + ArrayList partypes = new ArrayList(); + + ST.add(HM); if (paramlist != null) { - errors.addAll(paramlist.checkSemantics(ST, _nesting)); + errors.addAll(paramlist.checkSemantics(ST, _nesting + 1)); } + // Offset is increased for the possible return value + ST.increaseoffset(); + errors.addAll(block.checkSemantics(ST, _nesting)); return errors; -- cgit v1.2.3-18-g5258