From 60ae1590af034755b5cb1e1e71f2240a710299a2 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Thu, 5 Jan 2012 15:35:37 +0100 Subject: Switch to new param kind bound syntax And remove support for the old syntax --- src/comp/syntax/ast_util.rs | 4 ++-- src/comp/syntax/ext/simplext.rs | 2 +- src/comp/syntax/parse/parser.rs | 18 ++++++++---------- src/comp/syntax/util/interner.rs | 6 +++--- 4 files changed, 14 insertions(+), 16 deletions(-) (limited to 'src/comp/syntax') diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index 7a77861ae0b..121abc1ce5c 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -1,7 +1,7 @@ import codemap::span; import ast::*; -fn respan(sp: span, t: T) -> spanned { +fn respan(sp: span, t: T) -> spanned { ret {node: t, span: sp}; } @@ -201,7 +201,7 @@ fn eq_def_id(&&a: def_id, &&b: def_id) -> bool { a == b } -fn new_def_id_hash() -> std::map::hashmap { +fn new_def_id_hash() -> std::map::hashmap { std::map::mk_hashmap(hash_def_id, eq_def_id) } diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index 371370c5eda..8f6f1a5828a 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -103,7 +103,7 @@ fn elts_to_ell(cx: ext_ctxt, elts: [@expr]) -> } } -fn option_flatten_map(f: fn@(T) -> option::t, v: [T]) -> +fn option_flatten_map(f: fn@(T) -> option::t, v: [T]) -> option::t<[U]> { let res = []; for elem: T in v { diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 990132e01bf..d9edeefd44d 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -210,7 +210,7 @@ fn expect_gt(p: parser) { } } -fn spanned(lo: uint, hi: uint, node: T) -> spanned { +fn spanned(lo: uint, hi: uint, node: T) -> spanned { ret {node: node, span: ast_util::mk_sp(lo, hi)}; } @@ -378,7 +378,7 @@ fn parse_constr_in_type(p: parser) -> @ast::ty_constr { } -fn parse_constrs(pser: block(parser) -> @ast::constr_general, +fn parse_constrs(pser: block(parser) -> @ast::constr_general, p: parser) -> [@ast::constr_general] { let constrs: [@ast::constr_general] = []; @@ -554,7 +554,7 @@ fn parse_fn_block_arg(p: parser) -> ast::arg { ret {mode: m, ty: t, ident: i, id: p.get_id()}; } -fn parse_seq_to_before_gt(sep: option::t, +fn parse_seq_to_before_gt(sep: option::t, f: block(parser) -> T, p: parser) -> [T] { let first = true; @@ -571,7 +571,7 @@ fn parse_seq_to_before_gt(sep: option::t, ret v; } -fn parse_seq_to_gt(sep: option::t, +fn parse_seq_to_gt(sep: option::t, f: block(parser) -> T, p: parser) -> [T] { let v = parse_seq_to_before_gt(sep, f, p); expect_gt(p); @@ -579,7 +579,7 @@ fn parse_seq_to_gt(sep: option::t, ret v; } -fn parse_seq_lt_gt(sep: option::t, +fn parse_seq_lt_gt(sep: option::t, f: block(parser) -> T, p: parser) -> spanned<[T]> { let lo = p.get_lo_pos(); @@ -590,7 +590,7 @@ fn parse_seq_lt_gt(sep: option::t, ret spanned(lo, hi, result); } -fn parse_seq_to_end(ket: token::token, sep: seq_sep, +fn parse_seq_to_end(ket: token::token, sep: seq_sep, f: block(parser) -> T, p: parser) -> [T] { let val = parse_seq_to_before_end(ket, sep, f, p); p.bump(); @@ -612,7 +612,7 @@ fn seq_sep_none() -> seq_sep { ret {sep: option::none, trailing_opt: false}; } -fn parse_seq_to_before_end(ket: token::token, +fn parse_seq_to_before_end(ket: token::token, sep: seq_sep, f: block(parser) -> T, p: parser) -> [T] { let first: bool = true; @@ -629,7 +629,7 @@ fn parse_seq_to_before_end(ket: token::token, } -fn parse_seq(bra: token::token, ket: token::token, +fn parse_seq(bra: token::token, ket: token::token, sep: seq_sep, f: block(parser) -> T, p: parser) -> spanned<[T]> { let lo = p.get_lo_pos(); @@ -1700,8 +1700,6 @@ fn parse_block_tail(p: parser, lo: uint, s: ast::blk_check_mode) -> ast::blk { fn parse_ty_param(p: parser) -> ast::ty_param { let bounds = []; - if eat_word(p, "send") { bounds += [ast::bound_send]; } - else if eat_word(p, "copy") { bounds += [ast::bound_copy]; } let ident = parse_ident(p); if eat(p, token::COLON) { while p.peek() != token::COMMA && p.peek() != token::GT { diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs index 2c1589085f2..ab411baaf5a 100644 --- a/src/comp/syntax/util/interner.rs +++ b/src/comp/syntax/util/interner.rs @@ -12,12 +12,12 @@ type interner = hasher: hashfn, eqer: eqfn}; -fn mk(hasher: hashfn, eqer: eqfn) -> interner { +fn mk(hasher: hashfn, eqer: eqfn) -> interner { let m = map::mk_hashmap::(hasher, eqer); ret {map: m, mutable vect: [], hasher: hasher, eqer: eqer}; } -fn intern(itr: interner, val: T) -> uint { +fn intern(itr: interner, val: T) -> uint { alt itr.map.find(val) { some(idx) { ret idx; } none. { @@ -32,7 +32,7 @@ fn intern(itr: interner, val: T) -> uint { // |get| isn't "pure" in the traditional sense, because it can go from // failing to returning a value as items are interned. But for typestate, // where we first check a pred and then rely on it, ceasing to fail is ok. -pure fn get(itr: interner, idx: uint) -> T { +pure fn get(itr: interner, idx: uint) -> T { unchecked { itr.vect[idx] } -- cgit 1.4.1-3-g733a5