parser: handle `[noreturn]` on methods too
parent
1028f0b59e
commit
db1175e455
|
@ -0,0 +1 @@
|
|||
Test.zz_exit called, as it should
|
|
@ -0,0 +1,19 @@
|
|||
struct Test {}
|
||||
|
||||
[noreturn]
|
||||
fn (mut t Test) zz_exit() {
|
||||
println('${@METHOD} called, as it should')
|
||||
flush_stdout()
|
||||
exit(0)
|
||||
}
|
||||
|
||||
fn optional() ?int {
|
||||
return error('oh no')
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut test := Test{}
|
||||
a := optional() or { test.zz_exit() }
|
||||
println(a)
|
||||
exit(1)
|
||||
}
|
|
@ -399,6 +399,7 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
|
|||
generic_names: generic_names
|
||||
is_pub: is_pub
|
||||
is_deprecated: is_deprecated
|
||||
is_noreturn: is_noreturn
|
||||
is_unsafe: is_unsafe
|
||||
is_main: is_main
|
||||
is_test: is_test
|
||||
|
|
Loading…
Reference in New Issue