parser: fix infnite loop with `fn foo(&) {}`
parent
d71532b64e
commit
c00a7f3a5e
|
@ -331,7 +331,8 @@ fn (p mut Parser) fn_decl() {
|
|||
// `os.exit()` ==> `os__exit()`
|
||||
// if !is_c && !p.builtin_mod && receiver_typ.len == 0 {
|
||||
if !is_c && !has_receiver &&
|
||||
(!p.builtin_mod || (p.builtin_mod && f.name == 'init')) {
|
||||
(!p.builtin_mod || (p.builtin_mod && f.name == 'init'))
|
||||
{
|
||||
f.name = p.prepend_mod(f.name)
|
||||
}
|
||||
if p.first_pass() && receiver_typ.len == 0 {
|
||||
|
@ -848,6 +849,9 @@ fn (p mut Parser) fn_args(f mut Fn) {
|
|||
if types_only {
|
||||
for p.tok != .rpar {
|
||||
typ := p.get_type()
|
||||
if typ == '' && !f.is_c {
|
||||
p.error('bad fn arg type')
|
||||
}
|
||||
p.check_and_register_used_imported_type(typ)
|
||||
v := Var {
|
||||
typ: typ
|
||||
|
|
Loading…
Reference in New Issue