Introduce EffectExpr

This commit is contained in:
Aleksey Kladov 2020-05-02 01:18:19 +02:00
parent 3c96de5380
commit 4f2134cc33
25 changed files with 242 additions and 261 deletions

View file

@ -162,7 +162,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
"RECORD_LIT",
"RECORD_FIELD_LIST",
"RECORD_FIELD",
"TRY_BLOCK_EXPR",
"EFFECT_EXPR",
"BOX_EXPR",
// postfix
"CALL_EXPR",
@ -177,7 +177,6 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
"PREFIX_EXPR",
"RANGE_EXPR", // just weird
"BIN_EXPR",
"BLOCK",
"EXTERN_BLOCK",
"EXTERN_ITEM_LIST",
"ENUM_VARIANT",
@ -440,7 +439,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
}
struct IfExpr: AttrsOwner { T![if], Condition }
struct LoopExpr: AttrsOwner, LoopBodyOwner { T![loop] }
struct TryBlockExpr: AttrsOwner { T![try], body: BlockExpr }
struct EffectExpr: AttrsOwner { Label, T![try], T![unsafe], T![async], BlockExpr }
struct ForExpr: AttrsOwner, LoopBodyOwner {
T![for],
Pat,
@ -451,7 +450,9 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
struct ContinueExpr: AttrsOwner { T![continue], T![lifetime] }
struct BreakExpr: AttrsOwner { T![break], T![lifetime], Expr }
struct Label { T![lifetime] }
struct BlockExpr: AttrsOwner { Label, T![unsafe], T![async], Block }
struct BlockExpr: AttrsOwner, ModuleItemOwner {
T!['{'], statements: [Stmt], Expr, T!['}'],
}
struct ReturnExpr: AttrsOwner { Expr }
struct CallExpr: ArgListOwner { Expr }
struct MethodCallExpr: AttrsOwner, ArgListOwner {
@ -460,7 +461,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
struct IndexExpr: AttrsOwner { T!['['], T![']'] }
struct FieldExpr: AttrsOwner { Expr, T![.], NameRef }
struct AwaitExpr: AttrsOwner { Expr, T![.], T![await] }
struct TryExpr: AttrsOwner { T![try], Expr }
struct TryExpr: AttrsOwner { Expr, T![?] }
struct CastExpr: AttrsOwner { Expr, T![as], TypeRef }
struct RefExpr: AttrsOwner { T![&], T![raw], T![mut], Expr }
struct PrefixExpr: AttrsOwner { /*PrefixOp,*/ Expr }
@ -556,12 +557,6 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
T![;],
}
struct Condition { T![let], Pat, T![=], Expr }
struct Block: AttrsOwner, ModuleItemOwner {
T!['{'],
statements: [Stmt],
Expr,
T!['}'],
}
struct ParamList {
T!['('],
SelfParam,
@ -722,7 +717,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
FieldExpr,
AwaitExpr,
TryExpr,
TryBlockExpr,
EffectExpr,
CastExpr,
RefExpr,
PrefixExpr,