diff options
| author | gingerBill <bill@gingerbill.org> | 2018-06-15 22:49:06 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-06-15 22:49:06 +0100 |
| commit | cd7e260f4e77ea992115b3dd26d7b92d99bae0f7 (patch) | |
| tree | 83bbc57ba87aeab46be080709023a9db9df5553f /src/checker.hpp | |
| parent | ba67e474d3ab48cf15916892a15759f50930f72f (diff) | |
Fix cyclic polymorphic procedure usage and improve its error message
Diffstat (limited to 'src/checker.hpp')
| -rw-r--r-- | src/checker.hpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/checker.hpp b/src/checker.hpp index a4987dd0b..d80e012d5 100644 --- a/src/checker.hpp +++ b/src/checker.hpp @@ -218,15 +218,16 @@ struct DeclInfo { Array<BlockLabel> labels; }; -// ProcedureInfo stores the information needed for checking a procedure -struct ProcedureInfo { - AstFile * file; - Token token; - DeclInfo * decl; - Type * type; // Type_Procedure - AstNode * body; // AstNode_BlockStmt - u64 tags; - bool generated_from_polymorphic; +// ProcInfo stores the information needed for checking a procedure +struct ProcInfo { + AstFile * file; + Token token; + DeclInfo *decl; + Type * type; // Type_Procedure + AstNode * body; // AstNode_BlockStmt + u64 tags; + bool generated_from_polymorphic; + AstNode * poly_def_node; }; @@ -296,6 +297,7 @@ struct ForeignContext { }; typedef Array<Entity *> CheckerTypePath; +typedef Array<Type *> CheckerPolyPath; // CheckerInfo stores all the symbol information for a type-checked program struct CheckerInfo { @@ -342,6 +344,8 @@ struct CheckerContext { CheckerTypePath *type_path; isize type_level; // TODO(bill): Actually handle correctly + CheckerPolyPath *poly_path; + isize poly_level; // TODO(bill): Actually handle correctly bool in_enum_type; bool collect_delayed_decls; @@ -355,7 +359,7 @@ struct Checker { Parser * parser; CheckerInfo info; - Array<ProcedureInfo> procs_to_check; + Array<ProcInfo> procs_to_check; PtrSet<AstPackage *> checked_packages; gbAllocator allocator; @@ -419,3 +423,9 @@ void destroy_checker_type_path(CheckerTypePath *tp); void check_type_path_push(CheckerContext *c, Entity *e); Entity *check_type_path_pop (CheckerContext *c); + +CheckerPolyPath *new_checker_poly_path(); +void destroy_checker_poly_path(CheckerPolyPath *); + +void check_poly_path_push(CheckerContext *c, Type *t); +Type *check_poly_path_pop (CheckerContext *c); |