mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge #4257
4257: ast::EffectExpr r=matklad a=matklad closes #4230 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
75bc024946
212 changed files with 10656 additions and 10935 deletions
|
@ -180,7 +180,9 @@ trait Trait<T> {
|
|||
}
|
||||
|
||||
impl Trait<u32> for () {
|
||||
fn foo(&self) -> u32 { todo!() }
|
||||
fn foo(&self) -> u32 {
|
||||
todo!()
|
||||
}
|
||||
|
||||
}
|
||||
"#####,
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
use hir::HasSource;
|
||||
use ra_syntax::{
|
||||
ast::{self, edit, make, AstNode, NameOwner},
|
||||
ast::{
|
||||
self,
|
||||
edit::{self, IndentLevel},
|
||||
make, AstNode, NameOwner,
|
||||
},
|
||||
SmolStr,
|
||||
};
|
||||
|
||||
|
@ -40,7 +44,9 @@ enum AddMissingImplMembersMode {
|
|||
// }
|
||||
//
|
||||
// impl Trait<u32> for () {
|
||||
// fn foo(&self) -> u32 { todo!() }
|
||||
// fn foo(&self) -> u32 {
|
||||
// todo!()
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// ```
|
||||
|
@ -165,7 +171,9 @@ fn add_missing_impl_members_inner(
|
|||
|
||||
fn add_body(fn_def: ast::FnDef) -> ast::FnDef {
|
||||
if fn_def.body().is_none() {
|
||||
fn_def.with_body(make::block_from_expr(make::expr_todo()))
|
||||
let body = make::block_expr(None, Some(make::expr_todo()));
|
||||
let body = IndentLevel(1).increase_indent(body);
|
||||
fn_def.with_body(body)
|
||||
} else {
|
||||
fn_def
|
||||
}
|
||||
|
@ -181,7 +189,7 @@ mod tests {
|
|||
fn test_add_missing_impl_members() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo {
|
||||
type Output;
|
||||
|
||||
|
@ -197,8 +205,8 @@ struct S;
|
|||
impl Foo for S {
|
||||
fn bar(&self) {}
|
||||
<|>
|
||||
}",
|
||||
"
|
||||
}"#,
|
||||
r#"
|
||||
trait Foo {
|
||||
type Output;
|
||||
|
||||
|
@ -215,10 +223,14 @@ impl Foo for S {
|
|||
fn bar(&self) {}
|
||||
<|>type Output;
|
||||
const CONST: usize = 42;
|
||||
fn foo(&self) { todo!() }
|
||||
fn baz(&self) { todo!() }
|
||||
fn foo(&self) {
|
||||
todo!()
|
||||
}
|
||||
fn baz(&self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
}",
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -226,7 +238,7 @@ impl Foo for S {
|
|||
fn test_copied_overriden_members() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo {
|
||||
fn foo(&self);
|
||||
fn bar(&self) -> bool { true }
|
||||
|
@ -238,8 +250,8 @@ struct S;
|
|||
impl Foo for S {
|
||||
fn bar(&self) {}
|
||||
<|>
|
||||
}",
|
||||
"
|
||||
}"#,
|
||||
r#"
|
||||
trait Foo {
|
||||
fn foo(&self);
|
||||
fn bar(&self) -> bool { true }
|
||||
|
@ -250,9 +262,11 @@ struct S;
|
|||
|
||||
impl Foo for S {
|
||||
fn bar(&self) {}
|
||||
<|>fn foo(&self) { todo!() }
|
||||
<|>fn foo(&self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
}",
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -260,16 +274,18 @@ impl Foo for S {
|
|||
fn test_empty_impl_def() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo { fn foo(&self); }
|
||||
struct S;
|
||||
impl Foo for S { <|> }",
|
||||
"
|
||||
impl Foo for S { <|> }"#,
|
||||
r#"
|
||||
trait Foo { fn foo(&self); }
|
||||
struct S;
|
||||
impl Foo for S {
|
||||
<|>fn foo(&self) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -277,16 +293,18 @@ impl Foo for S {
|
|||
fn fill_in_type_params_1() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo<T> { fn foo(&self, t: T) -> &T; }
|
||||
struct S;
|
||||
impl Foo<u32> for S { <|> }",
|
||||
"
|
||||
impl Foo<u32> for S { <|> }"#,
|
||||
r#"
|
||||
trait Foo<T> { fn foo(&self, t: T) -> &T; }
|
||||
struct S;
|
||||
impl Foo<u32> for S {
|
||||
<|>fn foo(&self, t: u32) -> &u32 { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, t: u32) -> &u32 {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -294,16 +312,18 @@ impl Foo<u32> for S {
|
|||
fn fill_in_type_params_2() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo<T> { fn foo(&self, t: T) -> &T; }
|
||||
struct S;
|
||||
impl<U> Foo<U> for S { <|> }",
|
||||
"
|
||||
impl<U> Foo<U> for S { <|> }"#,
|
||||
r#"
|
||||
trait Foo<T> { fn foo(&self, t: T) -> &T; }
|
||||
struct S;
|
||||
impl<U> Foo<U> for S {
|
||||
<|>fn foo(&self, t: U) -> &U { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, t: U) -> &U {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -311,16 +331,18 @@ impl<U> Foo<U> for S {
|
|||
fn test_cursor_after_empty_impl_def() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo { fn foo(&self); }
|
||||
struct S;
|
||||
impl Foo for S {}<|>",
|
||||
"
|
||||
impl Foo for S {}<|>"#,
|
||||
r#"
|
||||
trait Foo { fn foo(&self); }
|
||||
struct S;
|
||||
impl Foo for S {
|
||||
<|>fn foo(&self) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -328,22 +350,24 @@ impl Foo for S {
|
|||
fn test_qualify_path_1() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar;
|
||||
trait Foo { fn foo(&self, bar: Bar); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo for S { <|> }",
|
||||
"
|
||||
impl foo::Foo for S { <|> }"#,
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar;
|
||||
trait Foo { fn foo(&self, bar: Bar); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo for S {
|
||||
<|>fn foo(&self, bar: foo::Bar) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, bar: foo::Bar) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -351,22 +375,24 @@ impl foo::Foo for S {
|
|||
fn test_qualify_path_generic() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar<T>;
|
||||
trait Foo { fn foo(&self, bar: Bar<u32>); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo for S { <|> }",
|
||||
"
|
||||
impl foo::Foo for S { <|> }"#,
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar<T>;
|
||||
trait Foo { fn foo(&self, bar: Bar<u32>); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo for S {
|
||||
<|>fn foo(&self, bar: foo::Bar<u32>) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, bar: foo::Bar<u32>) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -374,22 +400,24 @@ impl foo::Foo for S {
|
|||
fn test_qualify_path_and_substitute_param() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar<T>;
|
||||
trait Foo<T> { fn foo(&self, bar: Bar<T>); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo<u32> for S { <|> }",
|
||||
"
|
||||
impl foo::Foo<u32> for S { <|> }"#,
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar<T>;
|
||||
trait Foo<T> { fn foo(&self, bar: Bar<T>); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo<u32> for S {
|
||||
<|>fn foo(&self, bar: foo::Bar<u32>) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, bar: foo::Bar<u32>) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -398,15 +426,15 @@ impl foo::Foo<u32> for S {
|
|||
// when substituting params, the substituted param should not be qualified!
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
mod foo {
|
||||
trait Foo<T> { fn foo(&self, bar: T); }
|
||||
pub struct Param;
|
||||
}
|
||||
struct Param;
|
||||
struct S;
|
||||
impl foo::Foo<Param> for S { <|> }",
|
||||
"
|
||||
impl foo::Foo<Param> for S { <|> }"#,
|
||||
r#"
|
||||
mod foo {
|
||||
trait Foo<T> { fn foo(&self, bar: T); }
|
||||
pub struct Param;
|
||||
|
@ -414,8 +442,10 @@ mod foo {
|
|||
struct Param;
|
||||
struct S;
|
||||
impl foo::Foo<Param> for S {
|
||||
<|>fn foo(&self, bar: Param) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, bar: Param) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -423,15 +453,15 @@ impl foo::Foo<Param> for S {
|
|||
fn test_qualify_path_associated_item() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar<T>;
|
||||
impl Bar<T> { type Assoc = u32; }
|
||||
trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo for S { <|> }",
|
||||
"
|
||||
impl foo::Foo for S { <|> }"#,
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar<T>;
|
||||
impl Bar<T> { type Assoc = u32; }
|
||||
|
@ -439,8 +469,10 @@ mod foo {
|
|||
}
|
||||
struct S;
|
||||
impl foo::Foo for S {
|
||||
<|>fn foo(&self, bar: foo::Bar<u32>::Assoc) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, bar: foo::Bar<u32>::Assoc) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -448,15 +480,15 @@ impl foo::Foo for S {
|
|||
fn test_qualify_path_nested() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar<T>;
|
||||
pub struct Baz;
|
||||
trait Foo { fn foo(&self, bar: Bar<Baz>); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo for S { <|> }",
|
||||
"
|
||||
impl foo::Foo for S { <|> }"#,
|
||||
r#"
|
||||
mod foo {
|
||||
pub struct Bar<T>;
|
||||
pub struct Baz;
|
||||
|
@ -464,8 +496,10 @@ mod foo {
|
|||
}
|
||||
struct S;
|
||||
impl foo::Foo for S {
|
||||
<|>fn foo(&self, bar: foo::Bar<foo::Baz>) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, bar: foo::Bar<foo::Baz>) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -473,22 +507,24 @@ impl foo::Foo for S {
|
|||
fn test_qualify_path_fn_trait_notation() {
|
||||
check_assist(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
mod foo {
|
||||
pub trait Fn<Args> { type Output; }
|
||||
trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo for S { <|> }",
|
||||
"
|
||||
impl foo::Foo for S { <|> }"#,
|
||||
r#"
|
||||
mod foo {
|
||||
pub trait Fn<Args> { type Output; }
|
||||
trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); }
|
||||
}
|
||||
struct S;
|
||||
impl foo::Foo for S {
|
||||
<|>fn foo(&self, bar: dyn Fn(u32) -> i32) { todo!() }
|
||||
}",
|
||||
<|>fn foo(&self, bar: dyn Fn(u32) -> i32) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -496,10 +532,10 @@ impl foo::Foo for S {
|
|||
fn test_empty_trait() {
|
||||
check_assist_not_applicable(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo;
|
||||
struct S;
|
||||
impl Foo for S { <|> }",
|
||||
impl Foo for S { <|> }"#,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -507,13 +543,13 @@ impl Foo for S { <|> }",
|
|||
fn test_ignore_unnamed_trait_members_and_default_methods() {
|
||||
check_assist_not_applicable(
|
||||
add_missing_impl_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo {
|
||||
fn (arg: u32);
|
||||
fn valid(some: u32) -> bool { false }
|
||||
}
|
||||
struct S;
|
||||
impl Foo for S { <|> }",
|
||||
impl Foo for S { <|> }"#,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -544,7 +580,9 @@ trait Foo {
|
|||
struct S;
|
||||
impl Foo for S {
|
||||
<|>type Output;
|
||||
fn foo(&self) { todo!() }
|
||||
fn foo(&self) {
|
||||
todo!()
|
||||
}
|
||||
}"#,
|
||||
)
|
||||
}
|
||||
|
@ -553,7 +591,7 @@ impl Foo for S {
|
|||
fn test_default_methods() {
|
||||
check_assist(
|
||||
add_missing_default_members,
|
||||
"
|
||||
r#"
|
||||
trait Foo {
|
||||
type Output;
|
||||
|
||||
|
@ -563,8 +601,8 @@ trait Foo {
|
|||
fn foo(some: u32) -> bool;
|
||||
}
|
||||
struct S;
|
||||
impl Foo for S { <|> }",
|
||||
"
|
||||
impl Foo for S { <|> }"#,
|
||||
r#"
|
||||
trait Foo {
|
||||
type Output;
|
||||
|
||||
|
@ -576,7 +614,7 @@ trait Foo {
|
|||
struct S;
|
||||
impl Foo for S {
|
||||
<|>fn valid(some: u32) -> bool { false }
|
||||
}",
|
||||
}"#,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::{iter::once, ops::RangeInclusive};
|
|||
|
||||
use ra_syntax::{
|
||||
algo::replace_children,
|
||||
ast::{self, edit::IndentLevel, make, Block, Pat::TupleStructPat},
|
||||
ast::{self, edit::IndentLevel, make},
|
||||
AstNode,
|
||||
SyntaxKind::{FN_DEF, LOOP_EXPR, L_CURLY, R_CURLY, WHILE_EXPR, WHITESPACE},
|
||||
SyntaxNode,
|
||||
|
@ -47,7 +47,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx) -> Option<Assist> {
|
|||
// Check if there is an IfLet that we can handle.
|
||||
let if_let_pat = match cond.pat() {
|
||||
None => None, // No IfLet, supported.
|
||||
Some(TupleStructPat(pat)) if pat.args().count() == 1 => {
|
||||
Some(ast::Pat::TupleStructPat(pat)) if pat.args().count() == 1 => {
|
||||
let path = pat.path()?;
|
||||
match path.qualifier() {
|
||||
None => {
|
||||
|
@ -61,9 +61,9 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx) -> Option<Assist> {
|
|||
};
|
||||
|
||||
let cond_expr = cond.expr()?;
|
||||
let then_block = if_expr.then_branch()?.block()?;
|
||||
let then_block = if_expr.then_branch()?;
|
||||
|
||||
let parent_block = if_expr.syntax().parent()?.ancestors().find_map(ast::Block::cast)?;
|
||||
let parent_block = if_expr.syntax().parent()?.ancestors().find_map(ast::BlockExpr::cast)?;
|
||||
|
||||
if parent_block.expr()? != if_expr.clone().into() {
|
||||
return None;
|
||||
|
@ -80,7 +80,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx) -> Option<Assist> {
|
|||
return None;
|
||||
}
|
||||
|
||||
let parent_container = parent_block.syntax().parent()?.parent()?;
|
||||
let parent_container = parent_block.syntax().parent()?;
|
||||
|
||||
let early_expression: ast::Expr = match parent_container.kind() {
|
||||
WHILE_EXPR | LOOP_EXPR => make::expr_continue(),
|
||||
|
@ -144,13 +144,13 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx) -> Option<Assist> {
|
|||
}
|
||||
};
|
||||
edit.target(if_expr.syntax().text_range());
|
||||
edit.replace_ast(parent_block, ast::Block::cast(new_block).unwrap());
|
||||
edit.replace_ast(parent_block, ast::BlockExpr::cast(new_block).unwrap());
|
||||
edit.set_cursor(cursor_position);
|
||||
|
||||
fn replace(
|
||||
new_expr: &SyntaxNode,
|
||||
then_block: &Block,
|
||||
parent_block: &Block,
|
||||
then_block: &ast::BlockExpr,
|
||||
parent_block: &ast::BlockExpr,
|
||||
if_expr: &ast::IfExpr,
|
||||
) -> SyntaxNode {
|
||||
let then_block_items = IndentLevel::from(1).decrease_indent(then_block.clone());
|
||||
|
|
|
@ -89,6 +89,7 @@ pub(crate) fn inline_local_variable(ctx: AssistCtx) -> Option<Assist> {
|
|||
| (ast::Expr::ParenExpr(_), _)
|
||||
| (ast::Expr::PathExpr(_), _)
|
||||
| (ast::Expr::BlockExpr(_), _)
|
||||
| (ast::Expr::EffectExpr(_), _)
|
||||
| (_, ast::Expr::CallExpr(_))
|
||||
| (_, ast::Expr::TupleExpr(_))
|
||||
| (_, ast::Expr::ArrayExpr(_))
|
||||
|
|
|
@ -111,7 +111,7 @@ fn valid_target_expr(node: SyntaxNode) -> Option<ast::Expr> {
|
|||
/// expression like a lambda or match arm.
|
||||
fn anchor_stmt(expr: ast::Expr) -> Option<(SyntaxNode, bool)> {
|
||||
expr.syntax().ancestors().find_map(|node| {
|
||||
if let Some(expr) = node.parent().and_then(ast::Block::cast).and_then(|it| it.expr()) {
|
||||
if let Some(expr) = node.parent().and_then(ast::BlockExpr::cast).and_then(|it| it.expr()) {
|
||||
if expr.syntax() == &node {
|
||||
tested_by!(test_introduce_var_last_expr);
|
||||
return Some((node, false));
|
||||
|
|
|
@ -113,9 +113,9 @@ pub(crate) fn move_arm_cond_to_match_guard(ctx: AssistCtx) -> Option<Assist> {
|
|||
"Move condition to match guard",
|
||||
|edit| {
|
||||
edit.target(if_expr.syntax().text_range());
|
||||
let then_only_expr = then_block.block().and_then(|it| it.statements().next()).is_none();
|
||||
let then_only_expr = then_block.statements().next().is_none();
|
||||
|
||||
match &then_block.block().and_then(|it| it.expr()) {
|
||||
match &then_block.expr() {
|
||||
Some(then_expr) if then_only_expr => {
|
||||
edit.replace(if_expr.syntax().text_range(), then_expr.syntax().text())
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ pub fn unwrap_trivial_block(block: ast::BlockExpr) -> ast::Expr {
|
|||
}
|
||||
|
||||
pub fn extract_trivial_expression(block: &ast::BlockExpr) -> Option<ast::Expr> {
|
||||
let block = block.block()?;
|
||||
let has_anything_else = |thing: &SyntaxNode| -> bool {
|
||||
let mut non_trivial_children =
|
||||
block.syntax().children_with_tokens().filter(|it| match it.kind() {
|
||||
|
|
|
@ -203,10 +203,16 @@ impl ExprCollector<'_> {
|
|||
|
||||
self.alloc_expr(Expr::If { condition, then_branch, else_branch }, syntax_ptr)
|
||||
}
|
||||
ast::Expr::TryBlockExpr(e) => {
|
||||
let body = self.collect_block_opt(e.body());
|
||||
ast::Expr::EffectExpr(e) => match e.effect() {
|
||||
ast::Effect::Try(_) => {
|
||||
let body = self.collect_block_opt(e.block_expr());
|
||||
self.alloc_expr(Expr::TryBlock { body }, syntax_ptr)
|
||||
}
|
||||
// FIXME: we need to record these effects somewhere...
|
||||
ast::Effect::Async(_) | ast::Effect::Label(_) | ast::Effect::Unsafe(_) => {
|
||||
self.collect_block_opt(e.block_expr())
|
||||
}
|
||||
},
|
||||
ast::Expr::BlockExpr(e) => self.collect_block(e),
|
||||
ast::Expr::LoopExpr(e) => {
|
||||
let body = self.collect_block_opt(e.loop_body());
|
||||
|
@ -494,12 +500,8 @@ impl ExprCollector<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
fn collect_block(&mut self, expr: ast::BlockExpr) -> ExprId {
|
||||
let syntax_node_ptr = AstPtr::new(&expr.clone().into());
|
||||
let block = match expr.block() {
|
||||
Some(block) => block,
|
||||
None => return self.alloc_expr(Expr::Missing, syntax_node_ptr),
|
||||
};
|
||||
fn collect_block(&mut self, block: ast::BlockExpr) -> ExprId {
|
||||
let syntax_node_ptr = AstPtr::new(&block.clone().into());
|
||||
self.collect_block_items(&block);
|
||||
let statements = block
|
||||
.statements()
|
||||
|
@ -517,7 +519,7 @@ impl ExprCollector<'_> {
|
|||
self.alloc_expr(Expr::Block { statements, tail }, syntax_node_ptr)
|
||||
}
|
||||
|
||||
fn collect_block_items(&mut self, block: &ast::Block) {
|
||||
fn collect_block_items(&mut self, block: &ast::BlockExpr) {
|
||||
let container = ContainerId::DefWithBodyId(self.def);
|
||||
for item in block.items() {
|
||||
let (def, name): (ModuleDefId, Option<ast::Name>) = match item {
|
||||
|
|
|
@ -330,7 +330,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind {
|
|||
FragmentKind::Expr
|
||||
}
|
||||
// FIXME: Expand to statements in appropriate positions; HIR lowering needs to handle that
|
||||
EXPR_STMT | BLOCK => FragmentKind::Expr,
|
||||
EXPR_STMT | BLOCK_EXPR => FragmentKind::Expr,
|
||||
ARG_LIST => FragmentKind::Expr,
|
||||
TRY_EXPR => FragmentKind::Expr,
|
||||
TUPLE_EXPR => FragmentKind::Expr,
|
||||
|
@ -342,7 +342,6 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind {
|
|||
CONDITION => FragmentKind::Expr,
|
||||
BREAK_EXPR => FragmentKind::Expr,
|
||||
RETURN_EXPR => FragmentKind::Expr,
|
||||
BLOCK_EXPR => FragmentKind::Expr,
|
||||
MATCH_EXPR => FragmentKind::Expr,
|
||||
MATCH_ARM => FragmentKind::Expr,
|
||||
MATCH_GUARD => FragmentKind::Expr,
|
||||
|
|
|
@ -1755,3 +1755,35 @@ fn main() {
|
|||
"###
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn effects_smoke_test() {
|
||||
assert_snapshot!(
|
||||
infer(r#"
|
||||
fn main() {
|
||||
let x = unsafe { 92 };
|
||||
let y = async { async { () }.await };
|
||||
let z = try { () };
|
||||
let t = 'a: { 92 };
|
||||
}
|
||||
"#),
|
||||
@r###"
|
||||
11..131 '{ ...2 }; }': ()
|
||||
21..22 'x': i32
|
||||
32..38 '{ 92 }': i32
|
||||
34..36 '92': i32
|
||||
48..49 'y': {unknown}
|
||||
58..80 '{ asyn...wait }': {unknown}
|
||||
60..78 'async ....await': {unknown}
|
||||
66..72 '{ () }': ()
|
||||
68..70 '()': ()
|
||||
90..91 'z': {unknown}
|
||||
94..104 'try { () }': {unknown}
|
||||
98..104 '{ () }': ()
|
||||
100..102 '()': ()
|
||||
114..115 't': i32
|
||||
122..128 '{ 92 }': i32
|
||||
124..126 '92': i32
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
|
|
@ -344,7 +344,7 @@ impl<'a> CompletionContext<'a> {
|
|||
stmt.syntax().text_range() == name_ref.syntax().text_range(),
|
||||
);
|
||||
}
|
||||
if let Some(block) = ast::Block::cast(node) {
|
||||
if let Some(block) = ast::BlockExpr::cast(node) {
|
||||
return Some(
|
||||
block.expr().map(|e| e.syntax().text_range())
|
||||
== Some(name_ref.syntax().text_range()),
|
||||
|
|
|
@ -88,7 +88,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
|
|||
| ITEM_LIST
|
||||
| EXTERN_ITEM_LIST
|
||||
| USE_TREE_LIST
|
||||
| BLOCK
|
||||
| BLOCK_EXPR
|
||||
| MATCH_ARM_LIST
|
||||
| ENUM_VARIANT_LIST
|
||||
| TOKEN_TREE => Some(FoldKind::Block),
|
||||
|
|
|
@ -129,8 +129,7 @@ fn has_comma_after(node: &SyntaxNode) -> bool {
|
|||
}
|
||||
|
||||
fn join_single_expr_block(edit: &mut TextEditBuilder, token: &SyntaxToken) -> Option<()> {
|
||||
let block = ast::Block::cast(token.parent())?;
|
||||
let block_expr = ast::BlockExpr::cast(block.syntax().parent()?)?;
|
||||
let block_expr = ast::BlockExpr::cast(token.parent())?;
|
||||
if !block_expr.is_standalone() {
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,6 @@ SOURCE_FILE@0..11
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..11
|
||||
BLOCK@9..11
|
||||
L_CURLY@9..10 "{"
|
||||
R_CURLY@10..11 "}"
|
||||
"#
|
||||
|
@ -153,7 +152,6 @@ SOURCE_FILE@0..60
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..60
|
||||
BLOCK@10..60
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
EXPR_STMT@16..58
|
||||
|
@ -196,7 +194,6 @@ FN_DEF@0..11
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..11
|
||||
BLOCK@9..11
|
||||
L_CURLY@9..10 "{"
|
||||
R_CURLY@10..11 "}"
|
||||
"#
|
||||
|
@ -265,7 +262,6 @@ SOURCE_FILE@0..12
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..12
|
||||
BLOCK@9..12
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..11 "\n"
|
||||
R_CURLY@11..12 "}"
|
||||
|
@ -300,7 +296,6 @@ SOURCE_FILE@0..12
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..12
|
||||
BLOCK@9..12
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..11 "\n"
|
||||
R_CURLY@11..12 "}"
|
||||
|
@ -334,7 +329,6 @@ SOURCE_FILE@0..25
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..12
|
||||
BLOCK@9..12
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..11 "\n"
|
||||
R_CURLY@11..12 "}"
|
||||
|
@ -349,7 +343,6 @@ SOURCE_FILE@0..25
|
|||
R_PAREN@20..21 ")"
|
||||
WHITESPACE@21..22 " "
|
||||
BLOCK_EXPR@22..25
|
||||
BLOCK@22..25
|
||||
L_CURLY@22..23 "{"
|
||||
WHITESPACE@23..24 "\n"
|
||||
R_CURLY@24..25 "}"
|
||||
|
|
|
@ -266,7 +266,6 @@ fn test_expr_order() {
|
|||
L_PAREN@5..6 "("
|
||||
R_PAREN@6..7 ")"
|
||||
BLOCK_EXPR@7..15
|
||||
BLOCK@7..15
|
||||
L_CURLY@7..8 "{"
|
||||
EXPR_STMT@8..14
|
||||
BIN_EXPR@8..13
|
||||
|
@ -1114,7 +1113,6 @@ fn test_vec() {
|
|||
assert_eq!(
|
||||
format!("{:#?}", tree).trim(),
|
||||
r#"BLOCK_EXPR@0..45
|
||||
BLOCK@0..45
|
||||
L_CURLY@0..1 "{"
|
||||
LET_STMT@1..20
|
||||
LET_KW@1..4 "let"
|
||||
|
|
|
@ -143,7 +143,7 @@ pub(crate) fn reparser(
|
|||
parent: Option<SyntaxKind>,
|
||||
) -> Option<fn(&mut Parser)> {
|
||||
let res = match node {
|
||||
BLOCK => expressions::naked_block,
|
||||
BLOCK_EXPR => expressions::block,
|
||||
RECORD_FIELD_DEF_LIST => items::record_field_def_list,
|
||||
RECORD_FIELD_LIST => items::record_field_list,
|
||||
ENUM_VARIANT_LIST => items::enum_variant_list,
|
||||
|
|
|
@ -59,16 +59,7 @@ pub(crate) fn block(p: &mut Parser) {
|
|||
p.error("expected a block");
|
||||
return;
|
||||
}
|
||||
atom::block_expr(p, None);
|
||||
}
|
||||
|
||||
pub(crate) fn naked_block(p: &mut Parser) {
|
||||
assert!(p.at(T!['{']));
|
||||
let m = p.start();
|
||||
p.bump(T!['{']);
|
||||
expr_block_contents(p);
|
||||
p.expect(T!['}']);
|
||||
m.complete(p, BLOCK);
|
||||
atom::block_expr(p);
|
||||
}
|
||||
|
||||
fn is_expr_stmt_attr_allowed(kind: SyntaxKind) -> bool {
|
||||
|
@ -197,7 +188,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn expr_block_contents(p: &mut Parser) {
|
||||
pub(super) fn expr_block_contents(p: &mut Parser) {
|
||||
// This is checked by a validator
|
||||
attributes::inner_attributes(p);
|
||||
|
||||
|
|
|
@ -92,7 +92,12 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
|
|||
T![loop] => loop_expr(p, Some(m)),
|
||||
T![for] => for_expr(p, Some(m)),
|
||||
T![while] => while_expr(p, Some(m)),
|
||||
T!['{'] => block_expr(p, Some(m)),
|
||||
// test labeled_block
|
||||
// fn f() { 'label: {}; }
|
||||
T!['{'] => {
|
||||
block_expr(p);
|
||||
m.complete(p, EFFECT_EXPR)
|
||||
}
|
||||
_ => {
|
||||
// test_err misplaced_label_err
|
||||
// fn main() {
|
||||
|
@ -108,13 +113,17 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
|
|||
let m = p.start();
|
||||
p.bump(T![async]);
|
||||
p.eat(T![move]);
|
||||
block_expr(p, Some(m))
|
||||
block_expr(p);
|
||||
m.complete(p, EFFECT_EXPR)
|
||||
}
|
||||
T![match] => match_expr(p),
|
||||
// test unsafe_block
|
||||
// fn f() { unsafe { } }
|
||||
T![unsafe] if la == T!['{'] => {
|
||||
let m = p.start();
|
||||
p.bump(T![unsafe]);
|
||||
block_expr(p, Some(m))
|
||||
block_expr(p);
|
||||
m.complete(p, EFFECT_EXPR)
|
||||
}
|
||||
T!['{'] => {
|
||||
// test for_range_from
|
||||
|
@ -123,7 +132,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
|
|||
// break;
|
||||
// }
|
||||
// }
|
||||
block_expr(p, None)
|
||||
block_expr(p)
|
||||
}
|
||||
T![return] => return_expr(p),
|
||||
T![continue] => continue_expr(p),
|
||||
|
@ -134,7 +143,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
|
|||
}
|
||||
};
|
||||
let blocklike = match done.kind() {
|
||||
IF_EXPR | WHILE_EXPR | FOR_EXPR | LOOP_EXPR | MATCH_EXPR | BLOCK_EXPR | TRY_BLOCK_EXPR => {
|
||||
IF_EXPR | WHILE_EXPR | FOR_EXPR | LOOP_EXPR | MATCH_EXPR | BLOCK_EXPR | EFFECT_EXPR => {
|
||||
BlockLike::Block
|
||||
}
|
||||
_ => BlockLike::NotBlock,
|
||||
|
@ -234,7 +243,7 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker {
|
|||
if p.at(T!['{']) {
|
||||
// test lambda_ret_block
|
||||
// fn main() { || -> i32 { 92 }(); }
|
||||
block_expr(p, None);
|
||||
block_expr(p);
|
||||
} else {
|
||||
p.error("expected `{`");
|
||||
}
|
||||
|
@ -461,13 +470,13 @@ fn match_guard(p: &mut Parser) -> CompletedMarker {
|
|||
// test block_expr
|
||||
// fn foo() {
|
||||
// {};
|
||||
// unsafe {};
|
||||
// 'label: {};
|
||||
// }
|
||||
pub(super) fn block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker {
|
||||
pub(super) fn block_expr(p: &mut Parser) -> CompletedMarker {
|
||||
assert!(p.at(T!['{']));
|
||||
let m = m.unwrap_or_else(|| p.start());
|
||||
naked_block(p);
|
||||
let m = p.start();
|
||||
p.bump(T!['{']);
|
||||
expr_block_contents(p);
|
||||
p.expect(T!['}']);
|
||||
m.complete(p, BLOCK_EXPR)
|
||||
}
|
||||
|
||||
|
@ -552,8 +561,8 @@ fn try_block_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker {
|
|||
}
|
||||
|
||||
p.bump(T![try]);
|
||||
block(p);
|
||||
m.complete(p, TRY_EXPR)
|
||||
block_expr(p);
|
||||
m.complete(p, EFFECT_EXPR)
|
||||
}
|
||||
|
||||
// test box_expr
|
||||
|
|
|
@ -191,7 +191,7 @@ pub enum SyntaxKind {
|
|||
RECORD_LIT,
|
||||
RECORD_FIELD_LIST,
|
||||
RECORD_FIELD,
|
||||
TRY_BLOCK_EXPR,
|
||||
EFFECT_EXPR,
|
||||
BOX_EXPR,
|
||||
CALL_EXPR,
|
||||
INDEX_EXPR,
|
||||
|
@ -204,7 +204,6 @@ pub enum SyntaxKind {
|
|||
PREFIX_EXPR,
|
||||
RANGE_EXPR,
|
||||
BIN_EXPR,
|
||||
BLOCK,
|
||||
EXTERN_BLOCK,
|
||||
EXTERN_ITEM_LIST,
|
||||
ENUM_VARIANT,
|
||||
|
|
|
@ -16,7 +16,7 @@ use crate::{
|
|||
};
|
||||
|
||||
pub use self::{
|
||||
expr_extensions::{ArrayExprKind, BinOp, ElseBranch, LiteralKind, PrefixOp, RangeOp},
|
||||
expr_extensions::{ArrayExprKind, BinOp, Effect, ElseBranch, LiteralKind, PrefixOp, RangeOp},
|
||||
extensions::{
|
||||
AttrKind, FieldKind, NameOrNameRef, PathSegmentKind, SelfParamKind, SlicePatComponents,
|
||||
StructKind, TypeBoundKind, VisibilityKind,
|
||||
|
|
|
@ -28,7 +28,7 @@ impl ast::BinExpr {
|
|||
|
||||
impl ast::FnDef {
|
||||
#[must_use]
|
||||
pub fn with_body(&self, body: ast::Block) -> ast::FnDef {
|
||||
pub fn with_body(&self, body: ast::BlockExpr) -> ast::FnDef {
|
||||
let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new();
|
||||
let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() {
|
||||
old_body.syntax().clone().into()
|
||||
|
|
|
@ -16,7 +16,7 @@ impl ast::Expr {
|
|||
| ast::Expr::WhileExpr(_)
|
||||
| ast::Expr::BlockExpr(_)
|
||||
| ast::Expr::MatchExpr(_)
|
||||
| ast::Expr::TryBlockExpr(_) => true,
|
||||
| ast::Expr::EffectExpr(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -359,6 +359,33 @@ impl ast::Literal {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Effect {
|
||||
Async(SyntaxToken),
|
||||
Unsafe(SyntaxToken),
|
||||
Try(SyntaxToken),
|
||||
// Very much not an effect, but we stuff it into this node anyway
|
||||
Label(ast::Label),
|
||||
}
|
||||
|
||||
impl ast::EffectExpr {
|
||||
pub fn effect(&self) -> Effect {
|
||||
if let Some(token) = self.async_token() {
|
||||
return Effect::Async(token);
|
||||
}
|
||||
if let Some(token) = self.unsafe_token() {
|
||||
return Effect::Unsafe(token);
|
||||
}
|
||||
if let Some(token) = self.try_token() {
|
||||
return Effect::Try(token);
|
||||
}
|
||||
if let Some(label) = self.label() {
|
||||
return Effect::Label(label);
|
||||
}
|
||||
unreachable!("ast::EffectExpr without Effect")
|
||||
}
|
||||
}
|
||||
|
||||
impl ast::BlockExpr {
|
||||
/// false if the block is an intrinsic part of the syntax and can't be
|
||||
/// replaced with arbitrary expression.
|
||||
|
@ -368,15 +395,12 @@ impl ast::BlockExpr {
|
|||
/// const FOO: () = { stand_alone };
|
||||
/// ```
|
||||
pub fn is_standalone(&self) -> bool {
|
||||
if self.unsafe_token().is_some() || self.async_token().is_some() {
|
||||
return false;
|
||||
}
|
||||
let kind = match self.syntax().parent() {
|
||||
let parent = match self.syntax().parent() {
|
||||
Some(it) => it,
|
||||
None => return true,
|
||||
Some(it) => it.kind(),
|
||||
};
|
||||
match kind {
|
||||
FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | TRY_BLOCK_EXPR => false,
|
||||
match parent.kind() {
|
||||
FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -476,13 +476,16 @@ impl LoopExpr {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TryBlockExpr {
|
||||
pub struct EffectExpr {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl ast::AttrsOwner for TryBlockExpr {}
|
||||
impl TryBlockExpr {
|
||||
impl ast::AttrsOwner for EffectExpr {}
|
||||
impl EffectExpr {
|
||||
pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
|
||||
pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
|
||||
pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
|
||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
|
||||
pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
|
||||
pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -551,11 +554,12 @@ pub struct BlockExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl ast::AttrsOwner for BlockExpr {}
|
||||
impl ast::ModuleItemOwner for BlockExpr {}
|
||||
impl BlockExpr {
|
||||
pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
|
||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
|
||||
pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
|
||||
pub fn block(&self) -> Option<Block> { support::child(&self.syntax) }
|
||||
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
|
||||
pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -627,8 +631,8 @@ pub struct TryExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for TryExpr {}
|
||||
impl TryExpr {
|
||||
pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1121,19 +1125,6 @@ impl Condition {
|
|||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Block {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl ast::AttrsOwner for Block {}
|
||||
impl ast::ModuleItemOwner for Block {}
|
||||
impl Block {
|
||||
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
|
||||
pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct ParamList {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
|
@ -1477,7 +1468,7 @@ pub enum Expr {
|
|||
FieldExpr(FieldExpr),
|
||||
AwaitExpr(AwaitExpr),
|
||||
TryExpr(TryExpr),
|
||||
TryBlockExpr(TryBlockExpr),
|
||||
EffectExpr(EffectExpr),
|
||||
CastExpr(CastExpr),
|
||||
RefExpr(RefExpr),
|
||||
PrefixExpr(PrefixExpr),
|
||||
|
@ -1960,8 +1951,8 @@ impl AstNode for LoopExpr {
|
|||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for TryBlockExpr {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_BLOCK_EXPR }
|
||||
impl AstNode for EffectExpr {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
|
@ -2653,17 +2644,6 @@ impl AstNode for Condition {
|
|||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for Block {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for ParamList {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
|
@ -3312,8 +3292,8 @@ impl From<AwaitExpr> for Expr {
|
|||
impl From<TryExpr> for Expr {
|
||||
fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) }
|
||||
}
|
||||
impl From<TryBlockExpr> for Expr {
|
||||
fn from(node: TryBlockExpr) -> Expr { Expr::TryBlockExpr(node) }
|
||||
impl From<EffectExpr> for Expr {
|
||||
fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) }
|
||||
}
|
||||
impl From<CastExpr> for Expr {
|
||||
fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) }
|
||||
|
@ -3345,9 +3325,10 @@ impl AstNode for Expr {
|
|||
TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR
|
||||
| LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL
|
||||
| BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR
|
||||
| METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | TRY_BLOCK_EXPR
|
||||
| CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL
|
||||
| BOX_EXPR => true,
|
||||
| METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR
|
||||
| REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => {
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -3375,7 +3356,7 @@ impl AstNode for Expr {
|
|||
FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }),
|
||||
AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }),
|
||||
TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
|
||||
TRY_BLOCK_EXPR => Expr::TryBlockExpr(TryBlockExpr { syntax }),
|
||||
EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }),
|
||||
CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
|
||||
REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
|
||||
PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }),
|
||||
|
@ -3412,7 +3393,7 @@ impl AstNode for Expr {
|
|||
Expr::FieldExpr(it) => &it.syntax,
|
||||
Expr::AwaitExpr(it) => &it.syntax,
|
||||
Expr::TryExpr(it) => &it.syntax,
|
||||
Expr::TryBlockExpr(it) => &it.syntax,
|
||||
Expr::EffectExpr(it) => &it.syntax,
|
||||
Expr::CastExpr(it) => &it.syntax,
|
||||
Expr::RefExpr(it) => &it.syntax,
|
||||
Expr::PrefixExpr(it) => &it.syntax,
|
||||
|
@ -3893,7 +3874,7 @@ impl std::fmt::Display for LoopExpr {
|
|||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for TryBlockExpr {
|
||||
impl std::fmt::Display for EffectExpr {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
|
@ -4208,11 +4189,6 @@ impl std::fmt::Display for Condition {
|
|||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for Block {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for ParamList {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
|
|
|
@ -82,14 +82,6 @@ pub fn block_expr(
|
|||
ast_from_text(&format!("fn f() {}", buf))
|
||||
}
|
||||
|
||||
pub fn block_from_expr(e: ast::Expr) -> ast::Block {
|
||||
return from_text(&format!("{{ {} }}", e));
|
||||
|
||||
fn from_text(text: &str) -> ast::Block {
|
||||
ast_from_text(&format!("fn f() {}", text))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn expr_unit() -> ast::Expr {
|
||||
expr_from_text("()")
|
||||
}
|
||||
|
|
|
@ -237,8 +237,7 @@ fn api_walkthrough() {
|
|||
|
||||
// Let's get the `1 + 1` expression!
|
||||
let body: ast::BlockExpr = func.body().unwrap();
|
||||
let block = body.block().unwrap();
|
||||
let expr: ast::Expr = block.expr().unwrap();
|
||||
let expr: ast::Expr = body.expr().unwrap();
|
||||
|
||||
// Enums are used to group related ast nodes together, and can be used for
|
||||
// matching. However, because there are no public fields, it's possible to
|
||||
|
@ -274,8 +273,8 @@ fn api_walkthrough() {
|
|||
assert_eq!(text.to_string(), "1 + 1");
|
||||
|
||||
// There's a bunch of traversal methods on `SyntaxNode`:
|
||||
assert_eq!(expr_syntax.parent().as_ref(), Some(block.syntax()));
|
||||
assert_eq!(block.syntax().first_child_or_token().map(|it| it.kind()), Some(T!['{']));
|
||||
assert_eq!(expr_syntax.parent().as_ref(), Some(body.syntax()));
|
||||
assert_eq!(body.syntax().first_child_or_token().map(|it| it.kind()), Some(T!['{']));
|
||||
assert_eq!(
|
||||
expr_syntax.next_sibling_or_token().map(|it| it.kind()),
|
||||
Some(SyntaxKind::WHITESPACE)
|
||||
|
|
|
@ -6,14 +6,13 @@ use crate::{
|
|||
SyntaxKind::*,
|
||||
};
|
||||
|
||||
pub(crate) fn validate_block_expr(expr: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
|
||||
if let Some(parent) = expr.syntax().parent() {
|
||||
pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
|
||||
if let Some(parent) = block.syntax().parent() {
|
||||
match parent.kind() {
|
||||
FN_DEF | EXPR_STMT | BLOCK => return,
|
||||
FN_DEF | EXPR_STMT | BLOCK_EXPR => return,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if let Some(block) = expr.block() {
|
||||
errors.extend(block.attrs().map(|attr| {
|
||||
SyntaxError::new(
|
||||
"A block in this position cannot accept inner attributes",
|
||||
|
@ -21,4 +20,3 @@ pub(crate) fn validate_block_expr(expr: ast::BlockExpr, errors: &mut Vec<SyntaxE
|
|||
)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ SOURCE_FILE@0..54
|
|||
R_PAREN@26..27 ")"
|
||||
WHITESPACE@27..28 " "
|
||||
BLOCK_EXPR@28..31
|
||||
BLOCK@28..31
|
||||
L_CURLY@28..29 "{"
|
||||
WHITESPACE@29..30 "\n"
|
||||
R_CURLY@30..31 "}"
|
||||
|
|
|
@ -21,7 +21,6 @@ SOURCE_FILE@0..31
|
|||
L_PAREN@23..24 "("
|
||||
R_PAREN@24..25 ")"
|
||||
BLOCK_EXPR@25..27
|
||||
BLOCK@25..27
|
||||
L_CURLY@25..26 "{"
|
||||
R_CURLY@26..27 "}"
|
||||
WHITESPACE@27..29 "\n\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..95
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..12
|
||||
BLOCK@9..12
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..11 "\n"
|
||||
R_CURLY@11..12 "}"
|
||||
|
@ -34,7 +33,6 @@ SOURCE_FILE@0..95
|
|||
TRUE_KW@29..33 "true"
|
||||
WHITESPACE@33..34 " "
|
||||
BLOCK_EXPR@34..51
|
||||
BLOCK@34..51
|
||||
L_CURLY@34..35 "{"
|
||||
WHITESPACE@35..44 "\n "
|
||||
LITERAL@44..45
|
||||
|
@ -45,7 +43,6 @@ SOURCE_FILE@0..95
|
|||
ELSE_KW@52..56 "else"
|
||||
WHITESPACE@56..57 " "
|
||||
BLOCK_EXPR@57..78
|
||||
BLOCK@57..78
|
||||
L_CURLY@57..58 "{"
|
||||
WHITESPACE@58..67 "\n "
|
||||
BIN_EXPR@67..72
|
||||
|
@ -71,7 +68,6 @@ SOURCE_FILE@0..95
|
|||
R_PAREN@89..90 ")"
|
||||
WHITESPACE@90..91 " "
|
||||
BLOCK_EXPR@91..94
|
||||
BLOCK@91..94
|
||||
L_CURLY@91..92 "{"
|
||||
WHITESPACE@92..93 "\n"
|
||||
R_CURLY@93..94 "}"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..42
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..41
|
||||
BLOCK@10..41
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
EXPR_STMT@16..24
|
||||
|
@ -26,10 +25,10 @@ SOURCE_FILE@0..42
|
|||
R_PAREN@23..24 ")"
|
||||
WHITESPACE@24..25 " "
|
||||
EXPR_STMT@25..39
|
||||
BLOCK_EXPR@25..38
|
||||
EFFECT_EXPR@25..38
|
||||
UNSAFE_KW@25..31 "unsafe"
|
||||
WHITESPACE@31..32 " "
|
||||
BLOCK@32..38
|
||||
BLOCK_EXPR@32..38
|
||||
L_CURLY@32..33 "{"
|
||||
WHITESPACE@33..34 " "
|
||||
TUPLE_EXPR@34..36
|
||||
|
|
|
@ -25,7 +25,6 @@ SOURCE_FILE@0..23
|
|||
IDENT@18..19 "T"
|
||||
WHITESPACE@19..20 " "
|
||||
BLOCK_EXPR@20..22
|
||||
BLOCK@20..22
|
||||
L_CURLY@20..21 "{"
|
||||
R_CURLY@21..22 "}"
|
||||
WHITESPACE@22..23 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..56
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..55
|
||||
BLOCK@9..55
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..38
|
||||
|
|
|
@ -20,7 +20,6 @@ SOURCE_FILE@0..47
|
|||
R_PAREN@15..16 ")"
|
||||
WHITESPACE@16..17 " "
|
||||
BLOCK_EXPR@17..46
|
||||
BLOCK@17..46
|
||||
L_CURLY@17..18 "{"
|
||||
WHITESPACE@18..23 "\n "
|
||||
LET_STMT@23..36
|
||||
|
|
|
@ -33,7 +33,6 @@ SOURCE_FILE@0..183
|
|||
IDENT@39..46 "ScopeId"
|
||||
WHITESPACE@46..47 " "
|
||||
BLOCK_EXPR@47..161
|
||||
BLOCK@47..161
|
||||
L_CURLY@47..48 "{"
|
||||
WHITESPACE@48..57 "\n "
|
||||
LET_STMT@57..85
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..139
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..138
|
||||
BLOCK@9..138
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
LET_STMT@15..24
|
||||
|
@ -62,7 +61,6 @@ SOURCE_FILE@0..139
|
|||
TRUE_KW@83..87 "true"
|
||||
WHITESPACE@87..88 " "
|
||||
BLOCK_EXPR@88..90
|
||||
BLOCK@88..90
|
||||
L_CURLY@88..89 "{"
|
||||
R_CURLY@89..90 "}"
|
||||
WHITESPACE@90..95 "\n "
|
||||
|
@ -78,7 +76,6 @@ SOURCE_FILE@0..139
|
|||
TRUE_KW@109..113 "true"
|
||||
WHITESPACE@113..114 " "
|
||||
BLOCK_EXPR@114..116
|
||||
BLOCK@114..116
|
||||
L_CURLY@114..115 "{"
|
||||
R_CURLY@115..116 "}"
|
||||
WHITESPACE@116..121 "\n "
|
||||
|
@ -89,7 +86,6 @@ SOURCE_FILE@0..139
|
|||
LOOP_KW@129..133 "loop"
|
||||
WHITESPACE@133..134 " "
|
||||
BLOCK_EXPR@134..136
|
||||
BLOCK@134..136
|
||||
L_CURLY@134..135 "{"
|
||||
R_CURLY@135..136 "}"
|
||||
WHITESPACE@136..137 "\n"
|
||||
|
|
|
@ -12,7 +12,6 @@ SOURCE_FILE@0..16
|
|||
R_PAREN@11..12 ")"
|
||||
WHITESPACE@12..13 " "
|
||||
BLOCK_EXPR@13..15
|
||||
BLOCK@13..15
|
||||
L_CURLY@13..14 "{"
|
||||
R_CURLY@14..15 "}"
|
||||
WHITESPACE@15..16 "\n"
|
||||
|
|
|
@ -26,7 +26,6 @@ SOURCE_FILE@0..22
|
|||
R_PAREN@16..17 ")"
|
||||
WHITESPACE@17..18 " "
|
||||
BLOCK_EXPR@18..21
|
||||
BLOCK@18..21
|
||||
L_CURLY@18..19 "{"
|
||||
WHITESPACE@19..20 "\n"
|
||||
R_CURLY@20..21 "}"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..112
|
|||
R_PAREN@5..6 ")"
|
||||
WHITESPACE@6..7 " "
|
||||
BLOCK_EXPR@7..33
|
||||
BLOCK@7..33
|
||||
L_CURLY@7..8 "{"
|
||||
WHITESPACE@8..9 " "
|
||||
EXPR_STMT@9..17
|
||||
|
@ -51,7 +50,6 @@ SOURCE_FILE@0..112
|
|||
R_PAREN@39..40 ")"
|
||||
WHITESPACE@40..41 " "
|
||||
BLOCK_EXPR@41..68
|
||||
BLOCK@41..68
|
||||
L_CURLY@41..42 "{"
|
||||
WHITESPACE@42..43 " "
|
||||
EXPR_STMT@43..54
|
||||
|
@ -100,7 +98,6 @@ SOURCE_FILE@0..112
|
|||
R_PAREN@74..75 ")"
|
||||
WHITESPACE@75..76 " "
|
||||
BLOCK_EXPR@76..111
|
||||
BLOCK@76..111
|
||||
L_CURLY@76..77 "{"
|
||||
WHITESPACE@77..78 " "
|
||||
EXPR_STMT@78..93
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..94
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..55
|
||||
BLOCK@10..55
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
MACRO_CALL@16..49
|
||||
|
|
|
@ -62,7 +62,6 @@ SOURCE_FILE@0..240
|
|||
R_PAREN@49..50 ")"
|
||||
WHITESPACE@50..51 " "
|
||||
BLOCK_EXPR@51..53
|
||||
BLOCK@51..53
|
||||
L_CURLY@51..52 "{"
|
||||
R_CURLY@52..53 "}"
|
||||
WHITESPACE@53..55 "\n\n"
|
||||
|
@ -76,7 +75,6 @@ SOURCE_FILE@0..240
|
|||
R_PAREN@63..64 ")"
|
||||
WHITESPACE@64..65 " "
|
||||
BLOCK_EXPR@65..239
|
||||
BLOCK@65..239
|
||||
L_CURLY@65..66 "{"
|
||||
WHITESPACE@66..71 "\n "
|
||||
LET_STMT@71..121
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..575
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..574
|
||||
BLOCK@10..574
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
ENUM_DEF@16..152
|
||||
|
@ -131,7 +130,6 @@ SOURCE_FILE@0..575
|
|||
WHITESPACE@300..306 "\n\n "
|
||||
EXPR_STMT@306..459
|
||||
BLOCK_EXPR@306..459
|
||||
BLOCK@306..459
|
||||
L_CURLY@306..307 "{"
|
||||
WHITESPACE@307..316 "\n "
|
||||
ENUM_DEF@316..453
|
||||
|
|
|
@ -21,7 +21,6 @@ SOURCE_FILE@0..30
|
|||
R_ANGLE@25..26 ">"
|
||||
WHITESPACE@26..27 "\n"
|
||||
BLOCK_EXPR@27..29
|
||||
BLOCK@27..29
|
||||
L_CURLY@27..28 "{"
|
||||
R_CURLY@28..29 "}"
|
||||
WHITESPACE@29..30 "\n"
|
||||
|
|
|
@ -20,7 +20,6 @@ SOURCE_FILE@0..24
|
|||
R_PAREN@11..12 ")"
|
||||
WHITESPACE@12..13 " "
|
||||
BLOCK_EXPR@13..23
|
||||
BLOCK@13..23
|
||||
L_CURLY@13..14 "{"
|
||||
WHITESPACE@14..19 "\n "
|
||||
FIELD_EXPR@19..21
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..350
|
|||
R_PAREN@9..10 ")"
|
||||
WHITESPACE@10..11 " "
|
||||
BLOCK_EXPR@11..349
|
||||
BLOCK@11..349
|
||||
L_CURLY@11..12 "{"
|
||||
WHITESPACE@12..17 "\n "
|
||||
LET_STMT@17..129
|
||||
|
@ -22,7 +21,6 @@ SOURCE_FILE@0..350
|
|||
EQ@27..28 "="
|
||||
WHITESPACE@28..29 " "
|
||||
BLOCK_EXPR@29..128
|
||||
BLOCK@29..128
|
||||
L_CURLY@29..30 "{"
|
||||
WHITESPACE@30..39 "\n "
|
||||
ATTR@39..83
|
||||
|
@ -53,7 +51,6 @@ SOURCE_FILE@0..350
|
|||
TRUE_KW@137..141 "true"
|
||||
WHITESPACE@141..142 " "
|
||||
BLOCK_EXPR@142..257
|
||||
BLOCK@142..257
|
||||
L_CURLY@142..143 "{"
|
||||
WHITESPACE@143..152 "\n "
|
||||
ATTR@152..171
|
||||
|
@ -96,7 +93,6 @@ SOURCE_FILE@0..350
|
|||
TRUE_KW@268..272 "true"
|
||||
WHITESPACE@272..273 " "
|
||||
BLOCK_EXPR@273..347
|
||||
BLOCK@273..347
|
||||
L_CURLY@273..274 "{"
|
||||
WHITESPACE@274..283 "\n "
|
||||
ATTR@283..302
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..293
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..292
|
||||
BLOCK@9..292
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..101
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..89
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..88
|
||||
BLOCK@9..88
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
MATCH_EXPR@15..86
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..91
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..89
|
||||
BLOCK@10..89
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
LET_STMT@16..27
|
||||
|
|
|
@ -44,7 +44,6 @@ SOURCE_FILE@0..48
|
|||
R_PAREN@43..44 ")"
|
||||
WHITESPACE@44..45 " "
|
||||
BLOCK_EXPR@45..47
|
||||
BLOCK@45..47
|
||||
L_CURLY@45..46 "{"
|
||||
R_CURLY@46..47 "}"
|
||||
WHITESPACE@47..48 "\n"
|
||||
|
|
|
@ -27,7 +27,6 @@ SOURCE_FILE@0..118
|
|||
R_PAREN@27..28 ")"
|
||||
WHITESPACE@28..29 " "
|
||||
BLOCK_EXPR@29..31
|
||||
BLOCK@29..31
|
||||
L_CURLY@29..30 "{"
|
||||
R_CURLY@30..31 "}"
|
||||
WHITESPACE@31..36 "\n "
|
||||
|
@ -44,7 +43,6 @@ SOURCE_FILE@0..118
|
|||
R_PAREN@47..48 ")"
|
||||
WHITESPACE@48..49 " "
|
||||
BLOCK_EXPR@49..51
|
||||
BLOCK@49..51
|
||||
L_CURLY@49..50 "{"
|
||||
R_CURLY@50..51 "}"
|
||||
WHITESPACE@51..56 "\n "
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..33
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..32
|
||||
BLOCK@10..32
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
EXPR_STMT@16..21
|
||||
|
|
|
@ -18,7 +18,6 @@ SOURCE_FILE@0..83
|
|||
IDENT@12..15 "i32"
|
||||
WHITESPACE@15..16 " "
|
||||
BLOCK_EXPR@16..82
|
||||
BLOCK@16..82
|
||||
L_CURLY@16..17 "{"
|
||||
WHITESPACE@17..22 "\n "
|
||||
EXPR_STMT@22..80
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..30
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..29
|
||||
BLOCK@10..29
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
EXPR_STMT@16..22
|
||||
|
|
|
@ -8,7 +8,6 @@ SOURCE_FILE@0..33
|
|||
L_PAREN@6..7 "("
|
||||
R_PAREN@7..8 ")"
|
||||
BLOCK_EXPR@8..10
|
||||
BLOCK@8..10
|
||||
L_CURLY@8..9 "{"
|
||||
R_CURLY@9..10 "}"
|
||||
WHITESPACE@10..11 " "
|
||||
|
@ -29,7 +28,6 @@ SOURCE_FILE@0..33
|
|||
L_PAREN@28..29 "("
|
||||
R_PAREN@29..30 ")"
|
||||
BLOCK_EXPR@30..32
|
||||
BLOCK@30..32
|
||||
L_CURLY@30..31 "{"
|
||||
R_CURLY@31..32 "}"
|
||||
WHITESPACE@32..33 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..30
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..29
|
||||
BLOCK@9..29
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..11 " "
|
||||
LET_STMT@11..27
|
||||
|
@ -20,10 +19,10 @@ SOURCE_FILE@0..30
|
|||
WHITESPACE@16..17 " "
|
||||
EQ@17..18 "="
|
||||
WHITESPACE@18..19 " "
|
||||
BLOCK_EXPR@19..27
|
||||
EFFECT_EXPR@19..27
|
||||
ASYNC_KW@19..24 "async"
|
||||
WHITESPACE@24..25 " "
|
||||
BLOCK@25..27
|
||||
BLOCK_EXPR@25..27
|
||||
L_CURLY@25..26 "{"
|
||||
R_CURLY@26..27 "}"
|
||||
WHITESPACE@27..28 " "
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..21
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..20
|
||||
BLOCK@9..20
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..11 " "
|
||||
ERROR@11..14
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..48
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..47
|
||||
BLOCK@9..47
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..14 "\n "
|
||||
EXPR_STMT@14..25
|
||||
|
@ -50,7 +49,6 @@ SOURCE_FILE@0..48
|
|||
TRUE_KW@37..41 "true"
|
||||
WHITESPACE@41..42 " "
|
||||
BLOCK_EXPR@42..44
|
||||
BLOCK@42..44
|
||||
L_CURLY@42..43 "{"
|
||||
R_CURLY@43..44 "}"
|
||||
SEMICOLON@44..45 ";"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..47
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..46
|
||||
BLOCK@9..46
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..20
|
||||
|
|
|
@ -14,7 +14,6 @@ SOURCE_FILE@0..50
|
|||
R_PAREN@20..21 ")"
|
||||
WHITESPACE@21..22 " "
|
||||
BLOCK_EXPR@22..24
|
||||
BLOCK@22..24
|
||||
L_CURLY@22..23 "{"
|
||||
R_CURLY@23..24 "}"
|
||||
WHITESPACE@24..25 "\n"
|
||||
|
@ -33,7 +32,6 @@ SOURCE_FILE@0..50
|
|||
R_PAREN@45..46 ")"
|
||||
WHITESPACE@46..47 " "
|
||||
BLOCK_EXPR@47..49
|
||||
BLOCK@47..49
|
||||
L_CURLY@47..48 "{"
|
||||
R_CURLY@48..49 "}"
|
||||
WHITESPACE@49..50 "\n"
|
||||
|
|
|
@ -45,7 +45,6 @@ SOURCE_FILE@0..62
|
|||
R_PAREN@55..56 ")"
|
||||
WHITESPACE@56..57 " "
|
||||
BLOCK_EXPR@57..59
|
||||
BLOCK@57..59
|
||||
L_CURLY@57..58 "{"
|
||||
R_CURLY@58..59 "}"
|
||||
WHITESPACE@59..60 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..45
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..44
|
||||
BLOCK@10..44
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
RECORD_LIT@16..42
|
||||
|
|
|
@ -51,7 +51,6 @@ SOURCE_FILE@0..83
|
|||
R_PAREN@57..58 ")"
|
||||
WHITESPACE@58..59 " "
|
||||
BLOCK_EXPR@59..61
|
||||
BLOCK@59..61
|
||||
L_CURLY@59..60 "{"
|
||||
R_CURLY@60..61 "}"
|
||||
WHITESPACE@61..66 "\n "
|
||||
|
|
|
@ -55,7 +55,6 @@ SOURCE_FILE@0..49
|
|||
R_PAREN@43..44 ")"
|
||||
WHITESPACE@44..45 "\n"
|
||||
BLOCK_EXPR@45..48
|
||||
BLOCK@45..48
|
||||
L_CURLY@45..46 "{"
|
||||
WHITESPACE@46..47 " "
|
||||
R_CURLY@47..48 "}"
|
||||
|
|
|
@ -32,7 +32,6 @@ SOURCE_FILE@0..28
|
|||
L_PAREN@23..24 "("
|
||||
R_PAREN@24..25 ")"
|
||||
BLOCK_EXPR@25..27
|
||||
BLOCK@25..27
|
||||
L_CURLY@25..26 "{"
|
||||
R_CURLY@26..27 "}"
|
||||
WHITESPACE@27..28 "\n"
|
||||
|
|
|
@ -23,7 +23,6 @@ SOURCE_FILE@0..128
|
|||
R_PAREN@22..23 ")"
|
||||
WHITESPACE@23..24 " "
|
||||
BLOCK_EXPR@24..26
|
||||
BLOCK@24..26
|
||||
L_CURLY@24..25 "{"
|
||||
R_CURLY@25..26 "}"
|
||||
WHITESPACE@26..31 "\n "
|
||||
|
@ -41,7 +40,6 @@ SOURCE_FILE@0..128
|
|||
R_PAREN@42..43 ")"
|
||||
WHITESPACE@43..44 " "
|
||||
BLOCK_EXPR@44..46
|
||||
BLOCK@44..46
|
||||
L_CURLY@44..45 "{"
|
||||
R_CURLY@45..46 "}"
|
||||
WHITESPACE@46..51 "\n "
|
||||
|
@ -61,7 +59,6 @@ SOURCE_FILE@0..128
|
|||
R_PAREN@65..66 ")"
|
||||
WHITESPACE@66..67 " "
|
||||
BLOCK_EXPR@67..69
|
||||
BLOCK@67..69
|
||||
L_CURLY@67..68 "{"
|
||||
R_CURLY@68..69 "}"
|
||||
WHITESPACE@69..74 "\n "
|
||||
|
@ -95,7 +92,6 @@ SOURCE_FILE@0..128
|
|||
R_PAREN@99..100 ")"
|
||||
WHITESPACE@100..101 " "
|
||||
BLOCK_EXPR@101..103
|
||||
BLOCK@101..103
|
||||
L_CURLY@101..102 "{"
|
||||
R_CURLY@102..103 "}"
|
||||
WHITESPACE@103..108 "\n "
|
||||
|
@ -113,7 +109,6 @@ SOURCE_FILE@0..128
|
|||
R_PAREN@121..122 ")"
|
||||
WHITESPACE@122..123 " "
|
||||
BLOCK_EXPR@123..125
|
||||
BLOCK@123..125
|
||||
L_CURLY@123..124 "{"
|
||||
R_CURLY@124..125 "}"
|
||||
WHITESPACE@125..126 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..103
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..102
|
||||
BLOCK@9..102
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
LET_STMT@15..33
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..26
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..25
|
||||
BLOCK@9..25
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..23
|
||||
|
@ -17,7 +16,6 @@ SOURCE_FILE@0..26
|
|||
LOOP_KW@15..19 "loop"
|
||||
WHITESPACE@19..20 " "
|
||||
BLOCK_EXPR@20..22
|
||||
BLOCK@20..22
|
||||
L_CURLY@20..21 "{"
|
||||
R_CURLY@21..22 "}"
|
||||
SEMICOLON@22..23 ";"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..48
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..47
|
||||
BLOCK@9..47
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..21
|
||||
|
|
|
@ -9,14 +9,12 @@ SOURCE_FILE@0..69
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..68
|
||||
BLOCK@9..68
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
LOOP_EXPR@15..66
|
||||
LOOP_KW@15..19 "loop"
|
||||
WHITESPACE@19..20 " "
|
||||
BLOCK_EXPR@20..66
|
||||
BLOCK@20..66
|
||||
L_CURLY@20..21 "{"
|
||||
WHITESPACE@21..30 "\n "
|
||||
EXPR_STMT@30..39
|
||||
|
|
|
@ -32,7 +32,6 @@ SOURCE_FILE@0..69
|
|||
R_PAREN@29..30 ")"
|
||||
WHITESPACE@30..31 " "
|
||||
BLOCK_EXPR@31..33
|
||||
BLOCK@31..33
|
||||
L_CURLY@31..32 "{"
|
||||
R_CURLY@32..33 "}"
|
||||
WHITESPACE@33..38 "\n "
|
||||
|
@ -66,7 +65,6 @@ SOURCE_FILE@0..69
|
|||
R_PAREN@62..63 ")"
|
||||
WHITESPACE@63..64 " "
|
||||
BLOCK_EXPR@64..66
|
||||
BLOCK@64..66
|
||||
L_CURLY@64..65 "{"
|
||||
R_CURLY@65..66 "}"
|
||||
WHITESPACE@66..67 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..44
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..43
|
||||
BLOCK@9..43
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..20
|
||||
|
|
|
@ -55,7 +55,6 @@ SOURCE_FILE@0..89
|
|||
R_PAREN@61..62 ")"
|
||||
WHITESPACE@62..63 " "
|
||||
BLOCK_EXPR@63..65
|
||||
BLOCK@63..65
|
||||
L_CURLY@63..64 "{"
|
||||
R_CURLY@64..65 "}"
|
||||
WHITESPACE@65..70 "\n "
|
||||
|
@ -72,7 +71,6 @@ SOURCE_FILE@0..89
|
|||
R_PAREN@82..83 ")"
|
||||
WHITESPACE@83..84 " "
|
||||
BLOCK_EXPR@84..86
|
||||
BLOCK@84..86
|
||||
L_CURLY@84..85 "{"
|
||||
R_CURLY@85..86 "}"
|
||||
WHITESPACE@86..87 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..39
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..38
|
||||
BLOCK@10..38
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
LET_STMT@16..36
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..97
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..96
|
||||
BLOCK@9..96
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
LET_STMT@15..28
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..52
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..51
|
||||
BLOCK@10..51
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
LET_STMT@16..28
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..89
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..88
|
||||
BLOCK@9..88
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..25
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..197
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..37
|
||||
BLOCK@9..37
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..11 " "
|
||||
IF_EXPR@11..35
|
||||
|
@ -37,7 +36,6 @@ SOURCE_FILE@0..197
|
|||
IDENT@28..32 "None"
|
||||
WHITESPACE@32..33 " "
|
||||
BLOCK_EXPR@33..35
|
||||
BLOCK@33..35
|
||||
L_CURLY@33..34 "{"
|
||||
R_CURLY@34..35 "}"
|
||||
WHITESPACE@35..36 " "
|
||||
|
@ -53,7 +51,6 @@ SOURCE_FILE@0..197
|
|||
R_PAREN@45..46 ")"
|
||||
WHITESPACE@46..47 " "
|
||||
BLOCK_EXPR@47..196
|
||||
BLOCK@47..196
|
||||
L_CURLY@47..48 "{"
|
||||
WHITESPACE@48..53 "\n "
|
||||
EXPR_STMT@53..87
|
||||
|
@ -95,7 +92,6 @@ SOURCE_FILE@0..197
|
|||
IDENT@80..84 "None"
|
||||
WHITESPACE@84..85 " "
|
||||
BLOCK_EXPR@85..87
|
||||
BLOCK@85..87
|
||||
L_CURLY@85..86 "{"
|
||||
R_CURLY@86..87 "}"
|
||||
WHITESPACE@87..92 "\n "
|
||||
|
@ -127,7 +123,6 @@ SOURCE_FILE@0..197
|
|||
IDENT@111..115 "None"
|
||||
WHITESPACE@115..116 " "
|
||||
BLOCK_EXPR@116..118
|
||||
BLOCK@116..118
|
||||
L_CURLY@116..117 "{"
|
||||
R_CURLY@117..118 "}"
|
||||
WHITESPACE@118..123 "\n "
|
||||
|
@ -170,7 +165,6 @@ SOURCE_FILE@0..197
|
|||
IDENT@153..157 "None"
|
||||
WHITESPACE@157..158 " "
|
||||
BLOCK_EXPR@158..160
|
||||
BLOCK@158..160
|
||||
L_CURLY@158..159 "{"
|
||||
R_CURLY@159..160 "}"
|
||||
WHITESPACE@160..165 "\n "
|
||||
|
@ -201,7 +195,6 @@ SOURCE_FILE@0..197
|
|||
IDENT@187..191 "None"
|
||||
WHITESPACE@191..192 " "
|
||||
BLOCK_EXPR@192..194
|
||||
BLOCK@192..194
|
||||
L_CURLY@192..193 "{"
|
||||
R_CURLY@193..194 "}"
|
||||
WHITESPACE@194..195 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..93
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..92
|
||||
BLOCK@9..92
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..29
|
||||
|
@ -21,7 +20,6 @@ SOURCE_FILE@0..93
|
|||
TRUE_KW@21..25 "true"
|
||||
WHITESPACE@25..26 " "
|
||||
BLOCK_EXPR@26..28
|
||||
BLOCK@26..28
|
||||
L_CURLY@26..27 "{"
|
||||
R_CURLY@27..28 "}"
|
||||
SEMICOLON@28..29 ";"
|
||||
|
@ -60,7 +58,6 @@ SOURCE_FILE@0..93
|
|||
R_PAREN@62..63 ")"
|
||||
WHITESPACE@63..64 " "
|
||||
BLOCK_EXPR@64..66
|
||||
BLOCK@64..66
|
||||
L_CURLY@64..65 "{"
|
||||
R_CURLY@65..66 "}"
|
||||
SEMICOLON@66..67 ";"
|
||||
|
@ -71,7 +68,6 @@ SOURCE_FILE@0..93
|
|||
WHITESPACE@77..78 " "
|
||||
CONDITION@78..86
|
||||
BLOCK_EXPR@78..86
|
||||
BLOCK@78..86
|
||||
L_CURLY@78..79 "{"
|
||||
WHITESPACE@79..80 " "
|
||||
LITERAL@80..84
|
||||
|
@ -80,7 +76,6 @@ SOURCE_FILE@0..93
|
|||
R_CURLY@85..86 "}"
|
||||
WHITESPACE@86..87 " "
|
||||
BLOCK_EXPR@87..89
|
||||
BLOCK@87..89
|
||||
L_CURLY@87..88 "{"
|
||||
R_CURLY@88..89 "}"
|
||||
SEMICOLON@89..90 ";"
|
||||
|
|
|
@ -9,14 +9,12 @@ SOURCE_FILE@0..102
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..101
|
||||
BLOCK@9..101
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
LOOP_EXPR@15..99
|
||||
LOOP_KW@15..19 "loop"
|
||||
WHITESPACE@19..20 " "
|
||||
BLOCK_EXPR@20..99
|
||||
BLOCK@20..99
|
||||
L_CURLY@20..21 "{"
|
||||
WHITESPACE@21..30 "\n "
|
||||
EXPR_STMT@30..36
|
||||
|
|
|
@ -16,7 +16,6 @@ SOURCE_FILE@0..30
|
|||
R_PAREN@25..26 ")"
|
||||
WHITESPACE@26..27 " "
|
||||
BLOCK_EXPR@27..29
|
||||
BLOCK@27..29
|
||||
L_CURLY@27..28 "{"
|
||||
R_CURLY@28..29 "}"
|
||||
WHITESPACE@29..30 "\n"
|
||||
|
|
|
@ -42,7 +42,6 @@ SOURCE_FILE@0..71
|
|||
R_PAREN@34..35 ")"
|
||||
WHITESPACE@35..36 " "
|
||||
BLOCK_EXPR@36..70
|
||||
BLOCK@36..70
|
||||
L_CURLY@36..37 "{"
|
||||
WHITESPACE@37..38 " "
|
||||
EXPR_STMT@38..68
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..21
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..20
|
||||
BLOCK@9..20
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..11 " "
|
||||
EXPR_STMT@11..18
|
||||
|
|
|
@ -32,7 +32,6 @@ SOURCE_FILE@0..46
|
|||
WHITESPACE@27..28 " "
|
||||
CONST_ARG@28..33
|
||||
BLOCK_EXPR@28..33
|
||||
BLOCK@28..33
|
||||
L_CURLY@28..29 "{"
|
||||
WHITESPACE@29..30 " "
|
||||
LITERAL@30..31
|
||||
|
|
|
@ -12,7 +12,6 @@ SOURCE_FILE@0..71
|
|||
R_PAREN@14..15 ")"
|
||||
WHITESPACE@15..16 " "
|
||||
BLOCK_EXPR@16..19
|
||||
BLOCK@16..19
|
||||
L_CURLY@16..17 "{"
|
||||
WHITESPACE@17..18 " "
|
||||
R_CURLY@18..19 "}"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..118
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..117
|
||||
BLOCK@9..117
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
LET_STMT@15..27
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..21
|
|||
R_PAREN@5..6 ")"
|
||||
WHITESPACE@6..7 " "
|
||||
BLOCK_EXPR@7..20
|
||||
BLOCK@7..20
|
||||
L_CURLY@7..8 "{"
|
||||
WHITESPACE@8..9 " "
|
||||
FN_DEF@9..18
|
||||
|
@ -22,7 +21,6 @@ SOURCE_FILE@0..21
|
|||
R_PAREN@14..15 ")"
|
||||
WHITESPACE@15..16 " "
|
||||
BLOCK_EXPR@16..18
|
||||
BLOCK@16..18
|
||||
L_CURLY@16..17 "{"
|
||||
R_CURLY@17..18 "}"
|
||||
WHITESPACE@18..19 " "
|
||||
|
|
|
@ -41,7 +41,6 @@ SOURCE_FILE@0..35
|
|||
L_PAREN@30..31 "("
|
||||
R_PAREN@31..32 ")"
|
||||
BLOCK_EXPR@32..34
|
||||
BLOCK@32..34
|
||||
L_CURLY@32..33 "{"
|
||||
R_CURLY@33..34 "}"
|
||||
WHITESPACE@34..35 "\n"
|
||||
|
|
|
@ -35,7 +35,6 @@ SOURCE_FILE@0..58
|
|||
R_ANGLE@22..23 ">"
|
||||
WHITESPACE@23..24 " "
|
||||
BLOCK_EXPR@24..26
|
||||
BLOCK@24..26
|
||||
L_CURLY@24..25 "{"
|
||||
R_CURLY@25..26 "}"
|
||||
WHITESPACE@26..27 "\n"
|
||||
|
@ -77,7 +76,6 @@ SOURCE_FILE@0..58
|
|||
R_ANGLE@53..54 ">"
|
||||
WHITESPACE@54..55 " "
|
||||
BLOCK_EXPR@55..57
|
||||
BLOCK@55..57
|
||||
L_CURLY@55..56 "{"
|
||||
R_CURLY@56..57 "}"
|
||||
WHITESPACE@57..58 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..91
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..90
|
||||
BLOCK@9..90
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
LET_STMT@15..25
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..113
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..112
|
||||
BLOCK@10..112
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
MATCH_EXPR@16..110
|
||||
|
|
|
@ -105,7 +105,6 @@ SOURCE_FILE@0..116
|
|||
LIFETIME@110..112 "\'a"
|
||||
WHITESPACE@112..113 "\n"
|
||||
BLOCK_EXPR@113..115
|
||||
BLOCK@113..115
|
||||
L_CURLY@113..114 "{"
|
||||
R_CURLY@114..115 "}"
|
||||
WHITESPACE@115..116 "\n"
|
||||
|
|
|
@ -11,7 +11,6 @@ SOURCE_FILE@0..18
|
|||
R_PAREN@13..14 ")"
|
||||
WHITESPACE@14..15 " "
|
||||
BLOCK_EXPR@15..17
|
||||
BLOCK@15..17
|
||||
L_CURLY@15..16 "{"
|
||||
R_CURLY@16..17 "}"
|
||||
WHITESPACE@17..18 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..112
|
|||
R_PAREN@8..9 ")"
|
||||
WHITESPACE@9..10 " "
|
||||
BLOCK_EXPR@10..111
|
||||
BLOCK@10..111
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
MATCH_EXPR@16..109
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..83
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..82
|
||||
BLOCK@9..82
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
MATCH_EXPR@15..80
|
||||
|
@ -40,7 +39,6 @@ SOURCE_FILE@0..83
|
|||
FAT_ARROW@53..55 "=>"
|
||||
WHITESPACE@55..56 " "
|
||||
BLOCK_EXPR@56..58
|
||||
BLOCK@56..58
|
||||
L_CURLY@56..57 "{"
|
||||
R_CURLY@57..58 "}"
|
||||
WHITESPACE@58..67 "\n "
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..112
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..111
|
||||
BLOCK@9..111
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..20
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..70
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..11
|
||||
BLOCK@9..11
|
||||
L_CURLY@9..10 "{"
|
||||
R_CURLY@10..11 "}"
|
||||
WHITESPACE@11..12 "\n"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..137
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..136
|
||||
BLOCK@9..136
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..26
|
||||
|
@ -21,7 +20,6 @@ SOURCE_FILE@0..137
|
|||
TRUE_KW@18..22 "true"
|
||||
WHITESPACE@22..23 " "
|
||||
BLOCK_EXPR@23..25
|
||||
BLOCK@23..25
|
||||
L_CURLY@23..24 "{"
|
||||
R_CURLY@24..25 "}"
|
||||
SEMICOLON@25..26 ";"
|
||||
|
@ -35,14 +33,12 @@ SOURCE_FILE@0..137
|
|||
TRUE_KW@34..38 "true"
|
||||
WHITESPACE@38..39 " "
|
||||
BLOCK_EXPR@39..41
|
||||
BLOCK@39..41
|
||||
L_CURLY@39..40 "{"
|
||||
R_CURLY@40..41 "}"
|
||||
WHITESPACE@41..42 " "
|
||||
ELSE_KW@42..46 "else"
|
||||
WHITESPACE@46..47 " "
|
||||
BLOCK_EXPR@47..49
|
||||
BLOCK@47..49
|
||||
L_CURLY@47..48 "{"
|
||||
R_CURLY@48..49 "}"
|
||||
SEMICOLON@49..50 ";"
|
||||
|
@ -56,7 +52,6 @@ SOURCE_FILE@0..137
|
|||
TRUE_KW@58..62 "true"
|
||||
WHITESPACE@62..63 " "
|
||||
BLOCK_EXPR@63..65
|
||||
BLOCK@63..65
|
||||
L_CURLY@63..64 "{"
|
||||
R_CURLY@64..65 "}"
|
||||
WHITESPACE@65..66 " "
|
||||
|
@ -70,14 +65,12 @@ SOURCE_FILE@0..137
|
|||
FALSE_KW@74..79 "false"
|
||||
WHITESPACE@79..80 " "
|
||||
BLOCK_EXPR@80..82
|
||||
BLOCK@80..82
|
||||
L_CURLY@80..81 "{"
|
||||
R_CURLY@81..82 "}"
|
||||
WHITESPACE@82..83 " "
|
||||
ELSE_KW@83..87 "else"
|
||||
WHITESPACE@87..88 " "
|
||||
BLOCK_EXPR@88..90
|
||||
BLOCK@88..90
|
||||
L_CURLY@88..89 "{"
|
||||
R_CURLY@89..90 "}"
|
||||
SEMICOLON@90..91 ";"
|
||||
|
@ -94,7 +87,6 @@ SOURCE_FILE@0..137
|
|||
IDENT@99..100 "S"
|
||||
WHITESPACE@100..101 " "
|
||||
BLOCK_EXPR@101..103
|
||||
BLOCK@101..103
|
||||
L_CURLY@101..102 "{"
|
||||
R_CURLY@102..103 "}"
|
||||
SEMICOLON@103..104 ";"
|
||||
|
@ -105,7 +97,6 @@ SOURCE_FILE@0..137
|
|||
WHITESPACE@111..112 " "
|
||||
CONDITION@112..120
|
||||
BLOCK_EXPR@112..120
|
||||
BLOCK@112..120
|
||||
L_CURLY@112..113 "{"
|
||||
WHITESPACE@113..114 " "
|
||||
LITERAL@114..118
|
||||
|
@ -114,7 +105,6 @@ SOURCE_FILE@0..137
|
|||
R_CURLY@119..120 "}"
|
||||
WHITESPACE@120..121 " "
|
||||
BLOCK_EXPR@121..124
|
||||
BLOCK@121..124
|
||||
L_CURLY@121..122 "{"
|
||||
WHITESPACE@122..123 " "
|
||||
R_CURLY@123..124 "}"
|
||||
|
@ -122,7 +112,6 @@ SOURCE_FILE@0..137
|
|||
ELSE_KW@125..129 "else"
|
||||
WHITESPACE@129..130 " "
|
||||
BLOCK_EXPR@130..133
|
||||
BLOCK@130..133
|
||||
L_CURLY@130..131 "{"
|
||||
WHITESPACE@131..132 " "
|
||||
R_CURLY@132..133 "}"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..167
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..166
|
||||
BLOCK@9..166
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..164
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..46
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..45
|
||||
BLOCK@9..45
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
LET_STMT@15..31
|
||||
|
@ -22,7 +21,6 @@ SOURCE_FILE@0..46
|
|||
WHITESPACE@22..23 " "
|
||||
BIN_EXPR@23..30
|
||||
BLOCK_EXPR@23..26
|
||||
BLOCK@23..26
|
||||
L_CURLY@23..24 "{"
|
||||
LITERAL@24..25
|
||||
INT_NUMBER@24..25 "1"
|
||||
|
@ -36,7 +34,6 @@ SOURCE_FILE@0..46
|
|||
WHITESPACE@31..36 "\n "
|
||||
EXPR_STMT@36..39
|
||||
BLOCK_EXPR@36..39
|
||||
BLOCK@36..39
|
||||
L_CURLY@36..37 "{"
|
||||
LITERAL@37..38
|
||||
INT_NUMBER@37..38 "1"
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..97
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..96
|
||||
BLOCK@9..96
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..28
|
||||
|
@ -46,7 +45,6 @@ SOURCE_FILE@0..97
|
|||
MATCH_KW@49..54 "match"
|
||||
WHITESPACE@54..55 " "
|
||||
BLOCK_EXPR@55..58
|
||||
BLOCK@55..58
|
||||
L_CURLY@55..56 "{"
|
||||
WHITESPACE@56..57 " "
|
||||
R_CURLY@57..58 "}"
|
||||
|
@ -72,7 +70,6 @@ SOURCE_FILE@0..97
|
|||
MATCH_KW@76..81 "match"
|
||||
WHITESPACE@81..82 " "
|
||||
BLOCK_EXPR@82..90
|
||||
BLOCK@82..90
|
||||
L_CURLY@82..83 "{"
|
||||
WHITESPACE@83..84 " "
|
||||
RECORD_LIT@84..88
|
||||
|
|
|
@ -9,7 +9,6 @@ SOURCE_FILE@0..40
|
|||
R_PAREN@7..8 ")"
|
||||
WHITESPACE@8..9 " "
|
||||
BLOCK_EXPR@9..39
|
||||
BLOCK@9..39
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..22
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue