result = true;
// Animate this?
- adjust_slider_value(value, mouse_state.x - x0, width, min_value, max_value, 0);
+ adjust_slider_value(value, mouse_state.x - x0, width, min_value, max_value);
} else {
set_active_item(0);
}
adjust_slider_value :: proc {
@Incomplete // the step parameter is ignored.
// Integers need to be
- (value: ^i32, x: f32, width: f32, min_value: i32, max_value: i32, step: i32) {
+ (value: ^i32, x: f32, width: f32, min_value: i32, max_value: i32) {
step_width := width / ~~math.abs(max_value - min_value);
percent := (x + step_width / 2) / width;
*value = math.lerp(percent, min_value, max_value);
},
@Incomplete // the step parameter is ignored.
- (value: ^$T, x: f32, width: f32, min_value: T, max_value: T, step: T) {
+ (value: ^$T, x: f32, width: f32, min_value: T, max_value: T) {
percent := x / width;
*value = math.lerp(percent, min_value, max_value);
*value = math.clamp(*value, min_value, max_value);
SymresStatus ss = symres_type(&member->type_node);
if (ss != Symres_Success) {
s_node->flags &= ~Ast_Flag_Type_Is_Resolved;
+ if (s_node->scope) scope_leave();
return ss;
}
case Ast_Kind_Poly_Struct_Type: {
AstPolyStructType* pst_node = (AstPolyStructType *) *type;
- pst_node->scope = scope_create(context.ast_alloc, curr_scope, pst_node->token->pos);
+ pst_node->scope = scope_create(context.ast_alloc, pst_node->entity->scope, pst_node->token->pos);
bh_arr_each(AstPolyStructParam, param, pst_node->poly_params) {
SYMRES(type, ¶m->type_node);
}
static SymresStatus symres_if(AstIfWhile* ifnode) {
- if (ifnode->assignment != NULL) {
- ifnode->scope = scope_create(context.ast_alloc, curr_scope, ifnode->token->pos);
- scope_enter(ifnode->scope);
-
- SYMRES(local, &ifnode->local);
-
- SYMRES(statement, (AstNode **) &ifnode->assignment, NULL);
- }
-
if (ifnode->kind == Ast_Kind_Static_If) {
if ((ifnode->flags & Ast_Flag_Static_If_Resolved) == 0) {
return Symres_Yield_Macro;
}
} else {
+ if (ifnode->assignment != NULL) {
+ ifnode->scope = scope_create(context.ast_alloc, curr_scope, ifnode->token->pos);
+ scope_enter(ifnode->scope);
+
+ SYMRES(local, &ifnode->local);
+
+ SYMRES(statement, (AstNode **) &ifnode->assignment, NULL);
+ }
+
SYMRES(expression, &ifnode->cond);
if (ifnode->true_stmt != NULL) SYMRES(statement, (AstNode **) &ifnode->true_stmt, NULL);
if (param->local->type == NULL) {
// HACK HACK HACK
+ scope_leave();
return Symres_Yield_Macro;
}
}
} else {
AstOverloadedFunction* ofunc = (AstOverloadedFunction *) add_overload->overloaded_function;
+ SYMRES(expression, (AstTyped **) &add_overload->overload);
bh_arr_push(ofunc->overloads, (AstTyped *) add_overload->overload);
}