Переглянути джерело

Fixed bug where desugaring would not traverse into local functions properly

Taddeus Kroes 12 роки тому
батько
коміт
6a7d2a1dd7
1 змінених файлів з 3 додано та 2 видалено
  1. 3 2
      phases/desug.ml

+ 3 - 2
phases/desug.ml

@@ -81,6 +81,8 @@ let rec var_init = function
                 inits := !inits @ add;
                 VarDec (ctype, name, None, ann)
 
+            | LocalFuns funs -> LocalFuns (List.map var_init funs)
+
             | node -> transform_children extract_inits node
         in
         let rec place_inits = function
@@ -254,6 +256,5 @@ let rec array_dims = function
 let rec phase input =
     log_line 1 "- Desugaring";
     match input with
-    | Ast node ->
-            Ast (for_to_while (array_init (var_init (array_dims node))))
+    | Ast node -> Ast (for_to_while (array_init (var_init (array_dims node))))
     | _ -> raise (InvalidInput "desugar")