diff options
| author | Graydon Hoare <[email protected]> | 2011-03-16 14:58:02 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-16 14:58:02 -0700 |
| commit | 54587bdccb7b6771cfc704a30fc0ef2c65824a15 (patch) | |
| tree | 6f154f9b038e9542b364e87ae887858a96bdb4a9 /src/comp/front | |
| parent | Add some more dlopen-related suppressions for the Mac (diff) | |
| download | rust-54587bdccb7b6771cfc704a30fc0ef2c65824a15.tar.xz rust-54587bdccb7b6771cfc704a30fc0ef2c65824a15.zip | |
Switch all vases of vec += elt to vec += vec. Prohibit former in rustboot. Tweak std lib vec fns in process.
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/eval.rs | 7 | ||||
| -rw-r--r-- | src/comp/front/extfmt.rs | 4 | ||||
| -rw-r--r-- | src/comp/front/lexer.rs | 14 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 20 | ||||
| -rw-r--r-- | src/comp/front/token.rs | 5 |
5 files changed, 24 insertions, 26 deletions
diff --git a/src/comp/front/eval.rs b/src/comp/front/eval.rs index ac249848..4cf3765f 100644 --- a/src/comp/front/eval.rs +++ b/src/comp/front/eval.rs @@ -13,7 +13,6 @@ import front.parser.new_parser; import front.parser.parse_mod_items; import util.common; import util.common.filename; -import util.common.append; import util.common.span; import util.common.new_str_hash; @@ -394,7 +393,7 @@ impure fn eval_crate_directive(parser p, auto im = ast.item_mod(id, m0, next_id); auto i = @spanned(cdir.span, cdir.span, im); ast.index_item(index, i); - append[@ast.item](items, i); + _vec.push[@ast.item](items, i); } case (ast.cdir_dir_mod(?id, ?dir_opt, ?cdirs)) { @@ -412,11 +411,11 @@ impure fn eval_crate_directive(parser p, auto im = ast.item_mod(id, m0, p.next_def_id()); auto i = @spanned(cdir.span, cdir.span, im); ast.index_item(index, i); - append[@ast.item](items, i); + _vec.push[@ast.item](items, i); } case (ast.cdir_view_item(?vi)) { - append[@ast.view_item](view_items, vi); + _vec.push[@ast.view_item](view_items, vi); ast.index_view_item(index, vi); } diff --git a/src/comp/front/extfmt.rs b/src/comp/front/extfmt.rs index 255614d0..0a32a851 100644 --- a/src/comp/front/extfmt.rs +++ b/src/comp/front/extfmt.rs @@ -113,7 +113,7 @@ fn parse_fmt_string(str s) -> vec[piece] { fn flush_buf(str buf, &vec[piece] pieces) -> str { if (_str.byte_len(buf) > 0u) { auto piece = piece_string(buf); - pieces += piece; + pieces += vec(piece); } ret ""; } @@ -133,7 +133,7 @@ fn parse_fmt_string(str s) -> vec[piece] { } else { buf = flush_buf(buf, pieces); auto res = parse_conversion(s, i, lim); - pieces += res._0; + pieces += vec(res._0); i = res._1; } } else { diff --git a/src/comp/front/lexer.rs b/src/comp/front/lexer.rs index 95fd32c7..403558e2 100644 --- a/src/comp/front/lexer.rs +++ b/src/comp/front/lexer.rs @@ -420,7 +420,7 @@ impure fn next_token(reader rdr) -> token.token { if (is_alpha(c) || c == '_') { while (is_alnum(c) || c == '_') { - accum_str += (c as u8); + _str.push_byte(accum_str, (c as u8)); rdr.bump(); c = rdr.curr(); } @@ -580,23 +580,23 @@ impure fn next_token(reader rdr) -> token.token { alt (rdr.next()) { case ('n') { rdr.bump(); - accum_str += '\n' as u8; + _str.push_byte(accum_str, '\n' as u8); } case ('r') { rdr.bump(); - accum_str += '\r' as u8; + _str.push_byte(accum_str, '\r' as u8); } case ('t') { rdr.bump(); - accum_str += '\t' as u8; + _str.push_byte(accum_str, '\t' as u8); } case ('\\') { rdr.bump(); - accum_str += '\\' as u8; + _str.push_byte(accum_str, '\\' as u8); } case ('"') { rdr.bump(); - accum_str += '"' as u8; + _str.push_byte(accum_str, '"' as u8); } // FIXME: unicode numeric escapes. case (?c2) { @@ -607,7 +607,7 @@ impure fn next_token(reader rdr) -> token.token { } } case (_) { - accum_str += rdr.curr() as u8; + _str.push_byte(accum_str, rdr.curr() as u8); } } rdr.bump(); diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index a5c79926..5e38345d 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -9,7 +9,6 @@ import std.map.hashmap; import driver.session; import util.common; import util.common.filename; -import util.common.append; import util.common.span; import util.common.new_str_hash; @@ -303,7 +302,7 @@ impure fn parse_constrs(parser p) -> common.spanned[vec[@ast.constr]] { case (token.IDENT(_)) { auto constr = parse_ty_constr(p); hi = constr.span; - append[@ast.constr](constrs, constr); + _vec.push[@ast.constr](constrs, constr); if (p.peek() == token.COMMA) { p.bump(); more = false; @@ -573,7 +572,7 @@ impure fn parse_path(parser p, greed g) -> ast.path { alt (p.peek()) { case (token.IDENT(?i)) { hi = p.get_span(); - ids += i; + ids += vec(i); p.bump(); if (p.peek() == token.DOT) { if (g == GREEDY) { @@ -699,7 +698,7 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr { } case (token.COMMA) { p.bump(); - fields += parse_field(p); + fields += vec(parse_field(p)); } case (?t) { unexpected(p, t); @@ -877,7 +876,7 @@ impure fn extend_expr_by_ident(parser p, span lo, span hi, case (ast.expr_path(?pth, ?def, ?ann)) { if (_vec.len[@ast.ty](pth.node.types) == 0u) { auto idents_ = pth.node.idents; - idents_ += i; + idents_ += vec(i); auto tys = parse_ty_args(p, hi); auto pth_ = spanned(pth.span, tys.span, rec(idents=idents_, @@ -1763,8 +1762,8 @@ impure fn parse_item_obj(parser p, ast.layer lyr) -> @ast.item { dtor = some[ast.block](parse_block(p)); } case (_) { - append[@ast.method](meths, - parse_method(p)); + _vec.push[@ast.method](meths, + parse_method(p)); } } } @@ -2161,12 +2160,11 @@ impure fn parse_rest_import_name(parser p, ast.ident first, -> @ast.view_item { auto lo = p.get_span(); auto hi = lo; - let vec[ast.ident] identifiers = vec(); - identifiers += first; + let vec[ast.ident] identifiers = vec(first); while (p.peek() != token.SEMI) { expect(p, token.DOT); auto i = parse_ident(p); - identifiers += i; + identifiers += vec(i); } p.bump(); auto defined_id; @@ -2402,7 +2400,7 @@ impure fn parse_crate_directives(parser p, token.token term) while (p.peek() != term) { auto cdir = @parse_crate_directive(p); - append[@ast.crate_directive](cdirs, cdir); + _vec.push[@ast.crate_directive](cdirs, cdir); } ret cdirs; diff --git a/src/comp/front/token.rs b/src/comp/front/token.rs index 8c594054..62c6406a 100644 --- a/src/comp/front/token.rs +++ b/src/comp/front/token.rs @@ -3,6 +3,7 @@ import util.common.ty_mach_to_str; import util.common.new_str_hash; import std._int; import std._uint; +import std._str; tag binop { PLUS; @@ -302,8 +303,8 @@ fn to_str(token t) -> str { case (LIT_CHAR(?c)) { // FIXME: escape and encode. auto tmp = "'"; - tmp += c as u8; - tmp += '\'' as u8; + _str.push_byte(tmp, c as u8); + _str.push_byte(tmp, '\'' as u8); ret tmp; } |