c := ^buf[buf.count - 1];
len := 0;
- @Bug // Make this work with '::';
BASE64_MAP := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
while n > 0 {
if state.transform_transition > 0.0f {
move_towards(^state.transform_transition, 0, 0.08f);
- use state;
-
- if transform_transition == 0.0f {
- transform.translation.x = target_transform.translation.x;
- transform.translation.y = target_transform.translation.y;
+ if state.transform_transition == 0.0f {
+ state.transform.translation.x = state.target_transform.translation.x;
+ state.transform.translation.y = state.target_transform.translation.y;
} else {
- transform.translation.x = (transform.translation.x + target_transform.translation.x) / 2;
- transform.translation.y = (transform.translation.y + target_transform.translation.y) / 2;
+ state.transform.translation.x = (state.transform.translation.x + state.target_transform.translation.x) / 2;
+ state.transform.translation.y = (state.transform.translation.y + state.target_transform.translation.y) / 2;
}
}
// cycle detection algorithm must be used.
//
static Entity* watermarked_node = NULL;
+ static u32 highest_watermark = 0;
if (!changed) {
if (!watermarked_node) {
watermarked_node = ent;
+ highest_watermark = bh_max(highest_watermark, ent->macro_attempts);
}
else if (watermarked_node == ent) {
- entity_heap_insert_existing(&context.entities, ent);
- dump_cycles();
+ if (ent->macro_attempts > highest_watermark) {
+ entity_heap_insert_existing(&context.entities, ent);
+ dump_cycles();
+ }
}
else if (watermarked_node->macro_attempts < ent->macro_attempts) {
watermarked_node = ent;
+ highest_watermark = bh_max(highest_watermark, ent->macro_attempts);
}
} else {
watermarked_node = NULL;
// if (node_is_type((AstNode *) node)) return 0;
if (node->kind == Ast_Kind_Struct_Literal && node->type_node == NULL) {
+ if (node->entity != NULL) return 1;
if (type->kind == Type_Kind_VarArgs) type = type->VarArgs.ptr_to_data->Pointer.elem;
if (!type_is_sl_constructable(type)) return 0;
}
if (node->kind == Ast_Kind_Array_Literal && node->type_node == NULL) {
+ if (node->entity != NULL) return 1;
node->type = type;
node->flags |= Ast_Flag_Array_Literal_Typed;
CheckStatus check_binaryop(AstBinaryOp** pbinop) {
AstBinaryOp* binop = *pbinop;
+ if (binop->flags & Ast_Flag_Has_Been_Checked) return Check_Success;
+
u32 current_checking_level_store = current_checking_level;
CHECK(expression, &binop->left);
CHECK(expression, &binop->right);
binop->type = &basic_types[Basic_Kind_Bool];
}
+ binop->flags |= Ast_Flag_Has_Been_Checked;
+
if (binop->flags & Ast_Flag_Comptime) {
// NOTE: Not a binary op
*pbinop = (AstBinaryOp *) ast_reduce(context.ast_alloc, (AstTyped *) binop);
CheckStatus check_struct(AstStructType* s_node) {
if (s_node->entity_defaults && s_node->entity_defaults->state < Entity_State_Check_Types)
- YIELD(s_node->token->pos, "Waiting for struct member definitions to pass symbol resolution.");
+ YIELD(s_node->token->pos, "Waiting for struct member defaults to pass symbol resolution.");
bh_arr_each(AstStructMember *, smem, s_node->members) {
if ((*smem)->type_node != NULL) {
}
CheckStatus check_function_header(AstFunction* func) {
- if (func->entity_body && func->entity_body->state < Entity_State_Check_Types)
- YIELD(func->token->pos, "Waiting for function header to complete symbol resolution");
+ //if (func->entity_body && func->entity_body->state < Entity_State_Check_Types)
+ // YIELD(func->token->pos, "Waiting for function body to complete symbol resolution to check header.");
b32 expect_default_param = 0;
b32 has_had_varargs = 0;
}
else if (parse_possible_directive(parser, "type")) {
AstTypeAlias* alias = make_node(AstTypeAlias, Ast_Kind_Type_Alias);
+ alias->token = parser->curr - 2;
alias->to = parse_type(parser);
retval = (AstTyped *) alias;
break;
static SymresStatus symres_directive_defined(AstDirectiveDefined** pdefined) {
AstDirectiveDefined* defined = *pdefined;
+ b32 use_package_count = (context.entities.type_count[Entity_Type_Use_Package] == 0);
b32 old_report_unresolved_symbols = report_unresolved_symbols;
report_unresolved_symbols = 0;
SymresStatus ss = symres_expression(&defined->expr);
- if (old_report_unresolved_symbols && ss != Symres_Success) {
+ if ((use_package_count || old_report_unresolved_symbols) && ss != Symres_Success) {
// The symbol definitely was not found and there is no chance that it could be found.
defined->is_defined = 0;
// CLEANUP: I hate that this is here. The type inference for a struct member should happen once the actual type is known.
// There seems to be a problem with setting it in the checker however, because whenever I disable this code, somehow
// the compiler gets to the code generation without all the types figured out???
- if ((*smem)->type_node == NULL && (*smem)->initial_value->type_node != NULL) {
- (*smem)->type_node = (*smem)->initial_value->type_node;
- }
+ // if ((*smem)->type_node == NULL && (*smem)->initial_value->type_node != NULL) {
+ // (*smem)->type_node = (*smem)->initial_value->type_node;
+ // }
}
}
scope_enter(ent->scope);
}
- report_unresolved_symbols = (context.entities.type_count[Entity_Type_Static_If] == 0 &&
- context.entities.type_count[Entity_Type_Use_Package] == 0)
- || context.cycle_detected;
+ report_unresolved_symbols = context.cycle_detected;
+ //(context.entities.type_count[Entity_Type_Static_If] == 0 &&
+ // context.entities.type_count[Entity_Type_Use_Package] == 0)
+ //|| context.cycle_detected;
SymresStatus ss = Symres_Success;
EntityState next_state = Entity_State_Check_Types;