Skip to content

Commit 7a06370

Browse files
committed
Revert "super basic import"
This reverts commit ec59355.
1 parent ec59355 commit 7a06370

2 files changed

Lines changed: 2 additions & 26 deletions

File tree

lib/preprocess.ml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -260,25 +260,6 @@ let resolve_idents tree idents =
260260
let tree, _ = tree_fold_map tree ~accumulator:idents ~f:resolve_idents_step in
261261
tree
262262

263-
(* To be replaced with a proper module system later *)
264-
let resolve_imports_step () node = match node with
265-
| ExprNode {
266-
data =
267-
LambdaCall {
268-
callee = UnresolvedIdent "import";
269-
call_args =
270-
{data = TupleExpr [{data = Atomic (StringVal filename); _}]; _}
271-
}; location} ->
272-
let in_stream = Stdio.In_channel.create filename in
273-
let in_string = Stdio.In_channel.input_all in_stream in
274-
let file_block, _ = Parser.parse_str ("{" ^ in_string ^ "}") filename in
275-
ExprNode file_block, ()
276-
| _ -> node, ()
277-
278-
let resolve_imports tree =
279-
let tree, _ = tree_fold_map tree ~accumulator:() ~f:resolve_imports_step in
280-
unwrap_expr_node tree
281-
282263
let find_expr_functions ss acc e = match e with
283264
| FnDef {fn_name = UnresolvedIdent fn_name; fn_def_func} ->
284265
(fn_name |> List.Assoc.find_exn ss.static_idents ~equal:String.equal, fn_def_func)::acc

lib/run.ml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,11 @@ let run_string in_string filename (ss, state) =
4444
List.rev (aux remaining [parsed])
4545
in
4646
let block = BlockExpr expr_ls in
47-
let block = Preprocess.resolve_imports (Preprocess.ExprNode (locate block)) in
48-
let expr_ls = match block with
49-
| {data = BlockExpr ls; _} -> ls
50-
| _ -> assert false
51-
in
5247
let static_atoms =
53-
Preprocess.find_atoms (ExprNode block) ss.static_atoms
48+
Preprocess.find_atoms (ExprNode (locate block)) ss.static_atoms
5449
in
5550
let static_idents =
56-
Preprocess.find_idents (ExprNode block) ss.static_idents
51+
Preprocess.find_idents (ExprNode (locate block)) ss.static_idents
5752
in
5853
(* List.iter static_idents ~f:(fun (k, v) -> printf "%s: %d\n" k v); *)
5954
let ss = { ss with static_atoms; static_idents } in

0 commit comments

Comments
 (0)