ref: b6872f8fa14d01499db9bdfcfbf2cfa48266bd28
parent: a8a5638f3cd024f627ce3fd64aac94fd8fcf9e6f
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jun 24 08:41:10 EDT 2017
Clean up infer state structure and comments.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -17,6 +17,7 @@
typedef struct Inferstate Inferstate;
struct Inferstate {
+ /* tracking where we are in the inference */
int ingeneric;
int inaggr;
int innamed;
@@ -23,31 +24,29 @@
int indentdepth;
Type *ret;
- /* bound by patterns turn into decls in the action block */
- Node **impldecl;
- size_t nimpldecl;
- /* nodes that need post-inference checking/unification */
+ /* post-inference checking/unification */
+ Htab *delayed;
Node **postcheck;
size_t npostcheck;
Stab **postcheckscope;
size_t npostcheckscope;
- /* the type params bound at the current point */
+
+ /* type params bound at the current point */
Htab **tybindings;
size_t ntybindings;
+
/* generic declarations to be specialized */
Node **genericdecls;
size_t ngenericdecls;
- /* delayed unification -- we fall back to these types in a post pass if we
- * haven't unifed to something more specific */
- Htab *delayed;
- /* mappings from iterator type to element type */
- Htab *seqbase;
- /* the nodes that we've specialized them to, and the scopes they
- * appear in */
+ Node **impldecl;
+ size_t nimpldecl;
+
+ /* specializations of generics */
Node **specializations;
size_t nspecializations;
Stab **specializationscope;
size_t nspecializationscope;
+ Htab *seqbase;
};
static void infernode(Inferstate *st, Node **np, Type *ret, int *sawret);