Don't add duplicate symbols to symbol table
@@ -75,9 +75,10 @@ bind_names_program = function(prog, st, errors)
scope_error(errors, tlnode.loc,
"duplicate toplevel declaration for %s, previous one at line %d",
name, dup.loc.line)
- end
+ else
st:add_symbol(name, tlnode)
end
+ end
-- Now we can resolve names in toplevel type annotations and in function
-- bodies.
@@ -144,9 +145,10 @@ bind_names_toplevel = function(tlnode, st, errors)
scope_error(errors, decl.loc,
"function '%s' has multiple parameters named '%s'",
tlnode.name, decl.name)
- end
+ else
st:add_symbol(decl.name, decl)
end
+ end
bind_names_stat(tlnode.block, st, errors)
end)
