Fix (gen.c) -> Fixed attribute without its value is now an error
parent
50e4ca9c31
commit
8ade188e0d
|
|
@ -1349,9 +1349,7 @@ pub fn (mut g Gen) write_fn_typesymbol_declaration(sym ast.TypeSymbol) {
|
||||||
for attr in func.attrs {
|
for attr in func.attrs {
|
||||||
match attr.name {
|
match attr.name {
|
||||||
'callconv' {
|
'callconv' {
|
||||||
if attr.has_arg {
|
call_conv = '__$attr.arg '
|
||||||
call_conv = '__$attr.arg '
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {}
|
else {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2154,9 +2154,7 @@ fn (mut g Gen) write_fn_attrs(attrs []ast.Attr) string {
|
||||||
fn_attrs += '__fastcall '
|
fn_attrs += '__fastcall '
|
||||||
}
|
}
|
||||||
"callconv" {
|
"callconv" {
|
||||||
if attr.has_arg {
|
fn_attrs += '__$attr.arg '
|
||||||
fn_attrs += '__$attr.arg '
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'console' {
|
'console' {
|
||||||
g.force_main_console = true
|
g.force_main_console = true
|
||||||
|
|
|
||||||
|
|
@ -230,11 +230,11 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
|
||||||
p.tok.pos())
|
p.tok.pos())
|
||||||
}
|
}
|
||||||
'callconv' {
|
'callconv' {
|
||||||
if fna.has_arg {
|
if !fna.has_arg {
|
||||||
if fna.arg !in ['stdcall', 'fastcall', 'cdecl'] {
|
p.error_with_pos('callconv attribute is present but its value is missing', p.prev_tok.pos())
|
||||||
p.error_with_pos('unsupported calling convention, supported are stdcall, fastcall and cdecl',
|
}
|
||||||
p.tok.pos())
|
if fna.arg !in ['stdcall', 'fastcall', 'cdecl'] {
|
||||||
}
|
p.error_with_pos('unsupported calling convention, supported are stdcall, fastcall and cdecl', p.prev_tok.pos())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {}
|
else {}
|
||||||
|
|
|
||||||
|
|
@ -233,11 +233,11 @@ pub fn (mut p Parser) parse_fn_type(name string) ast.Type {
|
||||||
for attr in p.attrs {
|
for attr in p.attrs {
|
||||||
match attr.name {
|
match attr.name {
|
||||||
'callconv' {
|
'callconv' {
|
||||||
if attr.has_arg {
|
if !attr.has_arg {
|
||||||
if attr.arg !in ['stdcall', 'fastcall', 'cdecl'] {
|
p.error_with_pos('callconv attribute is present but its value is missing', p.prev_tok.pos())
|
||||||
p.error_with_pos('unsupported calling convention, supported are stdcall, fastcall and cdecl',
|
}
|
||||||
p.prev_tok.pos())
|
if attr.arg !in ['stdcall', 'fastcall', 'cdecl'] {
|
||||||
}
|
p.error_with_pos('unsupported calling convention, supported are stdcall, fastcall and cdecl', p.prev_tok.pos())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {}
|
else {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue