mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
restrain the set of captured variables further
This commit is contained in:
parent
40ffca2b7b
commit
e656363cc0
6 changed files with 30 additions and 11 deletions
|
@ -481,9 +481,15 @@ pub fn canonicalize_expr<'a>(
|
|||
captured_symbols.retain(|s| !new_output.references.bound_symbols.contains(s));
|
||||
captured_symbols.retain(|s| !bound_by_argument_patterns.contains(s));
|
||||
|
||||
// TODO filter out top-level symbols, and imported symbols
|
||||
// filter out top-level symbols
|
||||
// those will be globally available, and don't need to be captured
|
||||
captured_symbols.retain(|s| !s.is_builtin());
|
||||
captured_symbols.retain(|s| !env.top_level_symbols.contains(s));
|
||||
|
||||
// filter out imported symbols
|
||||
// those will be globally available, and don't need to be captured
|
||||
captured_symbols.retain(|s| s.module_id() == env.home);
|
||||
|
||||
// TODO any Closure that has an empty `captured_symbols` list could be excluded!
|
||||
|
||||
output.union(new_output);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue