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