diff options
| author | Marijn Haverbeke <[email protected]> | 2011-04-19 10:15:26 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-04-19 16:57:13 +0200 |
| commit | 9bfc8bf11e15b7b9a782f1757f9a0ebe324b16e4 (patch) | |
| tree | 688d5ac52ff6cdcdeb364dfe4b418370a9aee5ab /src/boot/me | |
| parent | Precision overrides 0-padding in #fmt (diff) | |
| download | rust-9bfc8bf11e15b7b9a782f1757f9a0ebe324b16e4.tar.xz rust-9bfc8bf11e15b7b9a782f1757f9a0ebe324b16e4.zip | |
Add log_err to rustboot
Diffstat (limited to 'src/boot/me')
| -rw-r--r-- | src/boot/me/trans.ml | 19 | ||||
| -rw-r--r-- | src/boot/me/type.ml | 2 | ||||
| -rw-r--r-- | src/boot/me/typestate.ml | 2 | ||||
| -rw-r--r-- | src/boot/me/walk.ml | 2 |
4 files changed, 14 insertions, 11 deletions
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index bb74d721..52a78cec 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -2663,11 +2663,11 @@ let trans_visitor abi.Abi.abi_emit_native_void_call (emitter()) nabi_rust (upcall_fixup name) args); - and trans_log_int (a:Ast.atom) : unit = - trans_void_upcall "upcall_log_int" [| (trans_atom a) |] + and trans_log_int lev (a:Ast.atom) : unit = + trans_void_upcall "upcall_log_int" [| simm (Int64.of_int lev); (trans_atom a) |] - and trans_log_str (a:Ast.atom) : unit = - trans_void_upcall "upcall_log_str" [| (trans_atom a) |] + and trans_log_str lev (a:Ast.atom) : unit = + trans_void_upcall "upcall_log_str" [| simm (Int64.of_int lev); (trans_atom a) |] and trans_spawn ((*initializing*)_:bool) @@ -5236,17 +5236,17 @@ let trans_visitor | _ -> bug () "Calling unexpected lval." - and trans_log id a = + and trans_log lev id a = match simplified_ty (atom_type cx a) with (* NB: If you extend this, be sure to update the * typechecking code in type.ml as well. *) - Ast.TY_str -> trans_log_str a + Ast.TY_str -> trans_log_str lev a | Ast.TY_int | Ast.TY_uint | Ast.TY_bool | Ast.TY_char | Ast.TY_mach (TY_u8) | Ast.TY_mach (TY_u16) | Ast.TY_mach (TY_u32) | Ast.TY_mach (TY_i8) | Ast.TY_mach (TY_i16) | Ast.TY_mach (TY_i32) -> - trans_log_int a + trans_log_int lev a | _ -> unimpl (Some id) "logging type" and trans_while (id:node_id) (sw:Ast.stmt_while) : unit = @@ -5284,7 +5284,10 @@ let trans_visitor match stmt.node with Ast.STMT_log a -> - trans_log stmt.id a + trans_log 1 stmt.id a + + | Ast.STMT_log_err a -> + trans_log 0 stmt.id a | Ast.STMT_check_expr e -> trans_check_expr stmt.id e diff --git a/src/boot/me/type.ml b/src/boot/me/type.ml index b8ebf242..b9aaf360 100644 --- a/src/boot/me/type.ml +++ b/src/boot/me/type.ml @@ -1125,7 +1125,7 @@ let check_block (cx:Semant.ctxt) : (fn_ctx -> Ast.block -> unit) = let value_ty = demand_chan (check_lval chan) in infer_lval ~mut:Ast.MUT_immutable value_ty value - | Ast.STMT_log x | Ast.STMT_note x -> + | Ast.STMT_log x | Ast.STMT_note x | Ast.STMT_log_err x -> (* always well-typed, just record type in passing. *) ignore (check_atom x) diff --git a/src/boot/me/typestate.ml b/src/boot/me/typestate.ml index 4c55c12e..58b2f673 100644 --- a/src/boot/me/typestate.ml +++ b/src/boot/me/typestate.ml @@ -697,7 +697,7 @@ let condition_assigning_visitor let precond = slot_inits (lval_slots cx lval) in raise_pre_post_cond s.id precond - | Ast.STMT_log atom -> + | Ast.STMT_log atom | Ast.STMT_log_err atom -> let precond = slot_inits (atom_slots cx atom) in raise_pre_post_cond s.id precond diff --git a/src/boot/me/walk.ml b/src/boot/me/walk.ml index d703ee69..131005e5 100644 --- a/src/boot/me/walk.ml +++ b/src/boot/me/walk.ml @@ -387,7 +387,7 @@ and walk_stmt in let children _ = match s.node with - Ast.STMT_log a -> + Ast.STMT_log a | Ast.STMT_log_err a -> walk_atom v a | Ast.STMT_new_rec (lv, atab, base) -> |