| 6 | & | ^ << >> >>> |
| 5 | <= < >= > |
| 4 | == != |
- | 3 | && || ^^ |
+ | 3 | && || |
| 2 | |> .. |
| 1 | = += -= *= /= %= &= |= ^= <<= >>= >>>= |
+---+-------------------------------------------+
&& Logical AND
|| Logical OR
- ^^ Logical XOR
All logical operators are of equal precedence. && and || are standard operators in many C-style languages.
- ^^ is a boolean XOR operation and is not found in any of the languages I know about, but I don't see a reason
- not to have it. There are a few places in the compiler that could utilize the ^^ operator.
expect_token(parser, Token_Type_Symbol);
} else {
- AstNode* sym_node = make_node(AstNode, Ast_Kind_Symbol);
- sym_node->token = expect_token(parser, Token_Type_Symbol);
- func_def->overloaded_function = sym_node;
+ func_def->overloaded_function = (AstNode *) parse_expression(parser);
}
}
if (use->expr->type_node == NULL) goto cannot_use;
- if (use->expr->type_node->kind == Ast_Kind_Struct_Type ||
- use->expr->type_node->kind == Ast_Kind_Poly_Call_Type) {
+ AstType* effective_type = use->expr->type_node;
+ if (effective_type->kind == Ast_Kind_Pointer_Type)
+ effective_type = ((AstPointerType *) effective_type)->elem;
+
+ if (effective_type->kind == Ast_Kind_Struct_Type ||
+ effective_type->kind == Ast_Kind_Poly_Call_Type) {
if (use->expr->type == NULL)
use->expr->type = type_build_from_ast(semstate.node_allocator, use->expr->type_node);
if (use->expr->type == NULL) goto cannot_use;
Type* st = use->expr->type;
+ if (st->kind == Type_Kind_Pointer)
+ st = st->Pointer.elem;
+
bh_arr_each(StructMember *, smem, st->Struct.memarr) {
AstFieldAccess* fa = make_field_access(use->expr, (*smem)->name);
symbol_raw_introduce(semstate.curr_scope, (*smem)->name, use->token->pos, (AstNode *) fa);