From d7758b299568241da354e1cc1e62b53b9540a933 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 18 Sep 2022 21:43:44 +0300 Subject: [PATCH] checker: fix slow compilation of vtl/nn/examples/mnist.v (reduce RAM usage) --- vlib/v/checker/fn.v | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index 66b18e4bc5..f87596bd69 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -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