Support explicit discriminant numbers on tag variants.

Addresses issue #1393.

For now disallow disr. values unless all variants use nullary
contractors (i.e. "enum-like").

Disr. values are now encoded in the crate metadata, but only when it
will differ from the inferred value based on the order.
This commit is contained in:
Kevin Atkinson 2012-01-10 14:50:40 -07:00 committed by Graydon Hoare
parent d0fe6723fc
commit 08abf8d37f
12 changed files with 167 additions and 30 deletions

View file

@ -416,7 +416,8 @@ type native_mod =
type variant_arg = {ty: @ty, id: node_id};
type variant_ = {name: ident, args: [variant_arg], id: node_id};
type variant_ = {name: ident, args: [variant_arg], id: node_id,
disr_val: int, disr_expr: option::t<@expr>};
type variant = spanned<variant_>;