Skip to content

Commit

Permalink
generate interface methods
Browse files Browse the repository at this point in the history
  • Loading branch information
medvednikov committed Aug 23, 2024
1 parent ead685d commit ad25e0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions fn_decl.v
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,19 @@ fn (mut app App) func_decl(decl Decl) {
}
app.gen(method_name)
app.func_params(decl.typ.params)
app.func_return_type(decl.typ.results)
app.block_stmt(decl.body)
}

fn (mut app App) func_type(t FuncType) {
app.func_params(t.params)
app.func_return_type(t.results)
}

fn (mut app App) func_return_type(results FieldList) {
// app.genln(results)
// Return types
return_types := decl.typ.results.list
return_types := results.list
if return_types.len > 1 {
app.gen('(')
}
Expand All @@ -53,7 +63,6 @@ fn (mut app App) func_decl(decl Decl) {
if return_types.len > 1 {
app.gen(')')
}
app.block_stmt(decl.body)
}

fn (mut app App) func_params(params FieldList) {
Expand Down
3 changes: 2 additions & 1 deletion main.v
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ fn (mut app App) typ(t Type) {
app.gen('INTERFACE TYPE')
}
FuncType {
app.gen('FUNC TYPE')
app.func_type(t)
// app.gen('FUNC TYPE')
}
}
app.force_upper = false
Expand Down

0 comments on commit ad25e0e

Please sign in to comment.