This commit is contained in:
Aleksey Kladov 2018-07-31 23:16:07 +03:00
parent 6953049e5f
commit d1400e95d7
9 changed files with 16 additions and 16 deletions

View File

@ -172,7 +172,7 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker {
fn lambda_expr(p: &mut Parser) -> CompletedMarker { fn lambda_expr(p: &mut Parser) -> CompletedMarker {
assert!(p.at(PIPE)); assert!(p.at(PIPE));
let m = p.start(); let m = p.start();
params::list_opt_types(p); params::param_list_opt_types(p);
if fn_ret_type(p) { if fn_ret_type(p) {
block(p); block(p);
} else { } else {

View File

@ -236,10 +236,10 @@ fn fn_item(p: &mut Parser) {
name(p); name(p);
// test fn_item_type_params // test fn_item_type_params
// fn foo<T: Clone + Copy>(){} // fn foo<T: Clone + Copy>(){}
type_params::list(p); type_params::type_param_list(p);
if p.at(L_PAREN) { if p.at(L_PAREN) {
params::list(p); params::param_list(p);
} else { } else {
p.error("expected function arguments"); p.error("expected function arguments");
} }
@ -265,7 +265,7 @@ fn type_item(p: &mut Parser) {
// test type_item_type_params // test type_item_type_params
// type Result<T> = (); // type Result<T> = ();
type_params::list(p); type_params::type_param_list(p);
// test type_item_where_clause // test type_item_where_clause
// type Foo where Foo: Copy = (); // type Foo where Foo: Copy = ();

View File

@ -5,7 +5,7 @@ pub(super) fn struct_item(p: &mut Parser) {
p.bump(); p.bump();
name(p); name(p);
type_params::list(p); type_params::type_param_list(p);
match p.current() { match p.current() {
WHERE_KW => { WHERE_KW => {
type_params::where_clause(p); type_params::where_clause(p);
@ -42,7 +42,7 @@ pub(super) fn enum_item(p: &mut Parser) {
assert!(p.at(ENUM_KW)); assert!(p.at(ENUM_KW));
p.bump(); p.bump();
name(p); name(p);
type_params::list(p); type_params::type_param_list(p);
type_params::where_clause(p); type_params::where_clause(p);
if p.expect(L_CURLY) { if p.expect(L_CURLY) {
while !p.at(EOF) && !p.at(R_CURLY) { while !p.at(EOF) && !p.at(R_CURLY) {

View File

@ -6,7 +6,7 @@ pub(super) fn trait_item(p: &mut Parser) {
assert!(p.at(TRAIT_KW)); assert!(p.at(TRAIT_KW));
p.bump(); p.bump();
name(p); name(p);
type_params::list(p); type_params::type_param_list(p);
if p.at(COLON) { if p.at(COLON) {
type_params::bounds(p); type_params::bounds(p);
} }
@ -21,7 +21,7 @@ pub(super) fn impl_item(p: &mut Parser) {
assert!(p.at(IMPL_KW)); assert!(p.at(IMPL_KW));
p.bump(); p.bump();
if choose_type_params_over_qpath(p) { if choose_type_params_over_qpath(p) {
type_params::list(p); type_params::type_param_list(p);
} }
// TODO: never type // TODO: never type

View File

@ -5,11 +5,11 @@ use super::*;
// fn b(x: i32) {} // fn b(x: i32) {}
// fn c(x: i32, ) {} // fn c(x: i32, ) {}
// fn d(x: i32, y: ()) {} // fn d(x: i32, y: ()) {}
pub(super) fn list(p: &mut Parser) { pub(super) fn param_list(p: &mut Parser) {
list_(p, true) list_(p, true)
} }
pub(super) fn list_opt_types(p: &mut Parser) { pub(super) fn param_list_opt_types(p: &mut Parser) {
list_(p, false) list_(p, false)
} }

View File

@ -71,7 +71,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
fn path_generic_args(p: &mut Parser, mode: Mode) { fn path_generic_args(p: &mut Parser, mode: Mode) {
match mode { match mode {
Mode::Use => return, Mode::Use => return,
Mode::Type => type_args::list(p, false), Mode::Type => type_args::type_arg_list(p, false),
Mode::Expr => type_args::list(p, true), Mode::Expr => type_args::type_arg_list(p, true),
} }
} }

View File

@ -1,6 +1,6 @@
use super::*; use super::*;
pub(super) fn list(p: &mut Parser, colon_colon_required: bool) { pub(super) fn type_arg_list(p: &mut Parser, colon_colon_required: bool) {
let m; let m;
match (colon_colon_required, p.nth(0), p.nth(1)) { match (colon_colon_required, p.nth(0), p.nth(1)) {
(_, COLONCOLON, L_ANGLE) => { (_, COLONCOLON, L_ANGLE) => {

View File

@ -1,6 +1,6 @@
use super::*; use super::*;
pub(super) fn list(p: &mut Parser) { pub(super) fn type_param_list(p: &mut Parser) {
if !p.at(L_ANGLE) { if !p.at(L_ANGLE) {
return; return;
} }

View File

@ -166,7 +166,7 @@ fn fn_pointer_type(p: &mut Parser) {
return; return;
} }
params::list(p); params::param_list(p);
// test fn_pointer_type_with_ret // test fn_pointer_type_with_ret
// type F = fn() -> (); // type F = fn() -> ();
fn_ret_type(p); fn_ret_type(p);
@ -179,7 +179,7 @@ fn for_type(p: &mut Parser) {
assert!(p.at(FOR_KW)); assert!(p.at(FOR_KW));
let m = p.start(); let m = p.start();
p.bump(); p.bump();
type_params::list(p); type_params::type_param_list(p);
type_(p); type_(p);
m.complete(p, FOR_TYPE); m.complete(p, FOR_TYPE);
} }