ast: fix call_expr.str() with propagate_option or propagate_result (#14550)

master
yuyi 2022-05-29 01:47:29 +08:00 committed by GitHub
parent c6a6eb9a3c
commit 7dcc19df55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -303,7 +303,13 @@ pub fn (x Expr) str() string {
}
CallExpr {
sargs := args2str(x.args)
propagate_suffix := if x.or_block.kind == .propagate_option { ' ?' } else { '' }
propagate_suffix := if x.or_block.kind == .propagate_option {
'?'
} else if x.or_block.kind == .propagate_result {
'!'
} else {
''
}
if x.is_method {
return '${x.left.str()}.${x.name}($sargs)$propagate_suffix'
}