rustc: Change constraints in types to use interior vectors

This commit is contained in:
Patrick Walton 2011-07-01 15:50:32 -07:00
parent f391acbd3f
commit 8bee69da25
6 changed files with 47 additions and 42 deletions

View file

@ -65,13 +65,13 @@ fn parse_ty_or_bang(@pstate st, str_def sd) -> ty_or_bang {
}
}
fn parse_constrs(@pstate st, str_def sd) -> vec[@ty::constr_def] {
let vec[@ty::constr_def] rslt = [];
fn parse_constrs(@pstate st, str_def sd) -> (@ty::constr_def)[] {
let (@ty::constr_def)[] rslt = ~[];
alt (peek(st) as char) {
case (':') {
do {
next(st);
vec::push(rslt, parse_constr(st, sd));
rslt += ~[parse_constr(st, sd)];
} while (peek(st) as char == ';')
}
case (_) { }
@ -333,7 +333,7 @@ fn parse_hex(@pstate st) -> uint {
}
fn parse_ty_fn(@pstate st, str_def sd) ->
tup(ty::arg[], ty::t, ast::controlflow, vec[@ty::constr_def]) {
tup(ty::arg[], ty::t, ast::controlflow, (@ty::constr_def)[]) {
assert (next(st) as char == '[');
let ty::arg[] inputs = ~[];
while (peek(st) as char != ']') {

View file

@ -162,7 +162,7 @@ fn enc_sty(&io::writer w, &@ctxt cx, &ty::sty st) {
case (native_abi_cdecl) { w.write_char('c'); }
case (native_abi_llvm) { w.write_char('l'); }
}
enc_ty_fn(w, cx, args, out, return, []);
enc_ty_fn(w, cx, args, out, return, ~[]);
}
case (ty::ty_obj(?methods)) {
w.write_str("O[");
@ -205,7 +205,7 @@ fn enc_proto(&io::writer w, proto proto) {
}
}
fn enc_ty_fn(&io::writer w, &@ctxt cx, &ty::arg[] args, &ty::t out,
&controlflow cf, &vec[@ty::constr_def] constrs) {
&controlflow cf, &(@ty::constr_def)[] constrs) {
w.write_char('[');
for (ty::arg arg in args) {
alt (arg.mode) {