aboutsummaryrefslogtreecommitdiff
path: root/src/boot/me
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-11-08 15:45:30 -0800
committerGraydon Hoare <[email protected]>2010-11-08 15:45:30 -0800
commit3e9be14757bfcaa65e388a9acd7e2ca97cccfbd0 (patch)
tree999975b3f2c277e05cc687618323fc77876016d6 /src/boot/me
parentFix linux burn caused by last commit on friday. (diff)
downloadrust-3e9be14757bfcaa65e388a9acd7e2ca97cccfbd0.tar.xz
rust-3e9be14757bfcaa65e388a9acd7e2ca97cccfbd0.zip
Add a check for binding an alias. Good thing, as we had two instances in our library.
Diffstat (limited to 'src/boot/me')
-rw-r--r--src/boot/me/alias.ml26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/boot/me/alias.ml b/src/boot/me/alias.ml
index e109f82b..77bc769e 100644
--- a/src/boot/me/alias.ml
+++ b/src/boot/me/alias.ml
@@ -48,6 +48,29 @@ let alias_analysis_visitor
| _ -> ()
in
+ let check_no_alias_bindings
+ (fn:Ast.lval)
+ (args:(Ast.atom option) array)
+ : unit =
+ let fty = match lval_ty cx fn with
+ Ast.TY_fn tfn -> tfn
+ | _ -> err (Some (lval_base_id fn)) "binding non-fn"
+ in
+ let arg_slots = (fst fty).Ast.sig_input_slots in
+ Array.iteri
+ begin
+ fun i arg ->
+ match arg with
+ None -> ()
+ | Some _ ->
+ match arg_slots.(i).Ast.slot_mode with
+ Ast.MODE_local -> ()
+ | Ast.MODE_alias ->
+ err (Some (lval_base_id fn)) "binding alias slot"
+ end
+ args
+ in
+
let visit_stmt_pre s =
Stack.push s.id curr_stmt;
begin
@@ -62,6 +85,9 @@ let alias_analysis_visitor
| Ast.STMT_spawn (dst, _, _, callee, args)
-> alias_call_args dst callee args
+ | Ast.STMT_bind (_, fn, args) ->
+ check_no_alias_bindings fn args
+
| Ast.STMT_send (_, src) -> alias src
| Ast.STMT_recv (dst, _) -> alias dst
| Ast.STMT_new_port (dst) -> alias dst