Skip to content

Commit d3da56b

Browse files
QuiiBzsaghul
authored andcommittedJun 7, 2024
Sync TLA implementation with upstream
Fixes: #339
1 parent a4e48a6 commit d3da56b

11 files changed

+3474
-2862
lines changed
 

‎doc/quickjs.texi

+11
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ optional properties:
330330
@item backtrace_barrier
331331
Boolean (default = false). If true, error backtraces do not list the
332332
stack frames below the evalScript.
333+
@item async
334+
Boolean (default = false). If true, @code{await} is accepted in the
335+
script and a promise is returned. The promise is resolved with an
336+
object whose @code{value} property holds the value returned by the
337+
script.
333338
@end table
334339

335340
@item loadScript(filename)
@@ -717,6 +722,12 @@ write_fd]} or null in case of error.
717722
@item sleep(delay_ms)
718723
Sleep during @code{delay_ms} milliseconds.
719724

725+
@item sleepAsync(delay_ms)
726+
Asynchronouse sleep during @code{delay_ms} milliseconds. Returns a promise. Example:
727+
@example
728+
await os.sleepAsync(500);
729+
@end example
730+
720731
@item setTimeout(func, delay)
721732
Call the function @code{func} after @code{delay} ms. Return a handle
722733
to the timer.

‎gen/hello_module.c

+48-48
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,53 @@
22

33
#include "quickjs-libc.h"
44

5-
const uint32_t qjsc_fib_module_size = 310;
5+
const uint32_t qjsc_fib_module_size = 311;
66

