mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-23 16:00:10 +00:00
impl Parse for MethodTurbofish
This commit is contained in:
parent
e1ffb0756a
commit
6ae1c80118
50
src/expr.rs
50
src/expr.rs
@ -1603,27 +1603,7 @@ pub(crate) mod parsing {
|
||||
|
||||
let member: Member = input.parse()?;
|
||||
let turbofish = if member.is_named() && input.peek(Token![::]) {
|
||||
Some(MethodTurbofish {
|
||||
colon2_token: input.parse()?,
|
||||
lt_token: input.parse()?,
|
||||
args: {
|
||||
let mut args = Punctuated::new();
|
||||
loop {
|
||||
if input.peek(Token![>]) {
|
||||
break;
|
||||
}
|
||||
let value: GenericMethodArgument = input.parse()?;
|
||||
args.push_value(value);
|
||||
if input.peek(Token![>]) {
|
||||
break;
|
||||
}
|
||||
let punct = input.parse()?;
|
||||
args.push_punct(punct);
|
||||
}
|
||||
args
|
||||
},
|
||||
gt_token: input.parse()?,
|
||||
})
|
||||
Some(input.parse::<MethodTurbofish>()?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@ -2116,6 +2096,34 @@ pub(crate) mod parsing {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
|
||||
impl Parse for MethodTurbofish {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
Ok(MethodTurbofish {
|
||||
colon2_token: input.parse()?,
|
||||
lt_token: input.parse()?,
|
||||
args: {
|
||||
let mut args = Punctuated::new();
|
||||
loop {
|
||||
if input.peek(Token![>]) {
|
||||
break;
|
||||
}
|
||||
let value: GenericMethodArgument = input.parse()?;
|
||||
args.push_value(value);
|
||||
if input.peek(Token![>]) {
|
||||
break;
|
||||
}
|
||||
let punct = input.parse()?;
|
||||
args.push_punct(punct);
|
||||
}
|
||||
args
|
||||
},
|
||||
gt_token: input.parse()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
|
||||
impl Parse for ExprLet {
|
||||
|
Loading…
Reference in New Issue
Block a user