From 0a03dbd722d06a584246de3b94f9856a98251bc6 Mon Sep 17 00:00:00 2001 From: HallofFamer Date: Sun, 28 Jul 2024 15:02:18 -0400 Subject: [PATCH] Minor update to standard library files, bump version from 1.8.0 to 1.9.0 in clox.ini and vcpkg.json files. --- clox.ini | 2 +- src/std/io.c | 1 - src/std/net.c | 1 + src/std/util.c | 2 +- vcpkg.json | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clox.ini b/clox.ini index b5d7238d..66fe984e 100644 --- a/clox.ini +++ b/clox.ini @@ -1,7 +1,7 @@ ; ini file for configuration of clox virtual machine and environment variables [basic] ; Basic configuration -version = 1.8.0 ; CLox version(do not change this) +version = 1.9.0 ; CLox version(do not change this) script = ; default script file path = ; default script path timezone = America/New_York ; default timezone diff --git a/src/std/io.c b/src/std/io.c index c6a83720..0300026b 100644 --- a/src/std/io.c +++ b/src/std/io.c @@ -38,7 +38,6 @@ LOX_METHOD(BinaryReadStream, readAsync) { ObjFile* file = getFileProperty(vm, AS_INSTANCE(receiver), "file"); if (!file->isOpen) RETURN_PROMISE_EX(clox.std.io.IOException, "Cannot read the next byte because file is already closed."); loadFileRead(vm, file); - ObjPromise* promise = fileReadAsync(vm, file, fileOnReadByte); if (promise == NULL) RETURN_PROMISE_EX(clox.std.io.IOException, "Failed to read byte from IO stream."); RETURN_OBJ(promise); diff --git a/src/std/net.c b/src/std/net.c index 9a6e6e6c..e1f809b9 100644 --- a/src/std/net.c +++ b/src/std/net.c @@ -383,6 +383,7 @@ LOX_METHOD(HTTPClient, sendAsync) { ASSERT_ARG_INSTANCE_OF("HTTPClient::send(request)", 0, clox.std.net.HTTPRequest); ObjInstance* self = AS_INSTANCE(receiver); ObjInstance* request = AS_INSTANCE(args[0]); + ObjString* url = AS_STRING(getObjProperty(vm, request, "url")); HTTPMethod method = (HTTPMethod)AS_INT(getObjProperty(vm, request, "method")); ObjDictionary* headers = AS_DICTIONARY(getObjProperty(vm, request, "headers")); diff --git a/src/std/util.c b/src/std/util.c index b3d2e3a5..462306ab 100644 --- a/src/std/util.c +++ b/src/std/util.c @@ -434,9 +434,9 @@ LOX_METHOD(DurationClass, ofMinutes) { ASSERT_ARG_TYPE("Duration class::ofMinutes(minutes)", 0, Int); int minutes = AS_INT(args[0]); if (minutes < 0) THROW_EXCEPTION_FMT(clox.std.lang.IllegalArgumentException, "method Duration class::ofMinutes(minutes) expects argument 1 to be a non negative integer but got %d.", minutes); - ObjClass* self = AS_CLASS(receiver); ObjInstance* instance = newInstance(vm, self); + push(vm, OBJ_VAL(instance)); int duration[4] = { 0, 0, minutes, 0 }; durationObjInit(vm, duration, instance); diff --git a/vcpkg.json b/vcpkg.json index 3b73bd2a..a3152ace 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "clox", - "version": "1.8.0", + "version": "1.9.0", "dependencies": [ "curl", "libuv" ]