aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-07-28 15:04:58 -0700
committerRoy Frostig <[email protected]>2010-07-28 15:04:58 -0700
commitf282c5ccc001ba377dfeee6f347ef56b73c86f4e (patch)
treeeced775abd1683c9a531e4a57f24544cad3f02e1 /src
parentRefer to issue #136 at the offending source point. (diff)
downloadrust-f282c5ccc001ba377dfeee6f347ef56b73c86f4e.tar.xz
rust-f282c5ccc001ba377dfeee6f347ef56b73c86f4e.zip
Get slots in trans_tag using Semant tables. Closes #133.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile1
-rw-r--r--src/boot/me/trans.ml15
-rw-r--r--src/test/run-pass/generic-tag-values.rs23
3 files changed, 34 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile
index 33f10b39..6e9a1406 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -415,6 +415,7 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
generic-obj.rs \
generic-recursive-tag.rs \
generic-tag-alt.rs \
+ generic-tag-values.rs \
generic-tag.rs \
i32-sub.rs \
i8-incr.rs \
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml
index 06f04a3a..813b9065 100644
--- a/src/boot/me/trans.ml
+++ b/src/boot/me/trans.ml
@@ -3082,8 +3082,11 @@ let trans_visitor
let sub_dst_cell = get_element_ptr_dyn ty_params dst i in
let sub_src_cell = get_element_ptr_dyn ty_params src i in
trans_copy_ty
- ty_params initializing
- sub_dst_cell ty sub_src_cell ty None
+ ty_params
+ initializing
+ sub_dst_cell ty
+ sub_src_cell ty
+ None
end
tys
@@ -5064,10 +5067,12 @@ let trans_visitor
Array.iteri
begin
fun i sloti ->
- let slot = sloti.node in
+ let slot = get_slot cx sloti.id in
let ty = slot_ty slot in
- trans_copy_ty ty_params true
- (get_element_ptr_dyn_in_current_frame tag_body_cell i) ty
+ trans_copy_ty
+ ty_params
+ true
+ (get_element_ptr_dyn ty_params tag_body_cell i) ty
(deref_slot false (cell_of_block_slot sloti.id) slot) ty
None;
end
diff --git a/src/test/run-pass/generic-tag-values.rs b/src/test/run-pass/generic-tag-values.rs
new file mode 100644
index 00000000..19916f07
--- /dev/null
+++ b/src/test/run-pass/generic-tag-values.rs
@@ -0,0 +1,23 @@
+// -*- rust -*-
+
+type noption[T] = tag(some(T));
+
+fn main() {
+ let noption[int] nop = some[int](5);
+ alt (nop) {
+ case (some[int](n)) {
+ log n;
+ check (n == 5);
+ }
+ }
+
+ let noption[tup(int, int)] nop2 = some[tup(int, int)](tup(17, 42));
+ alt (nop2) {
+ case (some[tup(int, int)](t)) {
+ log t._0;
+ log t._1;
+ check (t._0 == 17);
+ check (t._1 == 42);
+ }
+ }
+}