Browse Source

t/fix-evaluation-order-for-ocamlc

evaluation order is not always defined causing missbehaviour in some cases.
This patch fixes two cases (which should be close to all)
Marc Weber 12 years ago
parent
commit
49aee8747c
2 changed files with 6 additions and 2 deletions
  1. 4 1
      interp.ml
  2. 2 1
      matcher.ml

+ 4 - 1
interp.ml

@@ -485,7 +485,10 @@ let neko =
 	let vm = Extc.dlcall1 (load "neko_vm_alloc") null in
 	ignore(Extc.dlcall1 (load "neko_vm_select") vm);
 	let loader = Extc.dlcall2 (load "neko_default_loader") null null in
-	let loadprim = Extc.dlcall2 (load "neko_val_field") loader (Extc.dlcall1 (load "neko_val_id") (Extc.dlstring "loadprim")) in
+	let loadprim =
+		let l1 = load "neko_val_field" in
+		let l2 = Extc.dlcall1 (load "neko_val_id") (Extc.dlstring "loadprim") in
+		Extc.dlcall2 (l1) loader (l2) in
 
 	let callN = load "neko_val_callN" in
 	let callEx = load "neko_val_callEx" in

+ 2 - 1
matcher.ml

@@ -541,7 +541,8 @@ let to_pattern ctx e t =
 		pc_sub_vars = None;
 		pc_reify = false;
 	} in
-	loop pctx e t, pctx.pc_locals
+	let x = loop pctx e t in
+	x, x.pc_locals
 
 let get_pattern_locals ctx e t =
 	try