inline function

This commit is contained in:
Folkert 2022-04-23 22:15:09 +02:00
parent 0f245ba778
commit c9d422335f
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 8 additions and 5 deletions

View file

@ -1180,8 +1180,13 @@ fn add_annotation_aliases(
// See 3d5a2560057d7f25813112dfa5309956c0f9e6a9 and its // See 3d5a2560057d7f25813112dfa5309956c0f9e6a9 and its
// parent commit for the bug this fixed! // parent commit for the bug this fixed!
enum DefReferences { enum DefReferences {
/// A value may not reference itself
Value(References), Value(References),
/// If the def is a function, different rules apply (it can call itself)
Function(References), Function(References),
/// An annotation without a body references no other defs
AnnotationWithoutBody, AnnotationWithoutBody,
} }

View file

@ -182,8 +182,4 @@ impl<'a> Env<'a> {
pub fn problem(&mut self, problem: Problem) { pub fn problem(&mut self, problem: Problem) {
self.problems.push(problem) self.problems.push(problem)
} }
pub fn register_closure(&mut self, symbol: Symbol, references: References) {
self.closures.insert(symbol, references);
}
} }

View file

@ -699,7 +699,9 @@ pub fn canonicalize_expr<'a>(
} }
} }
env.register_closure(symbol, output.references.clone()); // store the references of this function in the Env. This information is used
// when we canonicalize a surrounding def (if it exists)
env.closures.insert(symbol, output.references.clone());
let mut captured_symbols: Vec<_> = captured_symbols let mut captured_symbols: Vec<_> = captured_symbols
.into_iter() .into_iter()