Skip to content

Commit ce248ca

Browse files
committed
fix: Arrow method should require ;
1 parent af4f57d commit ce248ca

4 files changed

Lines changed: 29 additions & 11 deletions

File tree

src/Debugger.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,12 @@ pub fn configurationDone(self: *Debugger, _: Arguments(.configurationDone)) Erro
874874
if (self.session == null) return error.SessionNotStarted;
875875
}
876876

877+
pub fn terminate(self: *Debugger, _: Arguments(.terminate)) Error!Response(.terminate) {
878+
if (self.session) |*session| {
879+
session.setState(.terminated);
880+
}
881+
}
882+
877883
pub fn disconnect(self: *Debugger, _: Arguments(.disconnect)) Error!Response(.disconnect) {
878884
if (self.session) |*session| {
879885
session.setState(.terminated);

src/Parser.zig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7827,7 +7827,7 @@ fn objectDeclaration(self: *Self) Error!Ast.Node.Index {
78277827
fn method(self: *Self, abstract: bool, static: bool, this: *obj.ObjTypeDef) Error!Ast.Node.Index {
78287828
try self.consume(.Identifier, "Expected method name.");
78297829

7830-
return try self.function(
7830+
const func = try self.function(
78317831
self.current_token.? - 1,
78327832
if (abstract)
78337833
.Abstract
@@ -7837,6 +7837,12 @@ fn method(self: *Self, abstract: bool, static: bool, this: *obj.ObjTypeDef) Erro
78377837
.Method,
78387838
this,
78397839
);
7840+
7841+
if (self.ast.nodes.items(.type_def)[func].?.resolved_type.?.Function.lambda) {
7842+
try self.consume(.Semicolon, "Expected `;`.");
7843+
}
7844+
7845+
return func;
78407846
}
78417847

78427848
fn protocolDeclaration(self: *Self) Error!Ast.Node.Index {

src/behavior.zig

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const std = @import("std");
22
const Runner = @import("Runner.zig");
33
const io = @import("io.zig");
44
const Parser = @import("Parser.zig");
5+
const BuildOptions = @import("build_options");
56

67
// Because of https://github.com/ziglang/zig/issues/15091 test that write to stdout will hang
78
// However I think its completely legitimate for a tested code to output to stdout and I
@@ -162,10 +163,15 @@ fn testCompileErrors(allocator: std.mem.Allocator) !Result {
162163
}
163164

164165
pub fn main() !u8 {
165-
var gpa = std.heap.GeneralPurposeAllocator(.{
166-
.safety = true,
167-
}){};
168-
const allocator = gpa.allocator();
166+
// DebugAllocator recently got super slow, will put this back on once its fixed
167+
// var gpa = std.heap.DebugAllocator(.{ .safety = builtin.mode == .Debug }){};
168+
// const allocator = if (builtin.mode == .Debug or is_wasm)
169+
// gpa.allocator()
170+
// else
171+
const allocator = if (BuildOptions.mimalloc)
172+
@import("mimalloc.zig").mim_allocator
173+
else
174+
std.heap.c_allocator;
169175
var count: usize = 0;
170176
var fail_count: usize = 0;
171177
var skipped: usize = 0;

src/lib/serialize.buzz

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ export object Boxed {
6464
}
6565

6666
/// @return wrapped data string value or empty string if not a string
67-
fun stringValue() > str => this.string() ?? ""
67+
fun stringValue() > str => this.string() ?? "";
6868
/// @return wrapped data boolean value or `false` if not a boolean
69-
fun booleanValue() > bool => this.boolean() ?? false
69+
fun booleanValue() > bool => this.boolean() ?? false;
7070
/// @return wrapped data number value or `0` if not an integer
71-
fun integerValue() > int => this.integer() ?? 0
71+
fun integerValue() > int => this.integer() ?? 0;
7272
/// @return wrapped data number value or `0` if not a double
73-
fun floatValue() > double => this.float() ?? 0.0
73+
fun floatValue() > double => this.float() ?? 0.0;
7474
/// @return wrapped data map value or empty map if not a map
75-
fun mapValue() > {str: Boxed} => this.map() ?? {<str: Boxed>}
75+
fun mapValue() > {str: Boxed} => this.map() ?? {<str: Boxed>};
7676
/// @return wrapped data list value or empty list if not a list
77-
fun listValue() > [Boxed] => this.list() ?? [<Boxed>]
77+
fun listValue() > [Boxed] => this.list() ?? [<Boxed>];
7878

7979
/// Query the json element at `path`, if nothing matches return `Boxed{}`
8080
/// @param path Path to query

0 commit comments

Comments
 (0)