mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Fix parsing #force_inline call expression with or_return
This commit is contained in:
@@ -553,6 +553,27 @@ unparen_expr :: proc(expr: ^Expr) -> (val: ^Expr) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strip_or_return_expr :: proc(expr: ^Expr) -> (val: ^Expr) {
|
||||||
|
val = expr
|
||||||
|
if expr == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for {
|
||||||
|
inner: ^Expr
|
||||||
|
#partial switch e in val.derived {
|
||||||
|
case ^Or_Return_Expr:
|
||||||
|
inner = e.expr
|
||||||
|
case ^Paren_Expr:
|
||||||
|
inner = e.expr
|
||||||
|
}
|
||||||
|
if inner == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
val = inner
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
Field_Flags :: distinct bit_set[Field_Flag]
|
Field_Flags :: distinct bit_set[Field_Flag]
|
||||||
|
|
||||||
Field_Flag :: enum {
|
Field_Flag :: enum {
|
||||||
|
|||||||
@@ -2153,7 +2153,7 @@ parse_inlining_operand :: proc(p: ^Parser, lhs: bool, tok: tokenizer.Token) -> ^
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#partial switch e in ast.unparen_expr(expr).derived_expr {
|
#partial switch e in ast.strip_or_return_expr(expr).derived_expr {
|
||||||
case ^ast.Proc_Lit:
|
case ^ast.Proc_Lit:
|
||||||
if e.inlining != .None && e.inlining != pi {
|
if e.inlining != .None && e.inlining != pi {
|
||||||
error(p, expr.pos, "both 'inline' and 'no_inline' cannot be applied to a procedure literal")
|
error(p, expr.pos, "both 'inline' and 'no_inline' cannot be applied to a procedure literal")
|
||||||
|
|||||||
Reference in New Issue
Block a user