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

checker: fix slow compilation of vtl/nn/examples/mnist.v (reduce RAM usage)

This commit is contained in:
Delyan Angelov 2022-09-18 21:43:44 +03:00
parent 04f818fefc
commit d7758b2995
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -358,10 +358,16 @@ fn (mut c Checker) fn_decl(mut node ast.FnDecl) {
}
node.source_file = c.file
if c.table.known_fn(node.name) && node.name != 'main.main' {
if node.name in c.table.fns && node.name != 'main.main' {
mut dep_names := []string{}
for stmt in node.stmts {
dep_names << c.table.dependent_names_in_stmt(stmt)
dnames := c.table.dependent_names_in_stmt(stmt)
for dname in dnames {
if dname in dep_names {
continue
}
dep_names << dname
}
}
if dep_names.len > 0 {
c.table.fns[node.name].dep_names = dep_names