Package is Decl
This commit is contained in:
13
ast.cpp
13
ast.cpp
@@ -221,9 +221,7 @@ struct Ast_File{
|
||||
Array<Ast_Decl *> decls;
|
||||
};
|
||||
|
||||
struct Ast_Package : Ast_Scope{
|
||||
Intern_String name;
|
||||
};
|
||||
struct Ast_Package : Ast_Decl{};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// AST Constructors beginning with expressions
|
||||
@@ -475,11 +473,18 @@ ast_type(Token *pos, Intern_String name, Ast_Type *type){
|
||||
return result;
|
||||
}
|
||||
|
||||
function Ast_Scope *
|
||||
ast_decl_scope(Token *pos, Allocator *allocator){
|
||||
AST_NEW(Scope, SCOPE, pos, AST_DECL);
|
||||
result->decls = {allocator};
|
||||
return result;
|
||||
}
|
||||
|
||||
function Ast_Package *
|
||||
ast_package(Token *pos, Allocator *allocator, Intern_String name){
|
||||
AST_NEW(Package, PACKAGE, pos, 0);
|
||||
result->kind = AST_PACKAGE;
|
||||
result->decls = {allocator};
|
||||
result->scope = ast_decl_scope(pos, allocator);
|
||||
result->name = name;
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user