Get slots in trans_tag using Semant tables. Closes #133.

This commit is contained in:
Roy Frostig 2010-07-28 15:04:58 -07:00
parent a9ad2e98e3
commit f282c5ccc0
3 changed files with 34 additions and 5 deletions

View file

@ -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 \

View file

@ -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

View file

@ -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);
}
}
}