#!/bin/sh
+echo "Installing core libs"
+CORE_DIR='/usr/share/onyx'
+sudo mkdir -p "$CORE_DIR"
+sudo cp -r ./core/ "$CORE_DIR"
+
+[ "$1" = "libs_only" ] && exit 0
+
C_FILES="onyx onyxastnodes onyxbuiltins onyxchecker onyxclone onyxdoc onyxentities onyxerrors onyxlex onyxparser onyxsymres onyxtypes onyxutils onyxwasm"
TARGET='./bin/onyx'
CC='gcc'
BIN_DIR='/usr/bin'
sudo cp ./bin/onyx "$BIN_DIR/onyx"
-echo "Installing core libs"
-CORE_DIR='/usr/share/onyx'
-sudo mkdir -p "$CORE_DIR"
-sudo cp -r ./core/ "$CORE_DIR"
-
# Otherwise the prompt ends on the same line
-printf "\n"
\ No newline at end of file
+printf "\n"
use package core.intrinsics.wasm { __initialize }
new :: ($T: type_expr, allocator := context.allocator, initialize := true) -> ^T {
- res := cast(^T) calloc(sizeof 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.
return default_value;
}
+get_ptr :: (use map: ^Map($K, $V), key: K) -> ^V {
+ lr := lookup(map, key);
+ if lr.entry_index >= 0 do return ^entries[lr.entry_index].value;
+
+ return null;
+}
+
delete :: (use map: ^Map($K, $V), key: K) {
lr := lookup(map, key);
if lr.entry_index < 0 do return;