Core: Add Ast_Label
This commit is contained in:
@@ -334,6 +334,7 @@ enum Ast_Kind : uint32_t {
|
||||
AST_TYPE_OF,
|
||||
AST_VARGS_LAMBDA_PARAM,
|
||||
|
||||
AST_LABEL,
|
||||
AST_SWITCH,
|
||||
AST_SWITCH_CASE,
|
||||
AST_VAR_UNPACK,
|
||||
@@ -404,17 +405,6 @@ struct Ast_Expr : Ast {
|
||||
};
|
||||
};
|
||||
|
||||
/* Typespecs
|
||||
*int - (AST_UNARY=TK_Pointer Ast_Unary) == TYPE_POINTER
|
||||
int - (AST_IDENT Ast_Atom) == TYPE_INT ..
|
||||
[] - (Ast_Array AST_ARRAY) == TYPE_SLICE
|
||||
[3] - (Ast_Array AST_ARRAY) == TYPE_ARRAY
|
||||
Array(int) - (Ast_Call AST_CALL) == TYPE_STRUCT, TYPE_UNION
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
struct Ast_Atom : Ast_Expr {
|
||||
// We have a field type here
|
||||
// it has a different purpose from the
|
||||
@@ -501,10 +491,25 @@ struct Ast_Builtin : Ast_Expr {
|
||||
|
||||
// Problem: We are parsing out of order, in the middle of parsing a function
|
||||
// we can jump down a different function, we cant therfore use global map.
|
||||
// Because it would have symbols from previous function we were in middle of resolving.
|
||||
//
|
||||
// On top of that in the future we want a way to inject scopes, for convenience.
|
||||
// Each scope needs to have it's checked locals list. To lookup syms we need to
|
||||
// look into global scope and to the locals list.
|
||||
//
|
||||
//
|
||||
// This seems slow though, would be nice to have a simpler scheme that's more flat.
|
||||
// Would be nice to just reuse single map while resolving that would keep track of which
|
||||
// function we are resolving.
|
||||
//
|
||||
// Also would be nice to have a more flat module scheme. The Ion approach seemed
|
||||
// very straight forward when I looked at it. It used a single locals list with
|
||||
// an index that signified from where we should consider declarations. Not really
|
||||
// sure how the packages worked though.
|
||||
//
|
||||
// The idea that you have a flat list of packages, each package has a flat list of declarations.
|
||||
// Seems nice.
|
||||
//
|
||||
|
||||
struct Ast_Return : Ast {
|
||||
Ast_Type *resolved_type;
|
||||
@@ -521,6 +526,7 @@ struct Ast_If : Ast {
|
||||
Array<Ast_If_Node *> ifs;
|
||||
};
|
||||
|
||||
// @todo: Ast_Simple_Stmt
|
||||
#define Ast_Pass Ast
|
||||
#define Ast_Break Ast
|
||||
|
||||
@@ -615,6 +621,7 @@ struct Ast_Decl : Ast {
|
||||
Intern_String name;
|
||||
Intern_String unique_name; // For code generation, currently only present on lambdas
|
||||
|
||||
// @todo: Move this to Ast_Operator_Overload
|
||||
uint64_t operator_overload_arguments_hash;
|
||||
Ast_Operator_Info *overload_op_info;
|
||||
|
||||
@@ -651,6 +658,10 @@ meta.inline_value_fields()
|
||||
/*END*/
|
||||
};
|
||||
|
||||
struct Ast_Label : Ast_Decl {
|
||||
bool enable_goto;
|
||||
};
|
||||
|
||||
enum Core_Message_Kind {
|
||||
CORE_ERROR,
|
||||
CORE_WARNING,
|
||||
|
||||
Reference in New Issue
Block a user