提交 bdb8f6cf 编写于 作者: P Patrick Walton

rustc: "tag" -> "enum"

上级 e6a7383a
......@@ -22,7 +22,7 @@
import lib::llvm::False;
import util::filesearch;
tag output_type {
enum output_type {
output_type_none;
output_type_bitcode;
output_type_assembly;
......
......@@ -107,7 +107,7 @@ fn mk_handler(cm: codemap::codemap,
} as handler
}
tag level {
enum level {
fatal;
error;
warning;
......
......@@ -18,7 +18,7 @@
import getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
import back::{x86, x86_64};
tag pp_mode { ppm_normal; ppm_expanded; ppm_typed; ppm_identified; }
enum pp_mode { ppm_normal; ppm_expanded; ppm_typed; ppm_identified; }
fn default_configuration(sess: session, argv0: str, input: str) ->
ast::crate_cfg {
......
......@@ -127,7 +127,7 @@ fn run_compiler(args: [str], demitter: diagnostic::emitter) {
bug and need to present an error.
*/
fn monitor(f: fn~(diagnostic::emitter)) {
tag monitor_msg {
enum monitor_msg {
fatal;
done;
};
......
......@@ -10,11 +10,11 @@
import back::target_strs;
import middle::lint;
tag os { os_win32; os_macos; os_linux; os_freebsd; }
enum os { os_win32; os_macos; os_linux; os_freebsd; }
tag arch { arch_x86; arch_x86_64; arch_arm; }
enum arch { arch_x86; arch_x86_64; arch_arm; }
tag crate_type { bin_crate; lib_crate; unknown_crate; }
enum crate_type { bin_crate; lib_crate; unknown_crate; }
type config =
{os: os,
......
......@@ -15,7 +15,7 @@
// Consts for the LLVM CallConv type, pre-cast to uint.
// FIXME: figure out a way to merge these with the native
// typedef and/or a tag type in the native module below.
// typedef and/or a enum type in the native module below.
const LLVMCCallConv: uint = 0u;
const LLVMFastCallConv: uint = 8u;
......
// EBML tag definitions and utils shared by the encoder and decoder
// EBML enum definitions and utils shared by the encoder and decoder
import str;
......
......@@ -36,11 +36,11 @@
cnum: ast::crate_num};
// This is a bit of an experiment at encapsulating the data in cstore. By
// keeping all the data in a non-exported tag variant, it's impossible for
// keeping all the data in a non-exported enum variant, it's impossible for
// other modules to access the cstore's private data. This could also be
// achieved with an obj, but at the expense of a vtable. Not sure if this is a
// good pattern or not.
tag cstore { private(cstore_private); }
enum cstore { private(cstore_private); }
type cstore_private =
@{metas: map::hashmap<ast::crate_num, crate_metadata>,
......
......@@ -252,7 +252,7 @@ fn get_tag_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
ty::ty_fn(f) {
for a: ty::arg in f.inputs { arg_tys += [a.ty]; }
}
_ { /* Nullary tag variant. */ }
_ { /* Nullary enum variant. */ }
}
alt variant_disr_val(item) {
some(val) { disr_val = val; }
......@@ -347,7 +347,7 @@ fn item_family_to_str(fam: u8) -> str {
't' { ret "type"; }
'm' { ret "mod"; }
'n' { ret "native mod"; }
'v' { ret "tag"; }
'v' { ret "enum"; }
'i' { ret "impl"; }
'I' { ret "iface"; }
}
......
......@@ -25,7 +25,7 @@
// Whatever format you choose should not contain pipe characters.
type ty_abbrev = {pos: uint, len: uint, s: @str};
tag abbrev_ctxt { ac_no_abbrevs; ac_use_abbrevs(hashmap<ty::t, ty_abbrev>); }
enum abbrev_ctxt { ac_no_abbrevs; ac_use_abbrevs(hashmap<ty::t, ty_abbrev>); }
fn cx_uses_abbrevs(cx: @ctxt) -> bool {
alt cx.abbrevs {
......
......@@ -15,13 +15,13 @@
// getting input from one, to be more precise). It is a pass that checks
// whether aliases are used in a safe way.
tag copied { not_allowed; copied; not_copied; }
tag invalid_reason { overwritten; val_taken; }
enum copied { not_allowed; copied; not_copied; }
enum invalid_reason { overwritten; val_taken; }
type invalid = {reason: invalid_reason,
node_id: node_id,
sp: span, path: @ast::path};
tag unsafe_ty { contains(ty::t); mut_contains(ty::t); }
enum unsafe_ty { contains(ty::t); mut_contains(ty::t); }
type binding = @{node_id: node_id,
span: span,
......@@ -46,7 +46,7 @@ fn mk_binding(cx: ctx, id: node_id, span: span, root_var: option::t<node_id>,
mutable copied: not_copied};
}
tag local_info { local(uint); }
enum local_info { local(uint); }
type copy_map = std::map::hashmap<node_id, ()>;
type ref_map = std::map::hashmap<node_id, node_id>;
......
......@@ -4,7 +4,7 @@
import syntax::ast_util;
import syntax::{visit, codemap};
tag ast_node {
enum ast_node {
node_item(@item);
node_native_item(@native_item);
node_method(@method);
......
......@@ -12,7 +12,7 @@
export cap_drop;
export cap_ref;
tag capture_mode {
enum capture_mode {
cap_copy; //< Copy the value into the closure.
cap_move; //< Move the value into the closure.
cap_drop; //< Drop value after creating closure.
......
......@@ -108,7 +108,7 @@ fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
type metadata_cache = hashmap<int, [debug_metadata]>;
tag debug_metadata {
enum debug_metadata {
file_metadata(@metadata<file_md>);
compile_unit_metadata(@metadata<compile_unit_md>);
subprogram_metadata(@metadata<subprogram_md>);
......
......@@ -26,8 +26,8 @@
// Marks expr_paths that are last uses.
type last_uses = std::map::hashmap<node_id, ()>;
tag seen { unset; seen(node_id); }
tag block_type { func; loop; }
enum seen { unset; seen(node_id); }
enum block_type { func; loop; }
type set = [{def: node_id, exprs: list<node_id>}];
type bl = @{type: block_type, mutable second: bool, mutable exits: [set]};
......
......@@ -5,7 +5,7 @@
import syntax::ast_util;
import driver::session::session;
tag deref_t { unbox; field; index; }
enum deref_t { unbox; field; index; }
type deref = @{mut: bool, kind: deref_t, outer_t: ty::t};
......@@ -121,7 +121,7 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) -> mut_map {
ret cx.mut_map;
}
tag msg { msg_assign; msg_move_out; msg_mut_ref; }
enum msg { msg_assign; msg_move_out; msg_mut_ref; }
fn mk_err(cx: @ctx, span: syntax::codemap::span, msg: msg, name: str) {
cx.tcx.sess.span_err(span, alt msg {
......
......@@ -30,7 +30,7 @@
// locates all names (in expressions, types, and alt patterns) and resolves
// them, storing the resulting def in the AST nodes.
tag scope {
enum scope {
scope_crate;
scope_item(@ast::item);
scope_bare_fn(ast::fn_decl, node_id, [ast::ty_param]);
......@@ -44,7 +44,7 @@
type scopes = list<scope>;
tag import_state {
enum import_state {
todo(ast::node_id, ast::ident, @[ast::ident], codemap::span, scopes);
is_glob(@[ast::ident], scopes, codemap::span);
resolving(span);
......@@ -56,7 +56,7 @@
ast::ident, codemap::span);
}
tag glob_import_state {
enum glob_import_state {
glob_resolving(span);
glob_resolved(option::t<def>, /* value */
option::t<def>, /* type */
......@@ -98,12 +98,12 @@ fn eq(v1: key, v2: key) -> bool {
ret std::map::mk_hashmap::<key, def>(hash, eq);
}
tag mod_index_entry {
enum mod_index_entry {
mie_view_item(@ast::view_item);
mie_import_ident(node_id, codemap::span);
mie_item(@ast::item);
mie_native_item(@ast::native_item);
mie_tag_variant(/* tag item */@ast::item, /* variant index */uint);
mie_tag_variant(/* enum item */@ast::item, /* variant index */uint);
}
type mod_index = hashmap<ident, list<mod_index_entry>>;
......@@ -151,14 +151,14 @@ fn eq(v1: key, v2: key) -> bool {
// Used to distinguish between lookups from outside and from inside modules,
// since export restrictions should only be applied for the former.
tag dir { inside; outside; }
enum dir { inside; outside; }
// There are two types of ns_value tag: "definitely a tag";
// There are two types of ns_value enum: "definitely a enum";
// and "any value". This is so that lookup can behave differently
// when looking up a variable name that's not yet in scope to check
// if it's already bound to a tag.
tag namespace { ns_val(ns_value_type); ns_type; ns_module; }
tag ns_value_type { ns_a_tag; ns_any_value; }
// if it's already bound to a enum.
enum namespace { ns_val(ns_value_type); ns_type; ns_module; }
enum ns_value_type { ns_a_tag; ns_any_value; }
fn resolve_crate(sess: session, amap: ast_map::map, crate: @ast::crate) ->
{def_map: def_map, exp_map: exp_map, impl_map: impl_map} {
......@@ -186,7 +186,7 @@ fn resolve_crate(sess: session, amap: ast_map::map, crate: @ast::crate) ->
resolve_names(e, crate);
resolve_impls(e, crate);
// check_for_collisions must happen after resolve_names so we
// don't complain if a pattern uses the same nullary tag twice
// don't complain if a pattern uses the same nullary enum twice
check_for_collisions(e, *crate);
if sess.opts.warn_unused_imports {
check_unused_imports(e);
......@@ -415,13 +415,13 @@ fn walk_pat(e: @env, pat: @ast::pat, sc: scopes, v: vt<scopes>) {
}
_ {
e.sess.span_err(p.span,
"not a tag variant: " +
"not a enum variant: " +
ast_util::path_name(p));
}
}
}
/* Here we determine whether a given pat_ident binds a new
variable a refers to a nullary tag. */
variable a refers to a nullary enum. */
ast::pat_ident(p, none) {
let fnd = lookup_in_scope(*e, sc, p.span, path_to_ident(p),
ns_val(ns_a_tag));
......@@ -557,13 +557,13 @@ fn visit_expr_with_scope(x: @ast::expr, sc: scopes, v: vt<scopes>) {
}
// This is only for irrefutable patterns (e.g. ones that appear in a let)
// So if x occurs, and x is already known to be a tag, that's always an error
// So if x occurs, and x is already known to be a enum, that's always an error
fn visit_local_with_scope(e: @env, loc: @local, sc:scopes, v:vt<scopes>) {
// Check whether the given local has the same name as a tag that's
// Check whether the given local has the same name as a enum that's
// in scope
// We disallow this, in order to make alt patterns consisting of
// a single identifier unambiguous (does the pattern "foo" refer
// to tag foo, or is it binding a new name foo?)
// to enum foo, or is it binding a new name foo?)
alt loc.node.pat.node {
pat_ident(an_ident,_) {
// Be sure to pass ns_a_tag to lookup_in_scope so that
......@@ -571,10 +571,10 @@ fn visit_local_with_scope(e: @env, loc: @local, sc:scopes, v:vt<scopes>) {
alt lookup_in_scope(*e, sc, loc.span,
path_to_ident(an_ident), ns_val(ns_a_tag)) {
some(ast::def_variant(tag_id,variant_id)) {
// Declaration shadows a tag that's in scope.
// Declaration shadows a enum that's in scope.
// That's an error.
e.sess.span_err(loc.span,
#fmt("Declaration of %s shadows a tag that's in scope",
#fmt("Declaration of %s shadows a enum that's in scope",
path_to_ident(an_ident)));
}
_ {}
......@@ -742,14 +742,14 @@ fn ns_name(ns: namespace) -> str {
ns_val(v) {
alt (v) {
ns_any_value { "name" }
ns_a_tag { "tag" }
ns_a_tag { "enum" }
}
}
ns_module { ret "modulename" }
}
}
tag ctxt { in_mod(def); in_scope(scopes); }
enum ctxt { in_mod(def); in_scope(scopes); }
fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) {
fn find_fn_or_mod_scope(sc: scopes) -> option::t<scope> {
......@@ -967,8 +967,8 @@ fn in_scope(e: env, sp: span, name: ident, s: scope, ns: namespace) ->
}
ns_val(v) {
alt(v) {
/* If we were looking for a tag, at this point
we know it's bound to a non-tag value, and
/* If we were looking for a enum, at this point
we know it's bound to a non-enum value, and
we can return none instead of failing */
ns_a_tag { ret none; }
_ { "attempted dynamic environment-capture" }
......@@ -1468,7 +1468,7 @@ fn ns_for_def(d: def) -> namespace {
}
// if we're searching for a value, it's ok if we found
// a tag
// a enum
fn ns_ok(wanted:namespace, actual:namespace) -> bool {
alt actual {
ns_val(ns_a_tag) {
......
......@@ -98,8 +98,8 @@ fn mk_global(ccx: @crate_ctxt, name: str, llval: ValueRef, internal: bool) ->
}
// Computes a set of variants of a tag that are guaranteed to have size and
// alignment at least as large as any other variant of the tag. This is an
// Computes a set of variants of a enum that are guaranteed to have size and
// alignment at least as large as any other variant of the enum. This is an
// important performance optimization.
//
// TODO: Use this in dynamic_size_of() as well.
......@@ -180,7 +180,7 @@ fn largest_variants(ccx: @crate_ctxt, tag_id: ast::def_id) -> [uint] {
ret result;
}
// Computes the static size of a tag, without using mk_tup(), which is
// Computes the static size of a enum, without using mk_tup(), which is
// bad for performance.
//
// TODO: Migrate trans over to use this.
......@@ -217,8 +217,8 @@ fn compute_static_tag_size(ccx: @crate_ctxt, largest_variants: [uint],
if max_align < variant_align { max_align = variant_align; }
}
// Add space for the tag if applicable.
// FIXME (issue #792): This is wrong. If the tag starts with an 8 byte
// Add space for the enum if applicable.
// FIXME (issue #792): This is wrong. If the enum starts with an 8 byte
// aligned quantity, we don't align it.
if vec::len(*variants) > 1u {
let variant_t = T_tag_variant(ccx);
......@@ -230,7 +230,7 @@ fn compute_static_tag_size(ccx: @crate_ctxt, largest_variants: [uint],
ret {size: max_size, align: max_align};
}
tag tag_kind { tk_unit; tk_enum; tk_complex; }
enum tag_kind { tk_unit; tk_enum; tk_complex; }
fn tag_kind(ccx: @crate_ctxt, did: ast::def_id) -> tag_kind {
let variants = ty::tag_variants(ccx.tcx, did);
......@@ -469,7 +469,7 @@ fn shape_of_variant(ccx: @crate_ctxt, v: ty::variant_info,
//}
fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
// Loop over all the tag variants and write their shapes into a data
// Loop over all the enum variants and write their shapes into a data
// buffer. As we do this, it's possible for us to discover new tags, so we
// must do this first.
let i = 0u;
......@@ -495,7 +495,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
}
// Now calculate the sizes of the header space (which contains offsets to
// info records for each tag) and the info space (which contains offsets
// info records for each enum) and the info space (which contains offsets
// to each variant shape). As we do so, build up the header.
let header = [];
......@@ -512,7 +512,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
}
// Construct the info tables, which contain offsets to the shape of each
// variant. Also construct the largest-variant table for each tag, which
// variant. Also construct the largest-variant table for each enum, which
// contains the variants that the size-of operation needs to look at.
let lv_table = [];
......@@ -530,7 +530,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
add_u16(lv_table, vec::len(lv) as u16);
for v: uint in lv { add_u16(lv_table, v as u16); }
// Determine whether the tag has dynamic size.
// Determine whether the enum has dynamic size.
let dynamic = false;
for variant: ty::variant_info in *variants {
for typ: ty::t in variant.args {
......@@ -538,7 +538,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
}
}
// If we can, write in the static size and alignment of the tag.
// If we can, write in the static size and alignment of the enum.
// Otherwise, write a placeholder.
let size_align;
if dynamic {
......
......@@ -498,7 +498,7 @@ fn simplifier(ccx: @crate_ctxt, typ: ty::t) -> ty::t {
}
// Computes the size of the data part of a non-dynamically-sized tag.
// Computes the size of the data part of a non-dynamically-sized enum.
fn static_size_of_tag(cx: @crate_ctxt, sp: span, t: ty::t)
: type_has_static_size(cx, t) -> uint {
if cx.tag_sizes.contains_key(t) { ret cx.tag_sizes.get(t); }
......@@ -526,7 +526,7 @@ fn static_size_of_tag(cx: @crate_ctxt, sp: span, t: ty::t)
ret max_size;
}
_ {
cx.tcx.sess.span_fatal(sp, "non-tag passed to static_size_of_tag()");
cx.tcx.sess.span_fatal(sp, "non-enum passed to static_size_of_tag()");
}
}
}
......@@ -736,9 +736,9 @@ fn compute_off(bcx: @block_ctxt,
}
// Replacement for the LLVM 'GEP' instruction when field indexing into a tag.
// Replacement for the LLVM 'GEP' instruction when field indexing into a enum.
// This function uses GEP_tup_like() above and automatically performs casts as
// appropriate. @llblobptr is the data part of a tag value; its actual type is
// appropriate. @llblobptr is the data part of a enum value; its actual type is
// meaningless, as it will be cast away.
fn GEP_tag(cx: @block_ctxt, llblobptr: ValueRef, tag_id: ast::def_id,
variant_id: ast::def_id, ty_substs: [ty::t],
......@@ -1470,7 +1470,7 @@ fn maybe_name_value(cx: @crate_ctxt, v: ValueRef, s: str) {
// Used only for creating scalar comparison glue.
tag scalar_type { nil_type; signed_int; unsigned_int; floating_point; }
enum scalar_type { nil_type; signed_int; unsigned_int; floating_point; }
fn compare_scalar_types(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef,
......@@ -1658,14 +1658,14 @@ fn iter_variant(cx: @block_ctxt, a_tup: ValueRef,
// NB: we must hit the discriminant first so that structural
// comparison know not to proceed when the discriminants differ.
cx = f(cx, lldiscrim_a_ptr, ty::mk_int(bcx_tcx(cx)));
let unr_cx = new_sub_block_ctxt(cx, "tag-iter-unr");
let unr_cx = new_sub_block_ctxt(cx, "enum-iter-unr");
Unreachable(unr_cx);
let llswitch = Switch(cx, lldiscrim_a, unr_cx.llbb, n_variants);
let next_cx = new_sub_block_ctxt(cx, "tag-iter-next");
let next_cx = new_sub_block_ctxt(cx, "enum-iter-next");
for variant: ty::variant_info in *variants {
let variant_cx =
new_sub_block_ctxt(cx,
"tag-iter-variant-" +
"enum-iter-variant-" +
int::to_str(variant.disr_val, 10u));
AddCase(llswitch, C_int(ccx, variant.disr_val), variant_cx.llbb);
variant_cx =
......@@ -1938,7 +1938,7 @@ fn memmove_ty(bcx: @block_ctxt, dst: ValueRef, src: ValueRef, t: ty::t) ->
ret call_memmove(bcx, dst, src, llsz).bcx;
}
tag copy_action { INIT; DROP_EXISTING; }
enum copy_action { INIT; DROP_EXISTING; }
// These are the types that are passed by pointer.
fn type_is_structural_or_param(tcx: ty::ctxt, t: ty::t) -> bool {
......@@ -2244,7 +2244,7 @@ fn autoderef(cx: @block_ctxt, v: ValueRef, t: ty::t) -> result_t {
t1 = mt.ty;
// Since we're changing levels of box indirection, we may have
// to cast this pointer, since statically-sized tag types have
// to cast this pointer, since statically-sized enum types have
// different types depending on whether they're behind a box
// or not.
if check type_has_static_size(ccx, t1) {
......@@ -2330,7 +2330,7 @@ fn trans_binary(cx: @block_ctxt, op: ast::binop, a: @ast::expr, b: @ast::expr,
}
}
tag dest {
enum dest {
by_val(@mutable ValueRef);
save_in(ValueRef);
ignore;
......@@ -2495,14 +2495,14 @@ fn trans_do_while(cx: @block_ctxt, body: ast::blk, cond: @ast::expr) ->
origins: option::t<typeck::dict_res>
};
tag lval_kind {
enum lval_kind {
temporary; //< Temporary value passed by value if of immediate type
owned; //< Non-temporary value passed by pointer
owned_imm; //< Non-temporary value passed by value
}
type local_var_result = {val: ValueRef, kind: lval_kind};
type lval_result = {bcx: @block_ctxt, val: ValueRef, kind: lval_kind};
tag callee_env {
enum callee_env {
null_env;
is_closure;
self_env(ValueRef);
......@@ -2896,7 +2896,7 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id,
check (type_has_static_size(ccx, t_out));
let ll_t_out = type_of(ccx, e.span, t_out);
tag kind { pointer; integral; float; tag_; other; }
enum kind { pointer; integral; float; tag_; other; }
fn t_kind(tcx: ty::ctxt, t: ty::t) -> kind {
ret if ty::type_is_fp(tcx, t) {
float
......@@ -3540,7 +3540,7 @@ fn trans_expr(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt {
ret trans_ret(bcx, ex);
}
ast::expr_be(ex) {
// Ideally, the expr_be tag would have a precondition
// Ideally, the expr_be enum would have a precondition
// that is_call_expr(ex) -- but we don't support that
// yet
// FIXME
......@@ -4409,7 +4409,7 @@ fn finish_fn(fcx: @fn_ctxt, lltop: BasicBlockRef) {
RetVoid(ret_cx);
}
tag self_arg { impl_self(ty::t); no_self; }
enum self_arg { impl_self(ty::t); no_self; }
// trans_closure: Builds an LLVM function out of a source function.
// If the function closes over its environment a closure will be
......@@ -4557,7 +4557,7 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
let lltop = bcx.llbb;
bcx = copy_args_to_allocas(fcx, bcx, fn_args, arg_tys);
// Cast the tag to a type we can GEP into.
// Cast the enum to a type we can GEP into.
let llblobptr =
if is_degen {
fcx.llretptr
......@@ -4576,7 +4576,7 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
let rslt = GEP_tag(bcx, llblobptr, t_id, v_id, ty_param_substs, i);
bcx = rslt.bcx;
let lldestptr = rslt.val;
// If this argument to this function is a tag, it'll have come in to
// If this argument to this function is a enum, it'll have come in to
// this function as an opaque blob due to the way that type_of()
// works. So we have to cast to the destination's view of the type.
let llarg = alt fcx.llargs.find(va.id) { some(local_mem(x)) { x } };
......@@ -5222,7 +5222,7 @@ fn collect_item(ccx: @crate_ctxt, abi: @mutable option::t<ast::native_abi>,
for variant in variants {
if vec::len(variant.node.args) != 0u {
register_fn(ccx, i.span, new_pt + [variant.node.name],
"tag", tps, variant.node.id);
"enum", tps, variant.node.id);
}
}
}
......
......@@ -16,8 +16,8 @@
import trans_common::*;
// An option identifying a branch (either a literal, a tag variant or a range)
tag opt {
// An option identifying a branch (either a literal, a enum variant or a range)
enum opt {
lit(@ast::expr);
var(/* disr val */int, /* variant dids */{tg: def_id, var: def_id});
range(@ast::expr, @ast::expr);
......@@ -34,7 +34,7 @@ fn opt_eq(a: opt, b: opt) -> bool {
}
}
tag opt_result {
enum opt_result {
single_result(result);
range_result(result, result);
}
......@@ -284,7 +284,7 @@ fn extract_variant_args(bcx: @block_ctxt, pat_id: ast::node_id,
let r =
// invariant needed:
// how do we know it even makes sense to pass in ty_param_substs
// here? What if it's [] and the tag type has variables in it?
// here? What if it's [] and the enum type has variables in it?
trans::GEP_tag(bcx, blobptr, vdefs_tg, vdefs_var, ty_param_substs,
i);
bcx = r.bcx;
......@@ -472,7 +472,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
// Decide what kind of branch we need
let opts = get_options(ccx, m, col);
tag branch_kind { no_branch; single; switch; compare; }
enum branch_kind { no_branch; single; switch; compare; }
let kind = no_branch;
let test_val = val;
if vec::len(opts) > 0u {
......
......@@ -109,7 +109,7 @@
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tag environment_value {
enum environment_value {
// Evaluate expr and store result in env (used for bind).
env_expr(@ast::expr);
......
......@@ -32,7 +32,7 @@ fn new_namegen() -> namegen {
type derived_tydesc_info = {lltydesc: ValueRef, escapes: bool};
tag tydesc_kind {
enum tydesc_kind {
tk_static; // Static (monomorphic) type descriptor
tk_param; // Type parameter.
tk_derived; // Derived from a typaram or another derived tydesc.
......@@ -131,7 +131,7 @@ fn new_namegen() -> namegen {
// Types used for llself.
type val_self_pair = {v: ValueRef, t: ty::t};
tag local_val { local_mem(ValueRef); local_imm(ValueRef); }
enum local_val { local_mem(ValueRef); local_imm(ValueRef); }
type fn_ty_param = {desc: ValueRef, dicts: option::t<[ValueRef]>};
......@@ -242,7 +242,7 @@ fn new_namegen() -> namegen {
sp: span,
lcx: @local_ctxt};
tag cleanup {
enum cleanup {
clean(fn@(@block_ctxt) -> @block_ctxt);
clean_temp(ValueRef, fn@(@block_ctxt) -> @block_ctxt);
}
......@@ -331,7 +331,7 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t)
did), f_t);
}
tag block_kind {
enum block_kind {
// A scope block is a basic block created by translating a block { ... }
......@@ -387,8 +387,8 @@ fn get_res_dtor(ccx: @crate_ctxt, sp: span, did: ast::def_id, inner_t: ty::t)
fcx: @fn_ctxt};
// FIXME: we should be able to use option::t<@block_parent> here but
// the infinite-tag check in rustboot gets upset.
tag block_parent { parent_none; parent_some(@block_ctxt); }
// the infinite-enum check in rustboot gets upset.
enum block_parent { parent_none; parent_some(@block_ctxt); }
type result = {bcx: @block_ctxt, val: ValueRef};
type result_t = {bcx: @block_ctxt, val: ValueRef, ty: ty::t};
......@@ -885,7 +885,7 @@ fn C_shape(ccx: @crate_ctxt, bytes: [u8]) -> ValueRef {
}
// Used to identify cached dictionaries
tag dict_param {
enum dict_param {
dict_param_dict(dict_id);
dict_param_ty(ty::t);
}
......
......@@ -22,7 +22,7 @@
// Used to communicate which operands should be invalidated
// to helper functions
tag oper_type {
enum oper_type {
oper_move;
oper_swap;
oper_assign;
......@@ -198,7 +198,7 @@ fn print_idents(&idents: [ident]) {
// for this local.
type constr_arg_use = spanned<constr_arg_general_<inst>>;
tag constraint {
enum constraint {
cinit(uint, span, ident);
// FIXME: really only want it to be mutable during collect_locals.
......@@ -211,7 +211,7 @@ fn print_idents(&idents: [ident]) {
// predicate need not be local.
// FIXME: would be nice to give both a def_id field,
// and give ninit a constraint saying it's local.
tag tsconstr {
enum tsconstr {
ninit(node_id, ident);
npred(@path, def_id, [@constr_arg_use]);
}
......@@ -780,7 +780,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_<inst>] {
ret rslt;
}
tag if_ty { if_check; plain_if; }
enum if_ty { if_check; plain_if; }
fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) ->
def_id {
......
......@@ -30,7 +30,7 @@
*/
type t = {uncertain: bitv::t, val: bitv::t, nbits: uint};
tag trit { ttrue; tfalse; dont_care; }
enum trit { ttrue; tfalse; dont_care; }
fn create_tritv(len: uint) -> t {
ret {uncertain: bitv::create(len, true),
......
......@@ -235,7 +235,7 @@
type t = uint;
tag closure_kind {
enum closure_kind {
ck_any;
ck_block;
ck_box;
......@@ -250,7 +250,7 @@
// NB: If you change this, you'll probably want to change the corresponding
// AST structure in front/ast::rs as well.
tag sty {
enum sty {
ty_nil;
ty_bot;
ty_bool;
......@@ -271,7 +271,7 @@
ty_tup([t]);
ty_var(int); // type variable
ty_param(uint, def_id); // fn/tag type param
ty_param(uint, def_id); // fn/enum type param
ty_type; // type_desc*
ty_send_type; // type_desc* that has been cloned into exchange heap
......@@ -288,7 +288,7 @@
type constr = constr_general<uint>;
// Data structures used in type unification
tag type_err {
enum type_err {
terr_mismatch;
terr_ret_style_mismatch(ast::ret_style, ast::ret_style);
terr_box_mutability;
......@@ -303,7 +303,7 @@
terr_constr_mismatch(@type_constr, @type_constr);
}
tag param_bound {
enum param_bound {
bound_copy;
bound_send;
bound_iface(t);
......@@ -712,7 +712,7 @@ fn walk_ty(cx: ctxt, walker: ty_walk, ty: t) {
walker(ty);
}
tag fold_mode {
enum fold_mode {
fm_var(fn@(int) -> t);
fm_param(fn@(uint, def_id) -> t);
fm_general(fn@(t) -> t);
......@@ -973,7 +973,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool {
ret result;
}
tag kind { kind_sendable; kind_copyable; kind_noncopyable; }
enum kind { kind_sendable; kind_copyable; kind_noncopyable; }
// Using these query functons is preferable to direct comparison or matching
// against the kind constants, as we may modify the kind hierarchy in the
......@@ -1245,7 +1245,7 @@ fn type_is_tag(cx: ctxt, ty: t) -> bool {
}
}
// Whether a type is enum like, that is a tag type with only nullary
// Whether a type is enum like, that is a enum type with only nullary
// constructors
fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
alt struct(cx, ty) {
......@@ -1732,16 +1732,16 @@ mod unify {
export var_bindings;
export precise, in_bindings;
tag result { ures_ok(t); ures_err(type_err); }
tag union_result { unres_ok; unres_err(type_err); }
tag fixup_result {
enum result { ures_ok(t); ures_err(type_err); }
enum union_result { unres_ok; unres_err(type_err); }
enum fixup_result {
fix_ok(t); // fixup succeeded
fix_err(int); // fixup failed because a type variable was unresolved
}
type var_bindings =
{sets: ufind::ufind, types: smallintmap::smallintmap<t>};
tag unify_style {
enum unify_style {
precise;
in_bindings(@var_bindings);
}
......@@ -2041,7 +2041,7 @@ fn resolve_type_structure(tcx: ty_ctxt, vb: @var_bindings, typ: t) ->
}
// Specifies the allowable subtyping between expected and actual types
tag variance {
enum variance {
// Actual may be a subtype of expected
covariant;
// Actual may be a supertype of expected
......@@ -2676,7 +2676,7 @@ fn tag_variants(cx: ctxt, id: ast::def_id) -> @[variant_info] {
}
// Returns information about the tag variant with the given ID:
// Returns information about the enum variant with the given ID:
fn tag_variant_with_id(cx: ctxt, tag_id: ast::def_id, variant_id: ast::def_id)
-> variant_info {
let variants = tag_variants(cx, tag_id);
......
......@@ -23,7 +23,7 @@
export method_map, method_origin, method_static, method_param, method_iface;
export dict_map, dict_res, dict_origin, dict_static, dict_param, dict_iface;
tag method_origin {
enum method_origin {
method_static(ast::def_id);
// iface id, method num, param num, bound num
method_param(ast::def_id, uint, uint, uint);
......@@ -33,7 +33,7 @@
// Resolutions for bounds of all parameters, left to right, for a given path.
type dict_res = @[dict_origin];
tag dict_origin {
enum dict_origin {
dict_static(ast::def_id, [ty::t], dict_res);
// Param number, bound number
dict_param(uint, uint);
......@@ -44,7 +44,7 @@
type ty_table = hashmap<ast::def_id, ty::t>;
// Used for typechecking the methods of an impl
tag self_info {
enum self_info {
self_impl(ty::t);
}
......@@ -231,7 +231,7 @@ fn default_arg_mode_for_ty(tcx: ty::ctxt, m: ast::mode,
}
}
tag mode { m_collect; m_check; m_check_tyvar(@fn_ctxt); }
enum mode { m_collect; m_check; m_check_tyvar(@fn_ctxt); }
fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
fn getter(tcx: ty::ctxt, mode: mode, id: ast::def_id)
......@@ -263,7 +263,7 @@ fn ast_arg_to_arg(tcx: ty::ctxt, mode: mode, arg: ast::arg)
some(none) {
tcx.sess.span_fatal(ast_ty.span,
"illegal recursive type \
insert a tag in the cycle, \
insert a enum in the cycle, \
if this is desired)");
}
none { }
......@@ -650,7 +650,7 @@ fn get_tag_variant_types(cx: @ctxt, tag_ty: ty::t,
// Create a set of parameter types shared among all the variants.
for variant: ast::variant in variants {
// Nullary tag constructors get turned into constants; n-ary tag
// Nullary enum constructors get turned into constants; n-ary enum
// constructors get turned into functions.
let result_ty = if vec::len(variant.node.args) == 0u {
......@@ -921,7 +921,7 @@ fn are_compatible(fcx: @fn_ctxt, expected: ty::t, actual: ty::t) -> bool {
}
// Returns the types of the arguments to a tag variant.
// Returns the types of the arguments to a enum variant.
fn variant_arg_types(ccx: @crate_ctxt, _sp: span, vid: ast::def_id,
tag_ty_params: [ty::t]) -> [ty::t] {
let result: [ty::t] = [];
......@@ -1243,10 +1243,10 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
let tag_tpt = ty::lookup_item_type(fcx.ccx.tcx, v_def_ids.tg);
let path_tpot = instantiate_path(fcx, path, tag_tpt, pat.span);
// Take the tag type params out of `expected`.
// Take the enum type params out of `expected`.
alt structure_of(fcx, pat.span, expected) {
ty::ty_tag(_, expected_tps) {
// Unify with the expected tag type.
// Unify with the expected enum type.
let ctor_ty =
ty::ty_param_substs_opt_and_ty_to_monotype(fcx.ccx.tcx,
path_tpot);
......@@ -1257,7 +1257,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
path_tpot =
{substs: some::<[ty::t]>(path_tpt.substs), ty: path_tpt.ty};
// Get the number of arguments in this tag variant.
// Get the number of arguments in this enum variant.
let arg_types =
variant_arg_types(fcx.ccx, pat.span, v_def_ids.var,
expected_tps);
......@@ -1267,7 +1267,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
let arg_len = vec::len::<ty::t>(arg_types);
if arg_len != subpats_len {
// TODO: note definition of tag variant
// TODO: note definition of enum variant
// TODO (issue #448): Wrap a #fmt string over multiple
// lines...
let s =
......@@ -1287,7 +1287,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
i += 1u;
}
} else if subpats_len > 0u {
// TODO: note definition of tag variant
// TODO: note definition of enum variant
fcx.ccx.tcx.sess.span_fatal
(pat.span,
#fmt["this pattern has %u field%s, \
......@@ -1305,7 +1305,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
// can never tell.
fcx.ccx.tcx.sess.span_fatal
(pat.span,
#fmt["mismatched types: expected `%s` but found tag",
#fmt["mismatched types: expected `%s` but found enum",
ty_to_str(fcx.ccx.tcx, expected)]);
}
}
......
......@@ -24,7 +24,7 @@
const local_crate: crate_num = 0;
const crate_node_id: node_id = 0;
tag ty_param_bound {
enum ty_param_bound {
bound_copy;
bound_send;
bound_iface(@ty);
......@@ -32,7 +32,7 @@
type ty_param = {ident: ident, id: node_id, bounds: @[ty_param_bound]};
tag def {
enum def {
def_fn(def_id, purity);
def_self(def_id);
def_mod(def_id);
......@@ -40,7 +40,7 @@
def_const(def_id);
def_arg(def_id, mode);
def_local(def_id, let_style);
def_variant(def_id /* tag */, def_id /* variant */);
def_variant(def_id /* enum */, def_id /* variant */);
def_ty(def_id);
def_ty_param(def_id, uint);
def_binding(def_id);
......@@ -62,13 +62,13 @@
attrs: [attribute],
config: crate_cfg};
tag crate_directive_ {
enum crate_directive_ {
cdir_src_mod(ident, [attribute]);
cdir_dir_mod(ident, [@crate_directive], [attribute]);
// NB: cdir_view_item is *not* processed by the rest of the compiler; the
// attached view_items are sunk into the crate's module during parsing,
// and processed (resolved, imported, etc.) there. This tag-variant exists
// and processed (resolved, imported, etc.) there. This enum-variant exists
// only to preserve the view items in order in case we decide to
// pretty-print crates in the future.
cdir_view_item(@view_item);
......@@ -80,7 +80,7 @@
type meta_item = spanned<meta_item_>;
tag meta_item_ {
enum meta_item_ {
meta_word(ident);
meta_list(ident, [@meta_item]);
meta_name_value(ident, lit);
......@@ -95,12 +95,12 @@
type field_pat = {ident: ident, pat: @pat};
tag pat_ {
enum pat_ {
pat_wild;
// A pat_ident may either be a new bound variable,
// or a nullary tag (in which case the second field
// or a nullary enum (in which case the second field
// is none).
// In the nullary tag case, the parser can't determine
// In the nullary enum case, the parser can't determine
// which it is. The resolver determines this, and
// records this pattern's node_id in an auxiliary
// set (of "pat_idents that refer to nullary tags")
......@@ -117,9 +117,9 @@
pat_range(@expr, @expr);
}
tag mutability { mut; imm; maybe_mut; }
enum mutability { mut; imm; maybe_mut; }
tag proto {
enum proto {
proto_bare; // native fn
proto_any; // fn
proto_uniq; // fn~
......@@ -134,7 +134,7 @@
}
}
tag binop {
enum binop {
add;
subtract;
mul;
......@@ -156,17 +156,17 @@
gt;
}
tag unop {
enum unop {
box(mutability);
uniq(mutability);
deref; not; neg;
}
tag mode { by_ref; by_val; by_mut_ref; by_move; by_copy; mode_infer; }
enum mode { by_ref; by_val; by_mut_ref; by_move; by_copy; mode_infer; }
type stmt = spanned<stmt_>;
tag stmt_ {
enum stmt_ {
stmt_decl(@decl, node_id);
// expr without trailing semi-colon (must have unit type):
......@@ -176,7 +176,7 @@
stmt_semi(@expr, node_id);
}
tag init_op { init_assign; init_move; }
enum init_op { init_assign; init_move; }
type initializer = {op: init_op, expr: @expr};
......@@ -187,9 +187,9 @@
type decl = spanned<decl_>;
tag let_style { let_copy; let_ref; }
enum let_style { let_copy; let_ref; }
tag decl_ { decl_local([(let_style, @local)]); decl_item(@item); }
enum decl_ { decl_local([(let_style, @local)]); decl_item(@item); }
type arm = {pats: [@pat], guard: option::t<@expr>, body: blk};
......@@ -197,13 +197,13 @@
type field = spanned<field_>;
tag blk_check_mode { default_blk; unchecked_blk; unsafe_blk; }
enum blk_check_mode { default_blk; unchecked_blk; unsafe_blk; }
tag expr_check_mode { claimed_expr; checked_expr; }
enum expr_check_mode { claimed_expr; checked_expr; }
type expr = {id: node_id, node: expr_, span: span};
tag expr_ {
enum expr_ {
expr_vec([@expr], mutability);
expr_rec([field], option::t<@expr>);
expr_call(@expr, [@expr], bool);
......@@ -267,7 +267,7 @@
/*
// Says whether this is a block the user marked as
// "unchecked"
tag blk_sort {
enum blk_sort {
blk_unchecked; // declared as "exception to effect-checking rules"
blk_checked; // all typing rules apply
}
......@@ -275,7 +275,7 @@
type mac = spanned<mac_>;
tag mac_ {
enum mac_ {
mac_invoc(@path, @expr, option::t<str>);
mac_embed_type(@ty);
mac_embed_block(blk);
......@@ -284,7 +284,7 @@
type lit = spanned<lit_>;
tag lit_ {
enum lit_ {
lit_str(str);
lit_int(i64, int_ty);
lit_uint(u64, uint_ty);
......@@ -303,15 +303,15 @@
type ty_method = {ident: ident, decl: fn_decl, tps: [ty_param], span: span};
tag int_ty { ty_i; ty_char; ty_i8; ty_i16; ty_i32; ty_i64; }
enum int_ty { ty_i; ty_char; ty_i8; ty_i16; ty_i32; ty_i64; }
tag uint_ty { ty_u; ty_u8; ty_u16; ty_u32; ty_u64; }
enum uint_ty { ty_u; ty_u8; ty_u16; ty_u32; ty_u64; }
tag float_ty { ty_f; ty_f32; ty_f64; }
enum float_ty { ty_f; ty_f32; ty_f64; }
type ty = spanned<ty_>;
tag ty_ {
enum ty_ {
ty_nil;
ty_bot; /* return type of ! functions and type of
ret/fail/break/cont. there is no syntax
......@@ -354,7 +354,7 @@
So, the constr_arg type is parameterized: it's instantiated with uint for
declarations, and ident for uses.
*/
tag constr_arg_general_<T> { carg_base; carg_ident(T); carg_lit(@lit); }
enum constr_arg_general_<T> { carg_base; carg_ident(T); carg_lit(@lit); }
type fn_constr_arg = constr_arg_general_<uint>;
type sp_constr_arg<T> = spanned<constr_arg_general_<T>>;
......@@ -389,13 +389,13 @@
cf: ret_style,
constraints: [@constr]};
tag purity {
enum purity {
pure_fn; // declared with "pure fn"
unsafe_fn; // declared with "unsafe fn"
impure_fn; // declared with "fn"
}
tag ret_style {
enum ret_style {
noreturn; // functions with return type _|_ that always
// raise an error or exit (i.e. never return to the caller)
return_val; // everything else
......@@ -406,7 +406,7 @@
type _mod = {view_items: [@view_item], items: [@item]};
tag native_abi {
enum native_abi {
native_abi_rust_intrinsic;
native_abi_cdecl;
native_abi_stdcall;
......@@ -433,7 +433,7 @@
type import_ident = spanned<import_ident_>;
tag view_item_ {
enum view_item_ {
view_item_use(ident, [@meta_item], node_id);
view_item_import(ident, @simple_path, node_id);
view_item_import_glob(@simple_path, node_id);
......@@ -448,14 +448,14 @@
// Distinguishes between attributes that decorate items and attributes that
// are contained as statements within items. These two cases need to be
// distinguished for pretty-printing.
tag attr_style { attr_outer; attr_inner; }
enum attr_style { attr_outer; attr_inner; }
type attribute_ = {style: attr_style, value: meta_item};
type item = {ident: ident, attrs: [attribute],
id: node_id, node: item_, span: span};
tag item_ {
enum item_ {
item_const(@ty, @expr);
item_fn(fn_decl, [ty_param], blk);
item_mod(_mod);
......@@ -476,7 +476,7 @@
id: node_id,
span: span};
tag native_item_ {
enum native_item_ {
native_item_ty;
native_item_fn(fn_decl, [ty_param]);
}
......
......@@ -201,7 +201,7 @@ fn ternary_to_if(e: @expr) -> @expr {
// FIXME this doesn't handle big integer/float literals correctly (nor does
// the rest of our literal handling)
tag const_val {
enum const_val {
const_float(float);
const_int(i64);
const_uint(u64);
......
......@@ -65,7 +65,7 @@ fn lookup_byte_pos(map: codemap, pos: uint) -> loc {
ret lookup_pos(map, pos, lookup);
}
tag opt_span {
enum opt_span {
//hack (as opposed to option::t), to make `span` compile
os_none;
......
......@@ -11,7 +11,7 @@
type macro_definer =
fn@(ext_ctxt, span, @ast::expr, option::t<str>) -> macro_def;
tag syntax_extension {
enum syntax_extension {
normal(syntax_expander);
macro_defining(macro_definer);
}
......
......@@ -25,10 +25,10 @@ fn path_to_ident(pth: @path) -> option::t<ident> {
type clause = {params: binders, body: @expr};
/* logically, an arb_depth should contain only one kind of matchable */
tag arb_depth<T> { leaf(T); seq(@[arb_depth<T>], span); }
enum arb_depth<T> { leaf(T); seq(@[arb_depth<T>], span); }
tag matchable {
enum matchable {
match_expr(@expr);
match_path(@path);
match_ident(ast::spanned<ident>);
......
......@@ -510,7 +510,7 @@ fn binop(rdr: reader, op: token::binop) -> token::token {
}
}
tag cmnt_style {
enum cmnt_style {
isolated; // No code on either side of each line of the comment
trailing; // Code exists to the left of the comment
mixed; // Code before /* foo */ and after the comment
......
......@@ -13,14 +13,14 @@
import lexer::reader;
import driver::diagnostic;
tag restriction {
enum restriction {
UNRESTRICTED;
RESTRICT_STMT_EXPR;
RESTRICT_NO_CALL_EXPRS;
RESTRICT_NO_BAR_OP;
}
tag file_type { CRATE_FILE; SOURCE_FILE; }
enum file_type { CRATE_FILE; SOURCE_FILE; }
type parse_sess = @{
cm: codemap::codemap,
......@@ -147,7 +147,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
"cont", "ret", "be", "fail", "type", "resource", "check",
"assert", "claim", "native", "fn", "pure",
"unsafe", "block", "import", "export", "let", "const",
"log", "copy", "sendfn", "impl", "iface", "enum"] {
"log", "copy", "sendfn", "impl", "iface", "tag", "enum"] {
words.insert(word, ());
}
words
......@@ -719,9 +719,9 @@ fn mk_lit_u32(p: parser, i: u32) -> @ast::expr {
// parsing because `(while{...})+3` parses differently from `while{...}+3`.
//
// To reflect the fact that the @ast::expr is not a true expr that should be
// part of the AST, we wrap such expressions in the pexpr tag. They
// part of the AST, we wrap such expressions in the pexpr enum. They
// can then be converted to true expressions by a call to `to_expr()`.
tag pexpr {
enum pexpr {
pexpr(@ast::expr);
}
......@@ -1508,7 +1508,7 @@ fn parse_pat(p: parser) -> @ast::pat {
}
_ { args = []; }
}
// at this point, we're not sure whether it's a tag or a bind
// at this point, we're not sure whether it's a enum or a bind
if vec::len(args) == 0u &&
vec::len(tag_path.node.idents) == 1u {
pat = ast::pat_ident(tag_path, none);
......@@ -2026,7 +2026,7 @@ fn parse_item_tag(p: parser, attrs: [ast::attribute]) -> @ast::item {
// Newtype syntax
if p.token == token::EQ {
if p.bad_expr_words.contains_key(id) {
p.fatal("found " + id + " in tag constructor position");
p.fatal("found " + id + " in enum constructor position");
}
p.bump();
let ty = parse_ty(p, false);
......
......@@ -5,7 +5,7 @@
type str_num = uint;
tag binop {
enum binop {
PLUS;
MINUS;
STAR;
......@@ -19,7 +19,7 @@
ASR;
}
tag token {
enum token {
/* Expression-operator symbols. */
EQ;
LT;
......
......@@ -55,13 +55,13 @@
* line (which it can't) and so naturally place the content on its own line to
* avoid combining it with other lines and making matters even worse.
*/
tag breaks { consistent; inconsistent; }
enum breaks { consistent; inconsistent; }
type break_t = {offset: int, blank_space: int};
type begin_t = {offset: int, breaks: breaks};
tag token { STRING(str, int); BREAK(break_t); BEGIN(begin_t); END; EOF; }
enum token { STRING(str, int); BREAK(break_t); BEGIN(begin_t); END; EOF; }
fn tok_str(t: token) -> str {
alt t {
......@@ -91,7 +91,7 @@ fn buf_str(toks: [mutable token], szs: [mutable int], left: uint, right: uint,
ret s;
}
tag print_stack_break { fits; broken(breaks); }
enum print_stack_break { fits; broken(breaks); }
type print_stack_elt = {offset: int, pbreak: print_stack_break};
......
......@@ -12,8 +12,8 @@
import driver::diagnostic;
// The ps is stored here to prevent recursive type.
// FIXME use a nominal tag instead
tag ann_node {
// FIXME use a nominal enum instead
enum ann_node {
node_block(ps, ast::blk);
node_item(ps, @ast::item);
node_expr(ps, @ast::expr);
......@@ -565,7 +565,7 @@ fn print_block_with_attrs(s: ps, blk: ast::blk, attrs: [ast::attribute]) {
print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs);
}
tag embed_type { block_macro; block_block_fn; block_normal; }
enum embed_type { block_macro; block_block_fn; block_normal; }
fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type,
indented: uint) {
......
......@@ -12,10 +12,10 @@
// override the context), or prevent deeper traversal by doing nothing.
// Our typesystem doesn't do circular types, so the visitor record can not
// hold functions that take visitors. A vt tag is used to break the cycle.
tag vt<E> { mk_vt(visitor<E>); }
// hold functions that take visitors. A vt enum is used to break the cycle.
enum vt<E> { mk_vt(visitor<E>); }
tag fn_kind {
enum fn_kind {
fk_item_fn(ident, [ty_param]); //< an item declared with fn()
fk_method(ident, [ty_param]);
fk_res(ident, [ty_param]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册