gen: fix interface method call name that is a C reserved word (#8091)

pull/8094/head
Nick Treleaven 2021-01-13 14:37:47 +00:00 committed by GitHub
parent 70ad49e186
commit a1245de25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -347,7 +347,8 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
g.write('${c_name(receiver_type_name)}_name_table[')
g.expr(node.left)
dot := if node.left_type.is_ptr() { '->' } else { '.' }
g.write('${dot}_interface_idx].${node.name}(')
mname := c_name(node.name)
g.write('${dot}_interface_idx].${mname}(')
g.expr(node.left)
g.write('${dot}_object')
if node.args.len > 0 {

View File

@ -177,6 +177,7 @@ fn (f RegTest) register() {
}
fn handle_reg(r Register) {
r.register()
}
fn test_register() {