Initial add parent_ast to scopes
This commit is contained in:
@@ -567,25 +567,6 @@ struct Ast_Switch : Ast {
|
||||
Ast_Scope *default_scope;
|
||||
};
|
||||
|
||||
/*
|
||||
How does current declaration order resolver works:
|
||||
* First we put all the global declarations into the global scope (when parsing) all unresolved
|
||||
* All the types are declared INCOMPLETE and RESOLVED
|
||||
* We descent the tree by resolving each of the named declarations, we resolve by their name
|
||||
When we start resolving we set RESOLVING flag and when we complete RESOLVED flag
|
||||
and put into ordered list
|
||||
* When we meet a symbol (named declaration) while descending the tree,
|
||||
we resolve that symbol instead before resolving current declaration.
|
||||
* When we meet a declaration that requires size of a type - field access, var assignment,
|
||||
we need to call "complete_type", it sets COMPLETING flag.
|
||||
This call resolves all the dependencies of that type,
|
||||
sets size of type and marks it as COMPLETE and puts into ordered list.
|
||||
If it detects COMPLETING while
|
||||
resolving, we got a circular dependency. That might happen when we have
|
||||
that struct without pointer inside itself.
|
||||
|
||||
*/
|
||||
|
||||
struct Ast_Scope : Ast {
|
||||
String debug_name; // Only for debug purposes, dont depend on it
|
||||
List<Ast_Scope *> implicit_imports;
|
||||
@@ -595,7 +576,10 @@ struct Ast_Scope : Ast {
|
||||
uint32_t scope_id;
|
||||
Ast_Scope *file; // Self referential for file and module
|
||||
Ast_Module *module;
|
||||
Ast_Decl *parent_decl; // @language_todo: add parent decl
|
||||
union {
|
||||
Ast *parent_ast; // @language_todo: add parent decl
|
||||
Ast_Decl *parent_decl;
|
||||
};
|
||||
};
|
||||
|
||||
enum Ast_Module_State {
|
||||
|
||||
Reference in New Issue
Block a user