De-share ast::Ty

This commit is contained in:
James Miller 2013-07-06 16:57:11 +12:00
parent 46a1f54666
commit 47eca2113c
26 changed files with 256 additions and 255 deletions

View file

@ -824,7 +824,7 @@ impl Parser {
// parse a possibly mutable type
pub fn parse_mt(&self) -> mt {
let mutbl = self.parse_mutability();
let t = self.parse_ty(false);
let t = ~self.parse_ty(false);
mt { ty: t, mutbl: mutbl }
}
@ -835,7 +835,7 @@ impl Parser {
let mutbl = self.parse_mutability();
let id = self.parse_ident();
self.expect(&token::COLON);
let ty = self.parse_ty(false);
let ty = ~self.parse_ty(false);
spanned(
lo,
ty.span.hi,
@ -847,13 +847,13 @@ impl Parser {
}
// parse optional return type [ -> TY ] in function decl
pub fn parse_ret_ty(&self) -> (ret_style, @Ty) {
pub fn parse_ret_ty(&self) -> (ret_style, Ty) {
return if self.eat(&token::RARROW) {
let lo = self.span.lo;
if self.eat(&token::NOT) {
(
noreturn,
@Ty {
Ty {
id: self.get_id(),
node: ty_bot,
span: mk_sp(lo, self.last_span.hi)
@ -866,7 +866,7 @@ impl Parser {
let pos = self.span.lo;
(
return_val,
@Ty {
Ty {
id: self.get_id(),
node: ty_nil,
span: mk_sp(pos, pos),
@ -878,7 +878,7 @@ impl Parser {
// parse a type.
// Useless second parameter for compatibility with quasiquote macros.
// Bleh!
pub fn parse_ty(&self, _: bool) -> @Ty {
pub fn parse_ty(&self, _: bool) -> Ty {
maybe_whole!(self, nt_ty);
let lo = self.span.lo;
@ -975,7 +975,7 @@ impl Parser {
};
let sp = mk_sp(lo, self.last_span.hi);
@Ty {id: self.get_id(), node: t, span: sp}
Ty {id: self.get_id(), node: t, span: sp}
}
// parse the type following a @ or a ~
@ -1116,7 +1116,7 @@ impl Parser {
let t = if self.eat(&token::COLON) {
self.parse_ty(false)
} else {
@Ty {
Ty {
id: self.get_id(),
node: ty_infer,
span: mk_sp(self.span.lo, self.span.hi),
@ -1463,7 +1463,7 @@ impl Parser {
pub fn mk_method_call(&self,
rcvr: @expr,
ident: ident,
tps: ~[@Ty],
tps: ~[Ty],
args: ~[@expr],
sugar: CallSugar) -> ast::expr_ {
expr_method_call(self.get_id(), rcvr, ident, tps, args, sugar)
@ -1473,7 +1473,7 @@ impl Parser {
expr_index(self.get_id(), expr, idx)
}
pub fn mk_field(&self, expr: @expr, ident: ident, tys: ~[@Ty]) -> ast::expr_ {
pub fn mk_field(&self, expr: @expr, ident: ident, tys: ~[Ty]) -> ast::expr_ {
expr_field(expr, ident, tys)
}
@ -2215,7 +2215,7 @@ impl Parser {
// No argument list - `do foo {`
ast::fn_decl {
inputs: ~[],
output: @Ty {
output: Ty {
id: self.get_id(),
node: ty_infer,
span: *self.span
@ -2826,7 +2826,7 @@ impl Parser {
self.obsolete(*self.span, ObsoleteMutWithMultipleBindings)
}
let mut ty = @Ty {
let mut ty = Ty {
id: self.get_id(),
node: ty_infer,
span: mk_sp(lo, lo),
@ -3235,7 +3235,7 @@ impl Parser {
// parse a generic use site
fn parse_generic_values(
&self) -> (OptVec<ast::Lifetime>, ~[@Ty])
&self) -> (OptVec<ast::Lifetime>, ~[Ty])
{
if !self.eat(&token::LT) {
(opt_vec::Empty, ~[])
@ -3245,7 +3245,7 @@ impl Parser {
}
fn parse_generic_values_after_lt(
&self) -> (OptVec<ast::Lifetime>, ~[@Ty])
&self) -> (OptVec<ast::Lifetime>, ~[Ty])
{
let lifetimes = self.parse_lifetimes();
let result = self.parse_seq_to_gt(
@ -3455,7 +3455,7 @@ impl Parser {
let output = if self.eat(&token::RARROW) {
self.parse_ty(false)
} else {
@Ty { id: self.get_id(), node: ty_infer, span: *self.span }
Ty { id: self.get_id(), node: ty_infer, span: *self.span }
};
ast::fn_decl {
@ -4155,9 +4155,9 @@ impl Parser {
seq_sep_trailing_disallowed(token::COMMA),
|p| p.parse_ty(false)
);
for arg_tys.iter().advance |ty| {
for arg_tys.consume_iter().advance |ty| {
args.push(ast::variant_arg {
ty: *ty,
ty: ty,
id: self.get_id(),
});
}