From 6c913d8fa700c8ab58cf386dc958707a248f1379 Mon Sep 17 00:00:00 2001
From: Edwin Cheng <edwin0cheng@gmail.com>
Date: Tue, 23 Apr 2019 11:10:41 +0800
Subject: Add `...`  parsing for fn pointer type

---
 crates/ra_parser/src/grammar/params.rs | 4 ++--
 crates/ra_parser/src/grammar/types.rs  | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

(limited to 'crates/ra_parser/src')

diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs
index d027578b6..3d3bd4cc1 100644
--- a/crates/ra_parser/src/grammar/params.rs
+++ b/crates/ra_parser/src/grammar/params.rs
@@ -43,7 +43,7 @@ fn list_(p: &mut Parser, flavor: Flavor) {
     if flavor.type_required() {
         opt_self_param(p);
     }
-    while !p.at(EOF) && !p.at(ket) && !(flavor == Flavor::Normal && p.at(DOTDOTDOT)) {
+    while !p.at(EOF) && !p.at(ket) && !(flavor.type_required() && p.at(DOTDOTDOT)) {
         if !p.at_ts(VALUE_PARAMETER_FIRST) {
             p.error("expected value parameter");
             break;
@@ -55,7 +55,7 @@ fn list_(p: &mut Parser, flavor: Flavor) {
     }
     // test param_list_vararg
     // extern "C" { fn printf(format: *const i8, ...) -> i32; }
-    if flavor == Flavor::Normal {
+    if flavor.type_required() {
         p.eat(DOTDOTDOT);
     }
     p.expect(ket);
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs
index a46da9b44..686c80f3c 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/ra_parser/src/grammar/types.rs
@@ -166,6 +166,7 @@ fn placeholder_type(p: &mut Parser) {
 // type A = fn();
 // type B = unsafe fn();
 // type C = unsafe extern "C" fn();
+// type D = extern "C" fn ( u8 , ... ) -> u8;
 fn fn_pointer_type(p: &mut Parser) {
     let m = p.start();
     p.eat(UNSAFE_KW);
-- 
cgit v1.2.3