7-
const uint8_t qjsc_fib_module[310] = {
7+
const uint8_t qjsc_fib_module[311] = {
88
0x0c, 0x03, 0x2c, 0x65, 0x78, 0x61, 0x6d, 0x70,
99
0x6c, 0x65, 0x73, 0x2f, 0x66, 0x69, 0x62, 0x5f,
1010
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x6a,
1111
0x73, 0x06, 0x66, 0x69, 0x62, 0x02, 0x6e, 0x0d,
1212
0xb2, 0x03, 0x00, 0x01, 0x00, 0x00, 0xb4, 0x03,
13-
0x00, 0x00, 0x0c, 0x20, 0xfa, 0x01, 0x9e, 0x01,
14-
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x09, 0x00,
15-
0xb4, 0x03, 0x00, 0x01, 0x0c, 0x43, 0xfa, 0x01,
16-
0xb4, 0x03, 0x01, 0x00, 0x01, 0x04, 0x01, 0x00,
17-
0x1a, 0x01, 0xb6, 0x03, 0x00, 0x01, 0x00, 0xb4,
18-
0x03, 0x00, 0x00, 0xd0, 0xb3, 0xa7, 0xe9, 0x03,
19-
0xb3, 0x28, 0xd0, 0xb4, 0xac, 0xe9, 0x03, 0xb4,
20-
0x28, 0xdc, 0xd0, 0xb4, 0x9e, 0xee, 0xdc, 0xd0,
21-
0xb5, 0x9e, 0xee, 0x9d, 0x28, 0xb2, 0x03, 0x02,
22-
0x08, 0x20, 0x04, 0x00, 0x07, 0x06, 0x07, 0x06,
23-
0x12, 0x09, 0x08, 0x07, 0x07, 0x10, 0x07, 0x06,
24-
0x07, 0x06, 0x12, 0x13, 0x08, 0x07, 0x08, 0x16,
25-
0x0c, 0x0c, 0x07, 0x04, 0x0c, 0x0a, 0x0c, 0x0c,
26-
0x07, 0x04, 0x8d, 0x01, 0x66, 0x75, 0x6e, 0x63,
27-
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x69, 0x62,
28-
0x28, 0x6e, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20,
29-
0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x20,
30-
0x3c, 0x3d, 0x20, 0x30, 0x29, 0x0a, 0x20, 0x20,
13+
0x00, 0x00, 0x00, 0x0c, 0x20, 0xfa, 0x01, 0x9e,
14+
0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x09,
15+
0x00, 0xb4, 0x03, 0x00, 0x01, 0x0c, 0x43, 0xfa,
16+
0x01, 0xb4, 0x03, 0x01, 0x00, 0x01, 0x04, 0x01,
17+
0x00, 0x1a, 0x01, 0xb6, 0x03, 0x00, 0x01, 0x00,
18+
0xb4, 0x03, 0x00, 0x00, 0xd0, 0xb3, 0xa7, 0xe9,
19+
0x03, 0xb3, 0x28, 0xd0, 0xb4, 0xac, 0xe9, 0x03,
20+
0xb4, 0x28, 0xdc, 0xd0, 0xb4, 0x9e, 0xee, 0xdc,
21+
0xd0, 0xb5, 0x9e, 0xee, 0x9d, 0x28, 0xb2, 0x03,
22+
0x02, 0x08, 0x20, 0x04, 0x00, 0x07, 0x06, 0x07,
23+
0x06, 0x12, 0x09, 0x08, 0x07, 0x07, 0x10, 0x07,
24+
0x06, 0x07, 0x06, 0x12, 0x13, 0x08, 0x07, 0x08,
25+
0x16, 0x0c, 0x0c, 0x07, 0x04, 0x0c, 0x0a, 0x0c,
26+
0x0c, 0x07, 0x04, 0x8d, 0x01, 0x66, 0x75, 0x6e,
27+
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x69,
28+
0x62, 0x28, 0x6e, 0x29, 0x0a, 0x7b, 0x0a, 0x20,
29+
0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e,
30+
0x20, 0x3c, 0x3d, 0x20, 0x30, 0x29, 0x0a, 0x20,
31+
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72,
32+
0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x30, 0x3b,
33+
0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73,
34+
0x65, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x20,
35+
0x3d, 0x3d, 0x20, 0x31, 0x29, 0x0a, 0x20, 0x20,
3136
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
32-
0x74, 0x75, 0x72, 0x6e, 0x20, 0x30, 0x3b, 0x0a,
37+
0x74, 0x75, 0x72, 0x6e, 0x20, 0x31, 0x3b, 0x0a,
3338
0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65,
34-
0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x20, 0x3d,
35-
0x3d, 0x20, 0x31, 0x29, 0x0a, 0x20, 0x20, 0x20,
36-
0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74,
37-
0x75, 0x72, 0x6e, 0x20, 0x31, 0x3b, 0x0a, 0x20,
38-
0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a,
39-
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
40-
0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66,
41-
0x69, 0x62, 0x28, 0x6e, 0x20, 0x2d, 0x20, 0x31,
42-
0x29, 0x20, 0x2b, 0x20, 0x66, 0x69, 0x62, 0x28,
43-
0x6e, 0x20, 0x2d, 0x20, 0x32, 0x29, 0x3b, 0x0a,
44-
0x7d, 0x08, 0xe9, 0x05, 0xbe, 0x00, 0xe0, 0x29,
45-
0x06, 0x2e, 0xb2, 0x03, 0x01, 0x01, 0x06, 0x01,
46-
0x01, 0x00, 0x07, 0x14, 0x02, 0x00,
39+
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
40+
0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20,
41+
0x66, 0x69, 0x62, 0x28, 0x6e, 0x20, 0x2d, 0x20,
42+
0x31, 0x29, 0x20, 0x2b, 0x20, 0x66, 0x69, 0x62,
43+
0x28, 0x6e, 0x20, 0x2d, 0x20, 0x32, 0x29, 0x3b,
44+
0x0a, 0x7d, 0x08, 0xe9, 0x05, 0xbe, 0x00, 0xe0,
45+
0x29, 0x06, 0x2e, 0xb2, 0x03, 0x01, 0x01, 0x06,
46+
0x01, 0x01, 0x00, 0x07, 0x14, 0x02, 0x00,
4747
};
4848

49-
const uint32_t qjsc_hello_module_size = 177;
49+
const uint32_t qjsc_hello_module_size = 178;
5050

51-
const uint8_t qjsc_hello_module[177] = {
51+
const uint8_t qjsc_hello_module[178] = {
5252
0x0c, 0x07, 0x30, 0x65, 0x78, 0x61, 0x6d, 0x70,
5353
0x6c, 0x65, 0x73, 0x2f, 0x68, 0x65, 0x6c, 0x6c,
5454
0x6f, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
@@ -60,18 +60,18 @@ const uint8_t qjsc_hello_module[177] = {
6060
0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x10,
6161
0x66, 0x69, 0x62, 0x28, 0x31, 0x30, 0x29, 0x3d,
6262
0x0d, 0xb2, 0x03, 0x01, 0xb4, 0x03, 0x00, 0x00,
63-
0x01, 0x00, 0xb6, 0x03, 0x00, 0x0c, 0x20, 0xfa,
64-
0x01, 0x9e, 0x01, 0x00, 0x00, 0x00, 0x05, 0x01,
65-
0x00, 0x32, 0x00, 0xb6, 0x03, 0x00, 0x0c, 0x08,
66-
0xe9, 0x02, 0x29, 0x38, 0xdc, 0x00, 0x00, 0x00,
67-
0x42, 0xdd, 0x00, 0x00, 0x00, 0x04, 0xde, 0x00,
68-
0x00, 0x00, 0x24, 0x01, 0x00, 0x0e, 0x38, 0xdc,
69-
0x00, 0x00, 0x00, 0x42, 0xdd, 0x00, 0x00, 0x00,
70-
0x04, 0xdf, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00,
71-
0xbb, 0x0a, 0xee, 0x24, 0x02, 0x00, 0x0e, 0x06,
72-
0x2e, 0xb2, 0x03, 0x01, 0x01, 0x0a, 0x01, 0x01,
73-
0x00, 0x04, 0x0a, 0x02, 0x62, 0x00, 0x4d, 0x30,
74-
0x00,
63+
0x01, 0x00, 0xb6, 0x03, 0x00, 0x00, 0x0c, 0x20,
64+
0xfa, 0x01, 0x9e, 0x01, 0x00, 0x00, 0x00, 0x05,
65+
0x01, 0x00, 0x32, 0x00, 0xb6, 0x03, 0x00, 0x0c,
66+
0x08, 0xe9, 0x02, 0x29, 0x38, 0xdc, 0x00, 0x00,
67+
0x00, 0x42, 0xdd, 0x00, 0x00, 0x00, 0x04, 0xde,
68+
0x00, 0x00, 0x00, 0x24, 0x01, 0x00, 0x0e, 0x38,
69+
0xdc, 0x00, 0x00, 0x00, 0x42, 0xdd, 0x00, 0x00,
70+
0x00, 0x04, 0xdf, 0x00, 0x00, 0x00, 0x65, 0x00,
71+
0x00, 0xbb, 0x0a, 0xee, 0x24, 0x02, 0x00, 0x0e,
72+
0x06, 0x2e, 0xb2, 0x03, 0x01, 0x01, 0x0a, 0x01,
73+
0x01, 0x00, 0x04, 0x0a, 0x02, 0x62, 0x00, 0x4d,
74+
0x30, 0x00,
7575
};
7676

7777
static JSContext *JS_NewCustomContext(JSRuntime *rt)

0 commit comments

Comments
 (0)