nightshade

The nightshade programming language, compiler and tools (WIP)
Log | Files | Refs | README

commit d9e2201d4d3e90264653d79e37d19250c9039adf
parent 7e2b7b6d1bf9ad265cccd908629e052ece71313c
Author: citbl <citbl@citbl.org>
Date:   Sun, 14 Jun 2026 15:04:12 +1000

minor

Diffstat:
Msrc/binder.adb | 2++
Msrc/parser.adb | 10++++++----
Msrc/types.ads | 1+
3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/binder.adb b/src/binder.adb @@ -147,6 +147,7 @@ package body Binder is begin for Declaration of S.AST loop if Declaration.Kind = Function_Kind then + Declaration.Scope := S.Scope; Put_Line ("scoping function"); Scope_Func (S, Declaration.Func); end if; @@ -155,3 +156,4 @@ package body Binder is end Analysis; end Binder; + diff --git a/src/parser.adb b/src/parser.adb @@ -218,8 +218,9 @@ package body Parser is return Decl' - (Kind => Function_Kind, - Func => + (Kind => Function_Kind, + Scope => null, + Func => Func_Decl' (Name => Name, Params => Params, @@ -305,13 +306,14 @@ package body Parser is procedure Print_AST (Decls : Declaration_Vectors.Vector) is begin - Put_Line ("print AST:"); + Put_Line ("------------------------------ Print AST: ------------------------------------"); for Decl of Decls loop if Decl.Kind = Function_Kind then - Put_Line ("Function:"); + Put_Line ("Function: (at scope " & AST_Scope_Ref'Image (Decl.Scope) & " )"); Print_Func_decl (Decl.Func, 1); end if; end loop; + Put_Line("-------------------------------------------------------------------------------"); end Print_AST; end Parser; diff --git a/src/types.ads b/src/types.ads @@ -120,6 +120,7 @@ package Types is type Decl_Kind is (Function_Kind); type Decl (Kind : Decl_Kind) is record + Scope : AST_Scope_Ref; case Kind is when Function_Kind => Func : Func_Decl;