mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-28 05:44:57 +00:00
Remove the need for type_of, size_of, align_of, offset_of to be keywords
This commit is contained in:
@@ -7769,23 +7769,6 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
||||
o->type = t_context;
|
||||
break;
|
||||
|
||||
case Token_size_of:
|
||||
o->mode = Addressing_Builtin;
|
||||
o->builtin_id = BuiltinProc_size_of;
|
||||
break;
|
||||
case Token_align_of:
|
||||
o->mode = Addressing_Builtin;
|
||||
o->builtin_id = BuiltinProc_align_of;
|
||||
break;
|
||||
case Token_offset_of:
|
||||
o->mode = Addressing_Builtin;
|
||||
o->builtin_id = BuiltinProc_offset_of;
|
||||
break;
|
||||
case Token_type_of:
|
||||
o->mode = Addressing_Builtin;
|
||||
o->builtin_id = BuiltinProc_type_of;
|
||||
break;
|
||||
|
||||
default:
|
||||
error(node, "Illegal implicit name '%.*s'", LIT(i->string));
|
||||
return kind;
|
||||
|
||||
@@ -1731,11 +1731,6 @@ Ast *parse_operand(AstFile *f, bool lhs) {
|
||||
case Token_Rune:
|
||||
return ast_basic_lit(f, advance_token(f));
|
||||
|
||||
case Token_size_of:
|
||||
case Token_align_of:
|
||||
case Token_offset_of:
|
||||
return parse_call_expr(f, ast_implicit(f, advance_token(f)));
|
||||
|
||||
case Token_String:
|
||||
return ast_basic_lit(f, advance_token(f));
|
||||
|
||||
@@ -2016,17 +2011,6 @@ Ast *parse_operand(AstFile *f, bool lhs) {
|
||||
return ast_typeid_type(f, token, nullptr);
|
||||
} break;
|
||||
|
||||
case Token_type_of: {
|
||||
Ast *i = ast_implicit(f, expect_token(f, Token_type_of));
|
||||
Ast *type = parse_call_expr(f, i);
|
||||
while (f->curr_token.kind == Token_Period) {
|
||||
Token token = advance_token(f);
|
||||
Ast *sel = parse_ident(f);
|
||||
type = ast_selector_expr(f, token, type, sel);
|
||||
}
|
||||
return type;
|
||||
} break;
|
||||
|
||||
case Token_Pointer: {
|
||||
Token token = expect_token(f, Token_Pointer);
|
||||
Ast *elem = parse_type(f);
|
||||
|
||||
@@ -117,10 +117,6 @@ TOKEN_KIND(Token__KeywordBegin, ""), \
|
||||
TOKEN_KIND(Token_inline, "inline"), \
|
||||
TOKEN_KIND(Token_no_inline, "no_inline"), \
|
||||
TOKEN_KIND(Token_context, "context"), \
|
||||
TOKEN_KIND(Token_size_of, "size_of"), \
|
||||
TOKEN_KIND(Token_align_of, "align_of"), \
|
||||
TOKEN_KIND(Token_offset_of, "offset_of"), \
|
||||
TOKEN_KIND(Token_type_of, "type_of"), \
|
||||
TOKEN_KIND(Token_macro, "macro"), \
|
||||
TOKEN_KIND(Token_const, "const"), \
|
||||
TOKEN_KIND(Token__KeywordEnd, ""), \
|
||||
|
||||
Reference in New Issue
Block a user