mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix infnite loop with fn foo(&) {}
This commit is contained in:
parent
d71532b64e
commit
c00a7f3a5e
@ -331,7 +331,8 @@ fn (p mut Parser) fn_decl() {
|
|||||||
// `os.exit()` ==> `os__exit()`
|
// `os.exit()` ==> `os__exit()`
|
||||||
// if !is_c && !p.builtin_mod && receiver_typ.len == 0 {
|
// if !is_c && !p.builtin_mod && receiver_typ.len == 0 {
|
||||||
if !is_c && !has_receiver &&
|
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)
|
f.name = p.prepend_mod(f.name)
|
||||||
}
|
}
|
||||||
if p.first_pass() && receiver_typ.len == 0 {
|
if p.first_pass() && receiver_typ.len == 0 {
|
||||||
@ -848,6 +849,9 @@ fn (p mut Parser) fn_args(f mut Fn) {
|
|||||||
if types_only {
|
if types_only {
|
||||||
for p.tok != .rpar {
|
for p.tok != .rpar {
|
||||||
typ := p.get_type()
|
typ := p.get_type()
|
||||||
|
if typ == '' && !f.is_c {
|
||||||
|
p.error('bad fn arg type')
|
||||||
|
}
|
||||||
p.check_and_register_used_imported_type(typ)
|
p.check_and_register_used_imported_type(typ)
|
||||||
v := Var {
|
v := Var {
|
||||||
typ: typ
|
typ: typ
|
||||||
|
Loading…
Reference in New Issue
Block a user