cfree :: (ptr: rawptr) do raw_free(context.allocator, ptr);
#if build_opts.Runtime != build_opts.Runtime_Custom {
- use package core.intrinsics.wasm { __initialize }
-
new :: ($T: type_expr, allocator := context.allocator, initialize := true) -> ^T {
res := cast(^T) raw_alloc(allocator, sizeof T);
// @Robustness: This should be a '#if' when those are added in procedures because
// otherwise the __initialize intrinsic is going to be generated no matter what.
// This could be a problem if the type is not something that can be initialized.
+ use package core.intrinsics.wasm { __initialize }
if initialize do __initialize(res);
return res;
enum { Foo, Bar, Baz };
enum { Foo; Bar; Baz };
-[ ] Using a package in the middle of a procedures removes all remaining statements in the procedure.
+[X] Using a package in the middle of a procedures removes all remaining statements in the procedure.
This is mostly likely due to the changes made with use package statements being treated as entities now.
use_package_breaking :: () {
}
ENTITY_SUBMIT(upack);
- return (AstNode *) upack;
+ return NULL;
} else {
AstUse* use_node = make_node(AstUse, Ast_Kind_Use);
switch ((u16) parser->curr->type) {
case Token_Type_Keyword_Use: {
AstNode* use_node = parse_use_stmt(parser);
- ENTITY_SUBMIT(use_node);
+ if (use_node) ENTITY_SUBMIT(use_node);
return;
}
}
#define SIMD_EXTRACT_LANE_INSTR(instr, arg_arr) \
- emit_expression(mod, &code, arg_arr[1]->value);\
+ emit_expression(mod, &code, arg_arr[0]->value);\
if (arg_arr[1]->value->kind != Ast_Kind_NumLit) { \
onyx_report_error(arg_arr[1]->token->pos, "SIMD lane instructions expect a compile time lane number."); \
*pcode = code; \
WID(instr, (u8) ((AstNumLit *) arg_arr[1]->value)->value.i);
#define SIMD_REPLACE_LANE_INSTR(instr, arg_arr) { \
- emit_expression(mod, &code, arg_arr[1]->value);\
- if (arg_arr[1]->value->kind != Ast_Kind_NumLit) { \
- onyx_report_error(arg_arr[1]->token->pos, "SIMD lane instructions expect a compile time lane number."); \
- *pcode = code; \
- return; \
- } \
- u8 lane = (u8) ((AstNumLit *) arg_arr[1]->value)->value.i; \
- emit_expression(mod, &code, arg_arr[2]->value); \
- WID(instr, lane); \
- }
+ emit_expression(mod, &code, arg_arr[0]->value);\
+ if (arg_arr[1]->value->kind != Ast_Kind_NumLit) { \
+ onyx_report_error(arg_arr[1]->token->pos, "SIMD lane instructions expect a compile time lane number."); \
+ *pcode = code; \
+ return; \
+ } \
+ u8 lane = (u8) ((AstNumLit *) arg_arr[1]->value)->value.i; \
+ emit_expression(mod, &code, arg_arr[2]->value); \
+ WID(instr, lane); \
+}
EMIT_FUNC(intrinsic_call, AstCall* call) {