1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: minor clean up in comptime_call() (#12860)

This commit is contained in:
yuyi 2021-12-16 16:47:47 +08:00 committed by GitHub
parent d8a333058d
commit 674f99a658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,6 @@ import v.util
import v.pkgconfig
fn (mut c Checker) comptime_call(mut node ast.ComptimeCall) ast.Type {
sym := c.table.get_type_symbol(c.unwrap_generic(c.expr(node.left)))
node.left_type = c.expr(node.left)
if node.is_env {
env_value := util.resolve_env_value("\$env('$node.args_var')", false) or {
@ -94,11 +93,11 @@ fn (mut c Checker) comptime_call(mut node ast.ComptimeCall) ast.Type {
} else {
c.error('todo: not a string literal', node.method_pos)
}
f := sym.find_method(method_name) or {
left_sym := c.table.get_type_symbol(c.unwrap_generic(node.left_type))
f := left_sym.find_method(method_name) or {
c.error('could not find method `$method_name`', node.method_pos)
return ast.void_type
}
// println(f.name + ' ' + c.table.type_to_str(f.return_type))
node.result_type = f.return_type
return f.return_type
}