diff --git a/lib/compiler/scope_analysis.ml b/lib/compiler/scope_analysis.ml index 06daf7c..b0407a8 100644 --- a/lib/compiler/scope_analysis.ml +++ b/lib/compiler/scope_analysis.ml @@ -132,8 +132,10 @@ let convert program = | (Core_ast.Expr e) :: rest -> (analyze tbl [] e) :: (aux tbl rest) | (Define (s, e)) :: rest -> let tbl = SymbolTable.add s (id ()) tbl in - (analyze tbl [] e) :: (aux tbl rest) - in traverse (fun x -> x) (aux SymbolTable.empty program) + (analyze tbl [] (Set (s, e))) :: (aux tbl rest) + in + let* program = traverse (fun x -> x) (aux SymbolTable.empty program) in + Ok (program, global_tbl) let of_src src = let* core = (Core_ast.of_src src) in