We need an FnInfo
#18
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
🎶We need an info!🎶
The
Fn
Ast
node type should have a field for anFnInfo
object thatValidate
can generate. This should include:That way, when interpreting the
Fn
we can close over the necessary bindings.Also, this needs to be stored out-of-band, since we can't mutate the AST when doing the validation pass.
Because of that we need a way of storing information about functions that can be a field on the
Validator
struct.As it turns out, it looks like we can store this in a HashMap that uses a
*const Ast
pointer as the key, and anFnInfo
object as the value. This map can then be borrowed by theContext
object to successfully compile the function.Also, the
Validator
locals bindings vector should allow storing of pointers to Ast function nodes so we can check arity for function calls where that's possible.There should be three enum branches for that: 1. declared, not yet defined (with location info); 2. declared, with all the info; and 3. no information. (We can't even say not a function!)
That's also helpful, because at the end of a block, we can check to see if the bindings stack still has any declared-but-not-defined functions in it, and yell about it if they're there.
Done! Fully implemented in
35e9d0373d