about summary refs log tree commit diff
path: root/src/boot
diff options
context:
space:
mode:
authorRoy Frostig <rfrostig@mozilla.com>2010-07-19 19:06:55 -0700
committerRoy Frostig <rfrostig@mozilla.com>2010-07-19 19:06:55 -0700
commitae515c017c0aadb2a4c691804f1bc3b8b343dd67 (patch)
tree162a9bce32a712db96d45ed20f7c8e2e20355ae3 /src/boot
parentfde9ca0937171b77542028ef433fddf979aa506b (diff)
ctxt_auto_deref_lval decides whether to autoderef the entire lval, not its base.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/me/trans.ml41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml
index d1e707b7d72..d8128196717 100644
--- a/src/boot/me/trans.ml
+++ b/src/boot/me/trans.ml
@@ -973,33 +973,40 @@ let trans_visitor
       (lv:Ast.lval)
       : (Il.cell * Ast.ty) =
 
-    let rec trans_slot_lval_full (initializing:bool) lv =
+    let rec trans_slot_lval_full (initializing:bool) (outermost:bool) lv =
       let (cell, ty) =
         match lv with
             Ast.LVAL_ext (base, comp) ->
               let (base_cell, base_ty) =
-                trans_slot_lval_full initializing base
+                trans_slot_lval_full initializing false base
               in
                 trans_slot_lval_ext initializing base_ty base_cell comp
 
-          | Ast.LVAL_base nbi ->
+          | Ast.LVAL_base _ ->
               let sloti = lval_base_to_slot cx lv in
               let cell = cell_of_block_slot sloti.id in
               let ty = slot_ty sloti.node in
               let cell = deref_slot initializing cell sloti.node in
-              let dctrl =
-                (* If this fails, type didn't visit the lval, and we
-                 * don't know whether to auto-deref its base. Crashing
-                 * here is best. Compiler bug.
-                 *)
-                match htab_search cx.ctxt_auto_deref_lval nbi.id with
-                    None ->
-                      bugi cx nbi.id
-                        "Lval without auto-deref info; bad typecheck?"
-                  | Some true -> DEREF_all_boxes
-                  | Some false -> DEREF_none
-              in
-                deref_ty dctrl initializing cell ty
+                (cell, ty)
+      in
+      let (cell, ty) =
+        if outermost
+        then
+          let id = lval_base_id lv in
+          let dctrl =
+            (* If this fails, type didn't visit the lval, and we
+             * don't know whether to auto-deref the entire lval.
+             * Crashing here is best. Compiler bug.
+             *)
+            match htab_search cx.ctxt_auto_deref_lval id with
+                None ->
+                  bugi cx id
+                    "Lval without auto-deref info; bad typecheck?"
+              | Some true -> DEREF_all_boxes
+              | Some false -> DEREF_none
+          in
+            deref_ty dctrl initializing cell ty
+        else (cell, ty)
       in
         iflog
           begin
@@ -1013,7 +1020,7 @@ let trans_visitor
 
     in
       if lval_is_slot cx lv
-      then trans_slot_lval_full initializing lv
+      then trans_slot_lval_full initializing true lv
       else
         if initializing
         then err None "init item"