Declaration grouping uses braces rather than parentheses

This commit is contained in:
Ginger Bill
2017-06-13 15:04:23 +01:00
parent 6b464e3558
commit 6a88dc322a
27 changed files with 184 additions and 200 deletions

View File

@@ -349,7 +349,6 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
}
e->Procedure.is_foreign = true;
e->Procedure.foreign_name = name;
e->Procedure.link_name = name;
HashKey key = hash_string(name);

View File

@@ -1545,11 +1545,6 @@ Entity *check_ident(Checker *c, Operand *o, AstNode *n, Type *named_type, Type *
}
break;
case Entity_TypeAlias:
case Entity_TypeName:
o->mode = Addressing_Type;
break;
case Entity_Procedure:
o->mode = Addressing_Value;
break;
@@ -3530,7 +3525,6 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
operand->mode = Addressing_Value;
}
break;
case Entity_TypeAlias:
case Entity_TypeName:
operand->mode = Addressing_Type;
break;

View File

@@ -609,10 +609,6 @@ void add_global_string_constant(gbAllocator a, String name, String value) {
}
Type *add_global_type_alias(gbAllocator a, String name, Type *t) {
Entity *e = add_global_entity(make_entity_type_alias(a, NULL, make_token_ident(name), t));
return e->type;
}
void init_universal_scope(void) {

View File

@@ -14,8 +14,6 @@ struct DeclInfo;
ENTITY_KIND(Builtin) \
ENTITY_KIND(ImportName) \
ENTITY_KIND(LibraryName) \
ENTITY_KIND(TypeAlias) \
ENTITY_KIND(ProcedureAlias) \
ENTITY_KIND(Nil) \
ENTITY_KIND(Label)
@@ -92,13 +90,12 @@ struct Entity {
bool is_type_alias;
} TypeName;
struct {
bool is_foreign;
String foreign_name;
Entity * foreign_library;
AstNode * foreign_library_ident;
OverloadKind overload_kind;
String link_name;
u64 tags;
OverloadKind overload_kind;
bool is_foreign;
Entity * foreign_library;
AstNode * foreign_library_ident;
} Procedure;
struct {
i32 id;
@@ -114,10 +111,6 @@ struct Entity {
String name;
bool used;
} LibraryName;
i32 TypeAlias;
struct {
Entity *original;
} ProcedureAlias;
i32 Nil;
struct {
String name;
@@ -248,16 +241,6 @@ Entity *make_entity_library_name(gbAllocator a, Scope *scope, Token token, Type
return entity;
}
Entity *make_entity_type_alias(gbAllocator a, Scope *scope, Token token, Type *type) {
Entity *entity = alloc_entity(a, Entity_TypeAlias, scope, token, type);
return entity;
}
Entity *make_entity_procedure_alias(gbAllocator a, Scope *scope, Token token, Entity *original) {
GB_ASSERT(original != NULL);
Entity *entity = alloc_entity(a, Entity_ProcedureAlias, scope, token, original->type);
entity->ProcedureAlias.original = original;
return entity;
}

View File

@@ -2553,16 +2553,16 @@ AstNode *parse_gen_decl(AstFile *f, Token token, ParseSpecFunc *func) {
Token open = {};
Token close = {};
if (f->curr_token.kind == Token_OpenParen) {
if (f->curr_token.kind == Token_OpenBrace) {
specs = make_ast_node_array(f);
open = expect_token(f, Token_OpenParen);
while (f->curr_token.kind != Token_CloseParen &&
open = expect_token(f, Token_OpenBrace);
while (f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
AstNode *spec = func(f, token);
array_add(&specs, spec);
expect_semicolon(f, spec);
}
close = expect_token(f, Token_CloseParen);
close = expect_token(f, Token_CloseBrace);
if (f->curr_token.pos.line == close.pos.line ||
open.pos.line == close.pos.line) {
expect_semicolon(f, NULL);