// CLEANUP: Should builtin.onyx really be including other files in the compilation?
// Does that complicate things too much?
#load "core/runtime/build_opts"
-#local runtime :: package runtime
str :: #type []u8;
cstr :: #type ^u8;
},
(arr: [] $T, allocator := context.allocator) -> [] T {
- new_arr := make([] T, arr.count);
+ new_arr := builtin.make([] T, arr.count);
for i: 0 .. arr.count do new_arr.data[i] = arr.data[i];
return new_arr;
}
return map;
}
-#match (package builtin).__make_overload macro (x: ^Map($K, $V), allocator := context.allocator) => (package core.map).make(K, V);
+#match __make_overload macro (x: ^Map($K, $V), allocator := context.allocator) => core.map.make(K, V);
init :: (use map: ^Map($K, $V), default := V.{}) {
__initialize(map);
allocator = context.allocator;
default_value = default;
- hashes = make([] u32, 8, allocator=allocator);
+ hashes = builtin.make([] u32, 8, allocator=allocator);
array.fill(hashes, -1);
array.init(^entries, allocator=allocator);
rehash :: (use map: ^Map, new_size: i32) {
memory.free_slice(^hashes, allocator);
- hashes = make([] u32, new_size, allocator=allocator);
+ hashes = builtin.make([] u32, new_size, allocator=allocator);
array.fill(hashes, -1);
for ^entry: entries do entry.next = -1;
rehash :: (use set: ^Set, new_size: i32) {
memory.free_slice(^hashes, allocator);
- hashes = make([] u32, new_size, allocator=allocator);
+ hashes = builtin.make([] u32, new_size, allocator=allocator);
array.fill(hashes, -1);
for ^entry: entries do entry.next = -1;
# strings in YAML. When using single quoted strings, only single quotes
# need to be escaped: this is done by using two single quotes next to each
# other.
- - match: '\b(package|struct|interface|use|where|global|enum|if|elseif|else|for|while|do|break|continue|fallthrough|return|as|cast|sizeof|alignof|typeof|defer|switch|case|macro)\b'
+ - match: '\b(package|struct|interface|use|where|global|enum|if|elseif|else|for|while|do|break|continue|fallthrough|return|cast|sizeof|alignof|typeof|defer|switch|case|macro)\b'
scope: keyword.control.onyx
- match: '\b(bool|void|i8|u8|i16|u16|i32|u32|i64|u64|f32|f64|rawptr|str|cstr|range|type_expr|any)\b'
syn keyword onyxKeyword for while do
syn keyword onyxKeyword switch case
syn keyword onyxKeyword break continue return defer fallthrough
-syn keyword onyxKeyword as cast sizeof alignof typeof
+syn keyword onyxKeyword cast sizeof alignof typeof
syn keyword onyxType bool void
syn keyword onyxType i8 u8
syn keyword onyxType i16 u16
this.running_process.stdout.on("data", (chunk) => {
this.sendEvent(new debugadapter_1.OutputEvent(chunk, "console"));
});
- this.attachRequest(response, { "socketPath": "/tmp/ovm-debug.0000", "stopOnEntry": true });
+ this.attachRequest(response, { "socketPath": "/tmp/ovm-debug.0000", "stopOnEntry": args.stopOnEntry });
}
attachRequest(response, args, request) {
return __awaiter(this, void 0, void 0, function* () {
this.sendEvent(new OutputEvent(chunk, "console"));
});
- this.attachRequest(response, {"socketPath": "/tmp/ovm-debug.0000", "stopOnEntry": true});
+ this.attachRequest(response, {"socketPath": "/tmp/ovm-debug.0000", "stopOnEntry": args.stopOnEntry});
}
protected async attachRequest(response: DebugProtocol.AttachResponse, args: IOVMAttachRequestArguments, request?: DebugProtocol.Request): Promise<void> {
parser->file_scope = scope_create(parser->allocator, parser->package->private_scope, parser->tokenizer->tokens[0].pos);
parser->current_scope = parser->file_scope;
- AstUse* implicit_use_builtin = make_node(AstUse, Ast_Kind_Use);
- AstPackage* implicit_builtin_package = make_node(AstPackage, Ast_Kind_Package);
- implicit_builtin_package->package_name = "builtin";
- implicit_use_builtin->expr = (AstTyped *) implicit_builtin_package;
- ENTITY_SUBMIT(implicit_use_builtin);
-
parse_top_level_statements_until(parser, Token_Type_End_Stream);
parser->current_scope = parser->current_scope->parent;
pac_name[strlen(package_name)] = '\0';
package->name = pac_name;
- package->scope = scope_create(alloc, parent_scope, (OnyxFilePos) { 0 });
- package->private_scope = scope_create(alloc, package->scope, (OnyxFilePos) { 0 });
package->use_package_entities = NULL;
+ if (!strcmp(pac_name, "builtin")) {
+ package->private_scope = scope_create(alloc, context.global_scope, pos);
+ package->scope = context.global_scope;
+ } else {
+ package->scope = scope_create(alloc, parent_scope, pos);
+ package->private_scope = scope_create(alloc, package->scope, pos);
+ }
+
shput(context.packages, pac_name, package);
if (!charset_contains(pac_name, '.')) {