fix interface on all platforms

pull/3883/head
yuyi 2020-02-29 22:27:28 +08:00 committed by GitHub
parent 99cbc58db8
commit a678be7195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 9 deletions

View File

@ -1117,17 +1117,10 @@ fn (p mut Parser) fn_call_args(f mut Fn, generic_param_types []string) {
if t.cat == .interface_ { if t.cat == .interface_ {
// perform((Speaker) { ._object = &dog, // perform((Speaker) { ._object = &dog,
// _interface_idx = _Speaker_Dog_index }) // _interface_idx = _Speaker_Dog_index })
$if windows { if !f.is_method {
if !f.is_method {
concrete_type_name := typ.replace('*', '_ptr')
p.cgen.set_placeholder(ph, '($arg.typ) { ._object = &')
p.gen(', /*OLD*/ ._interface_idx = _${arg.typ}_${concrete_type_name}_index} /* i. arg*/')
}
}
$else {
concrete_type_name := typ.replace('*', '_ptr') concrete_type_name := typ.replace('*', '_ptr')
p.cgen.set_placeholder(ph, '($arg.typ) { ._object = &') p.cgen.set_placeholder(ph, '($arg.typ) { ._object = &')
p.gen(', /*OLD*/ ._interface_idx = _${arg.typ}_${concrete_type_name}_index} /* i. arg*/') p.gen(', ._interface_idx = _${arg.typ}_${concrete_type_name}_index} ')
} }
p.table.add_gen_type(arg.typ, typ) p.table.add_gen_type(arg.typ, typ)
} }