aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-20 21:38:23 +0100
committerGitHub <[email protected]>2019-09-20 21:38:23 +0100
commit0ebba70ea2dd56859409f5647f2b31b431789c8e (patch)
tree587046af983f7425729dc9c923635bcbdb74b14d /crates
parent07bbe57fefdf8d7041c8bdeb0f3feb7ca567c43b (diff)
parentfef7fcf5a95326fe7bcb0bb5e8a0c0e02f8421a9 (diff)
Merge #1890
1890: Support loop as argument r=matklad a=kjeremy Fixes #1839 Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs1
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rs5
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.txt59
3 files changed, 65 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs
index 6c7fdc2cd..457f42a26 100644
--- a/crates/ra_parser/src/grammar/expressions/atom.rs
+++ b/crates/ra_parser/src/grammar/expressions/atom.rs
@@ -54,6 +54,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet =
54 LIFETIME, 54 LIFETIME,
55 ASYNC_KW, 55 ASYNC_KW,
56 TRY_KW, 56 TRY_KW,
57 LOOP_KW
57 ]); 58 ]);
58 59
59const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; 60const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW];
diff --git a/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rs b/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rs
new file mode 100644
index 000000000..31c12522f
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rs
@@ -0,0 +1,5 @@
1fn foo(x: i32) {}
2
3fn main() {
4 foo(loop {});
5} \ No newline at end of file
diff --git a/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.txt b/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.txt
new file mode 100644
index 000000000..cc8c3f7ec
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.txt
@@ -0,0 +1,59 @@
1SOURCE_FILE@[0; 50)
2 FN_DEF@[0; 17)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 6)
6 IDENT@[3; 6) "foo"
7 PARAM_LIST@[6; 14)
8 L_PAREN@[6; 7) "("
9 PARAM@[7; 13)
10 BIND_PAT@[7; 8)
11 NAME@[7; 8)
12 IDENT@[7; 8) "x"
13 COLON@[8; 9) ":"
14 WHITESPACE@[9; 10) " "
15 PATH_TYPE@[10; 13)
16 PATH@[10; 13)
17 PATH_SEGMENT@[10; 13)
18 NAME_REF@[10; 13)
19 IDENT@[10; 13) "i32"
20 R_PAREN@[13; 14) ")"
21 WHITESPACE@[14; 15) " "
22 BLOCK_EXPR@[15; 17)
23 BLOCK@[15; 17)
24 L_CURLY@[15; 16) "{"
25 R_CURLY@[16; 17) "}"
26 WHITESPACE@[17; 19) "\n\n"
27 FN_DEF@[19; 50)
28 FN_KW@[19; 21) "fn"
29 WHITESPACE@[21; 22) " "
30 NAME@[22; 26)
31 IDENT@[22; 26) "main"
32 PARAM_LIST@[26; 28)
33 L_PAREN@[26; 27) "("
34 R_PAREN@[27; 28) ")"
35 WHITESPACE@[28; 29) " "
36 BLOCK_EXPR@[29; 50)
37 BLOCK@[29; 50)
38 L_CURLY@[29; 30) "{"
39 WHITESPACE@[30; 35) "\n "
40 EXPR_STMT@[35; 48)
41 CALL_EXPR@[35; 47)
42 PATH_EXPR@[35; 38)
43 PATH@[35; 38)
44 PATH_SEGMENT@[35; 38)
45 NAME_REF@[35; 38)
46 IDENT@[35; 38) "foo"
47 ARG_LIST@[38; 47)
48 L_PAREN@[38; 39) "("
49 LOOP_EXPR@[39; 46)
50 LOOP_KW@[39; 43) "loop"
51 WHITESPACE@[43; 44) " "
52 BLOCK_EXPR@[44; 46)
53 BLOCK@[44; 46)
54 L_CURLY@[44; 45) "{"
55 R_CURLY@[45; 46) "}"
56 R_PAREN@[46; 47) ")"
57 SEMI@[47; 48) ";"
58 WHITESPACE@[48; 49) "\n"
59 R_CURLY@[49; 50) "}"