mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: handle c2v fn casts
This commit is contained in:
parent
1edb3e559e
commit
5bf28c5287
@ -5061,6 +5061,15 @@ fn (mut g Gen) ident(node ast.Ident) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if node_info is ast.IdentFn {
|
} else if node_info is ast.IdentFn {
|
||||||
|
if g.pref.translated {
|
||||||
|
// `p_mobjthinker` => `P_MobjThinker`
|
||||||
|
if f := g.table.find_fn(node.name) {
|
||||||
|
// TODO PERF fn lookup for each fn call in translated mode
|
||||||
|
if f.attrs.contains('c') {
|
||||||
|
name = f.attrs[0].arg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if g.pref.obfuscate && g.cur_mod.name == 'main' && name.starts_with('main__') {
|
if g.pref.obfuscate && g.cur_mod.name == 'main' && name.starts_with('main__') {
|
||||||
key := node.name
|
key := node.name
|
||||||
g.write('/* obf identfn: $key */')
|
g.write('/* obf identfn: $key */')
|
||||||
@ -5114,6 +5123,15 @@ fn (mut g Gen) cast_expr(node ast.CastExpr) {
|
|||||||
g.expr(node.expr)
|
g.expr(node.expr)
|
||||||
} else {
|
} else {
|
||||||
styp := g.typ(node.typ)
|
styp := g.typ(node.typ)
|
||||||
|
if g.pref.translated && sym.kind == .function {
|
||||||
|
// TODO handle the type in fn casts, not just exprs
|
||||||
|
/*
|
||||||
|
info := sym.info as ast.FnType
|
||||||
|
if info.func.attrs.contains('c') {
|
||||||
|
// name = f.attrs[0].arg
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
mut cast_label := ''
|
mut cast_label := ''
|
||||||
// `ast.string_type` is done for MSVC's bug
|
// `ast.string_type` is done for MSVC's bug
|
||||||
if sym.kind != .alias
|
if sym.kind != .alias
|
||||||
|
Loading…
Reference in New Issue
Block a user