allocator = bucket_allocator;
b.elements_per_bucket = elements;
- buckets = array.make(#type Bucket_Array.Bucket(T), allocator=array_allocator);
+ buckets = array.make(Bucket_Array.Bucket(T), allocator=array_allocator);
initial_bucket := alloc_bucket(b);
array.push(^buckets, initial_bucket);
elem_idx : i32;
}
- c := new(#type Context(T));
+ c := new(Context(T));
c.ba = b;
c.bucket_idx = 0;
c.elem_idx = 0;
predicate: (T) -> bool;
}
- filter_iterator := new(#type FilterIterator(T));
+ filter_iterator := new(FilterIterator(T));
filter_iterator.iterator = it;
filter_iterator.predicate = predicate;
transform: (T) -> R;
}
- map_iterator := new(#type MapIterator(T, R));
+ map_iterator := new(MapIterator(T, R));
map_iterator.iterator = it;
map_iterator.transform = transform;
remaining: u32;
}
- take_iterator := new(#type TakeIterator(T));
+ take_iterator := new(TakeIterator(T));
take_iterator.iterator = it;
take_iterator.remaining = count;
predicate: (T) -> bool;
}
- take_iterator := new(#type TakeIterator(T));
+ take_iterator := new(TakeIterator(T));
take_iterator.iterator = it;
take_iterator.predicate = predicate;
skipped: bool = false;
}
- skip_iterator := new(#type SkipIterator(T));
+ skip_iterator := new(SkipIterator(T));
skip_iterator.iterator = it;
skip_iterator.to_skip = count;
iterator2: Iterator(R);
}
- zipped_iterator := new(#type ZippedIterator(T, R));
+ zipped_iterator := new(ZippedIterator(T, R));
zipped_iterator.iterator1 = left_iterator;
zipped_iterator.iterator2 = right_iterator;
current_index: i32;
}
- ec := make(#type Enumeration_Context(T));
+ ec := make(Enumeration_Context(T));
ec.iterator = it;
ec.current_index = start_index;
current: u32;
}
- c := make(#type Context(T));
+ c := make(Context(T));
c.data = arr.data;
c.count = arr.count;
c.current = 0;
current: ^ListElem(T);
}
- list_iterator := new(#type ListIterator(T));
+ list_iterator := new(ListIterator(T));
list_iterator.current = list.first;
return .{
}
#local
-allocate_elem :: macro (list: ^List($T)) => new(#type ListElem(T), allocator=list.allocator);
+allocate_elem :: macro (list: ^List($T)) => new(ListElem(T), allocator=list.allocator);
position: i32;
}
- context := new(#type Context(T));
+ context := new(Context(T));
context.entry_array = set.entries;
context.position = 0;
hashes[lr.hash_index] = index;
}
}
-}
\ No newline at end of file
+}
bh_arr_each(AstTyped *, expr, ((AstCompound *) node)->exprs) {
resolve_expression_type(*expr);
}
+
+ node->type = type_build_compound_type(context.ast_alloc, (AstCompound *) node);
+ return node->type;
}
if (node->kind == Ast_Kind_Argument) {
return 0;
}
+ if (from_->id == to_->id) return 1;
+
if (from->kind == Type_Kind_Enum) from = from->Enum.backing;
if (to->kind == Type_Kind_Enum) to = to->Enum.backing;
// 8. If callee is an intrinsic, turn call into an Intrinsic_Call node
// 9. Check types of formal and actual params against each other, handling varargs
AstCall* call = *pcall;
-
+
+ {
+ AstNode* callee = strip_aliases((AstNode *) call->callee);
+ if (callee->kind == Ast_Kind_Poly_Struct_Type) {
+ // HACK HACK HACK
+ AstPolyCallType *pct = onyx_ast_node_new(context.ast_alloc, sizeof(AstPolyCallType), Ast_Kind_Poly_Call_Type);
+ pct->token = call->token;
+ pct->callee = (AstType *) callee;
+ pct->params = (AstNode **) call->args.values;
+ bh_arr_each(AstNode *, pp, pct->params) {
+ *pp = (AstNode *) (*(AstArgument **) pp)->value;
+ }
+
+ CHECK(type, (AstType *) pct);
+ *pcall = (AstCall *) pct;
+ return Check_Success;
+ }
+ }
+
if (call->flags & Ast_Flag_Has_Been_Checked) return Check_Success;
u32 current_checking_level_store = current_checking_level;
// stnode is filled out.
if (sl->stnode == NULL) return Check_Success;
+ CHECK(expression, &sl->stnode);
if (!node_is_type((AstNode *) sl->stnode)) {
ERROR(sl->token->pos, "Type used for struct literal is not a type.");
}
- fill_in_type((AstTyped *) sl);
+ sl->type = type_build_from_ast(context.ast_alloc, (AstType *) sl->stnode);
if (sl->type == NULL)
YIELD(sl->token->pos, "Trying to resolve type of struct literal.");
}
if (al->atnode == NULL) return Check_Success;
// YIELD(al->token->pos, "Waiting for array literal type to be known.");
+ CHECK(expression, &al->atnode);
if (!node_is_type((AstNode *) al->atnode))
ERROR(al->token->pos, "Array type is not a type.");
- fill_in_type((AstTyped *) al);
+ al->type = type_build_from_ast(context.ast_alloc, (AstType *) al->atnode);
if (al->type == NULL)
YIELD(al->token->pos, "Trying to resolve type of array literal.");
static SymresStatus symres_struct_literal(AstStructLiteral* sl) {
if (sl->stnode != NULL) SYMRES(expression, &sl->stnode);
- SYMRES(type, (AstType **) &sl->stnode);
sl->type_node = (AstType *) sl->stnode;
while (sl->type_node && sl->type_node->kind == Ast_Kind_Type_Alias)
static SymresStatus symres_array_literal(AstArrayLiteral* al) {
if (al->atnode != NULL) SYMRES(expression, &al->atnode);
- SYMRES(type, (AstType **) &al->atnode);
al->type_node = (AstType *) al->atnode;
while (al->type_node && al->type_node->kind == Ast_Kind_Type_Alias)
i64 expr_count = bh_arr_length(compound->exprs);
fori (i, 0, expr_count) {
if (compound->exprs[i]->type == NULL) return NULL;
+ if (compound->exprs[i]->type->kind == Type_Kind_Basic) {
+ if (compound->exprs[i]->type->Basic.kind == Basic_Kind_Int_Unsized || compound->exprs[i]->type->Basic.kind == Basic_Kind_Float_Unsized) {
+ return NULL;
+ }
+ }
}
Type* comp_type = type_create(Type_Kind_Compound, alloc, expr_count);