diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-11 20:04:09 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-11 20:04:09 +0200 |
| commit | 28db7c5968ea15ad2c26d9267ab722994ae371c0 (patch) | |
| tree | f893dc94f7d5ca0fcd41e08ba94012dc46c5b73b /src/libsyntax/parse/parser.rs | |
| parent | 848ec4aa3c416a4b489fc2080f1a46e5e019a06f (diff) | |
| download | rust-28db7c5968ea15ad2c26d9267ab722994ae371c0.tar.gz rust-28db7c5968ea15ad2c26d9267ab722994ae371c0.zip | |
parser: move parse_fn_block_decl into expr.rs
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 52 |
1 files changed, 1 insertions, 51 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7ba3e7c4236..e2a41a80868 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -19,7 +19,7 @@ use crate::ast::{Mutability}; use crate::ast::StrStyle; use crate::ast::SelfKind; use crate::ast::{GenericParam, GenericParamKind, WhereClause}; -use crate::ast::{Ty, TyKind, GenericBounds}; +use crate::ast::{TyKind, GenericBounds}; use crate::ast::{Visibility, VisibilityKind, Unsafety, CrateSugar}; use crate::ext::base::DummyResult; use crate::ext::hygiene::SyntaxContext; @@ -1055,30 +1055,6 @@ impl<'a> Parser<'a> { Ok(Arg { attrs: attrs.into(), id: ast::DUMMY_NODE_ID, pat, span, ty }) } - /// Parses an argument in a lambda header (e.g., `|arg, arg|`). - fn parse_fn_block_arg(&mut self) -> PResult<'a, Arg> { - let lo = self.token.span; - let attrs = self.parse_arg_attributes()?; - let pat = self.parse_pat(Some("argument name"))?; - let t = if self.eat(&token::Colon) { - self.parse_ty()? - } else { - P(Ty { - id: ast::DUMMY_NODE_ID, - node: TyKind::Infer, - span: self.prev_span, - }) - }; - let span = lo.to(self.token.span); - Ok(Arg { - attrs: attrs.into(), - ty: t, - pat, - span, - id: ast::DUMMY_NODE_ID - }) - } - crate fn check_lifetime(&mut self) -> bool { self.expected_tokens.push(TokenType::Lifetime); self.token.is_lifetime() @@ -2148,32 +2124,6 @@ impl<'a> Parser<'a> { })) } - /// Parses the `|arg, arg|` header of a closure. - fn parse_fn_block_decl(&mut self) -> PResult<'a, P<FnDecl>> { - let inputs_captures = { - if self.eat(&token::OrOr) { - Vec::new() - } else { - self.expect(&token::BinOp(token::Or))?; - let args = self.parse_seq_to_before_tokens( - &[&token::BinOp(token::Or), &token::OrOr], - SeqSep::trailing_allowed(token::Comma), - TokenExpectType::NoExpect, - |p| p.parse_fn_block_arg() - )?.0; - self.expect_or()?; - args - } - }; - let output = self.parse_ret_ty(true)?; - - Ok(P(FnDecl { - inputs: inputs_captures, - output, - c_variadic: false - })) - } - fn choose_generics_over_qpath(&self) -> bool { // There's an ambiguity between generic parameters and qualified paths in impls. // If we see `<` it may start both, so we have to inspect some following tokens. |
