@@ -76,10 +76,11 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) {
76
76
}
77
77
return
78
78
}
79
- g.trace_autofree ('// \$ method call. sym="$node.sym.name "' )
79
+ sym := g.table.get_type_symbol (g.unwrap_generic (node.left_type))
80
+ g.trace_autofree ('// \$ method call. sym="$sym.name "' )
80
81
if node.method_name == 'method' {
81
82
// `app.$method()`
82
- m := node. sym.find_method (g.comptime_for_method) or { return }
83
+ m := sym.find_method (g.comptime_for_method) or { return }
83
84
/*
84
85
vals := m.attrs[0].split('/')
85
86
args := vals.filter(it.starts_with(':')).map(it[1..])
@@ -99,15 +100,15 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) {
99
100
// check argument length and types
100
101
if m.params.len - 1 != node.args.len && ! expand_strs {
101
102
// do not generate anything if the argument lengths don't match
102
- g.writeln ('/* skipping ${node. sym.name} .$m.name due to mismatched arguments list */' )
103
+ g.writeln ('/* skipping ${sym.name} .$m.name due to mismatched arguments list */' )
103
104
// g.writeln('println(_SLIT("skipping ${node.sym.name}.$m.name due to mismatched arguments list"));')
104
105
// eprintln('info: skipping ${node.sym.name}.$m.name due to mismatched arguments list\n' +
105
106
// 'method.params: $m.params, args: $node.args\n\n')
106
107
// verror('expected ${m.params.len-1} arguments to method ${node.sym.name}.$m.name, but got $node.args.len')
107
108
return
108
109
}
109
110
// TODO: check argument types
110
- g.write ('${util.no_dots(node. sym.name)} _${g.comptime_for_method} (' )
111
+ g.write ('${util.no_dots(sym.name)} _${g.comptime_for_method} (' )
111
112
112
113
// try to see if we need to pass a pointer
113
114
if node.left is ast.Ident {
@@ -153,7 +154,7 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) {
153
154
return
154
155
}
155
156
mut j := 0
156
- for method in node. sym.methods {
157
+ for method in sym.methods {
157
158
// if method.return_type != ast.void_type {
158
159
if method.return_type != node.result_type {
159
160
continue
@@ -172,7 +173,7 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) {
172
173
}
173
174
g.write ('if (string__eq($node.method_name , _SLIT("$method.name "))) ' )
174
175
}
175
- g.write ('${util.no_dots(node. sym.name)} _${method.name} ($amp ' )
176
+ g.write ('${util.no_dots(sym.name)} _${method.name} ($amp ' )
176
177
g.expr (node.left)
177
178
g.writeln (');' )
178
179
j++
0 commit comments