diff options
author | Santo Cariotti <santo@dcariotti.me> | 2024-06-25 11:33:41 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2024-06-25 11:33:41 +0200 |
commit | 6bdf1fc6c1b7afe18ffcae05f8fb11eca0f51258 (patch) | |
tree | 2cfbae97d45388bac38defc9907c77e7b275b207 /src/ast/nodes/FuncdefNode.java | |
parent | 54b2c77e6875c1abb3d73fdfd0de924e75633087 (diff) |
wip
Diffstat (limited to 'src/ast/nodes/FuncdefNode.java')
-rw-r--r-- | src/ast/nodes/FuncdefNode.java | 12 |
1 files changed, 11 insertions, 1 deletions
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<SemanticError> checkSemantics(SymbolTable ST, int _nesting) { ArrayList<SemanticError> errors = new ArrayList<SemanticError>(); + ST.insert(this.name.toString(), this.block.typeCheck(), _nesting, ""); + + HashMap<String, STentry> HM = new HashMap<String, STentry>(); + ArrayList<Type> partypes = new ArrayList<Type>(); + + 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; |