choice :: (a: [] $T) -> T {
return a[between(0, a.count - 1)];
-}
\ No newline at end of file
+}
+
+string :: (bytes_long: u32, alpha_numeric := false, allocator := context.allocator) -> str {
+ memory :: package core.memory
+
+ s := memory.make_slice(u8, bytes_long, allocator=allocator);
+ for^ s {
+ if alpha_numeric {
+ #persist alpha_numeral := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ *it = choice(alpha_numeral);
+ } else {
+ *it = ~~between(32, 127);
+ }
+ }
+ return s;
+}
if (ctb->original_value == *value) {
CHECK(expression, (AstTyped **) &ctb->comparison);
found = 1;
- break;
+ break;
}
}
if (found) break;
if (binop->operation == Binary_Op_Assign && binop->left->kind == Ast_Kind_Subscript && bh_arr_length(operator_overloads[Binary_Op_Subscript_Equals]) > 0) {
AstSubscript* sub = (AstSubscript *) binop->left;
-
+
if (binop->potential_substitute == NULL) {
u32 current_checking_level_store = current_checking_level;
CHECK(expression, &sub->addr);
}
}
}
-
+
if ((binop->left->flags & Ast_Flag_Comptime) && (binop->right->flags & Ast_Flag_Comptime)) {
binop->flags |= Ast_Flag_Comptime;
}
if (binop_is_assignment(binop->operation)) return check_binaryop_assignment(pbinop);
// NOTE: Comparision operators and boolean operators are handled separately.
- if (binop_is_compare(binop->operation))
+ if (binop_is_compare(binop->operation))
return check_binaryop_compare(pbinop);
if (binop->operation == Binary_Op_Bool_And || binop->operation == Binary_Op_Bool_Or)
return check_binaryop_bool(pbinop);
return Check_Success;
}
}
-
+
AstNode* n = try_symbol_raw_resolve_from_type(field->expr->type, field->field);
AstType* type_node = field->expr->type->ast_type;
bh_arr_each(AstType *, type, ctype->types) CHECK(type, type);
break;
}
-
+
case Ast_Kind_Array_Type: {
AstArrayType* atype = (AstArrayType *) type;
if (atype->count_expr) {
return Check_Error;
} else {
- // If no error are suppose to be produced, we still need to signal that
+ // If no error are suppose to be produced, we still need to signal that
// the node reached a completed state.
return Check_Failed;
}
if (header_check == Check_Return_To_Symres) return Check_Return_To_Symres;
b32 solved_something = 0;
- i32 solved_count = 0;
+ i32 solved_count = 0;
char *err_msg = NULL;
bh_arr_each(AstPolyParam, param, query->proc->poly_params) {
AstPolySolution sln;
cs = check_type(&ent->type_alias);
break;
- case Entity_Type_File_Contents:
+ case Entity_Type_File_Contents:
if (context.options->no_file_contents) {
onyx_report_error(ent->expr->token->pos, Error_Critical, "#file_contents is disabled for this compilation.");
}