Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: adapt to new TLA changes #540

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,318 changes: 2,659 additions & 2,659 deletions src/bundles/c/core/core.c

Large diffs are not rendered by default.

48,018 changes: 24,009 additions & 24,009 deletions src/bundles/c/core/polyfills.c

Large diffs are not rendered by default.

4,444 changes: 2,172 additions & 2,272 deletions src/bundles/c/core/run-main.c

Large diffs are not rendered by default.

656 changes: 328 additions & 328 deletions src/bundles/c/stdlib/assert.c

Large diffs are not rendered by default.

2,954 changes: 1,477 additions & 1,477 deletions src/bundles/c/stdlib/ffi.c

Large diffs are not rendered by default.

626 changes: 313 additions & 313 deletions src/bundles/c/stdlib/getopts.c

Large diffs are not rendered by default.

12,352 changes: 6,176 additions & 6,176 deletions src/bundles/c/stdlib/hashing.c

Large diffs are not rendered by default.

2,642 changes: 1,321 additions & 1,321 deletions src/bundles/c/stdlib/ipaddr.c

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/bundles/c/stdlib/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

#include <inttypes.h>

const uint32_t tjs__path_size = 105;
const uint32_t tjs__path_size = 106;

const uint8_t tjs__path[105] = {
const uint8_t tjs__path[106] = {
0x0c, 0x04, 0x10, 0x74, 0x6a, 0x73, 0x3a, 0x70,
0x61, 0x74, 0x68, 0x02, 0x6c, 0x02, 0x6f, 0x32,
0x74, 0x6a, 0x73, 0x2e, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x73, 0x2e, 0x70, 0x61, 0x74,
0x68, 0x0d, 0xb2, 0x03, 0x00, 0x01, 0x00, 0x01,
0x2c, 0x00, 0x00, 0x0c, 0x20, 0x02, 0x01, 0x9e,
0x01, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x20,
0x00, 0xb4, 0x03, 0x00, 0x01, 0xb6, 0x03, 0x01,
0x01, 0x08, 0xe9, 0x02, 0x29, 0x38, 0x8a, 0x00,
0x00, 0x00, 0x38, 0x96, 0x00, 0x00, 0x00, 0x42,
0x11, 0x00, 0x00, 0x00, 0x04, 0xdc, 0x00, 0x00,
0x00, 0x24, 0x01, 0x00, 0x47, 0xe4, 0xe1, 0x06,
0x2e,
0x2c, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x02, 0x01,
0x9e, 0x01, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00,
0x20, 0x00, 0xb4, 0x03, 0x00, 0x01, 0xb6, 0x03,
0x01, 0x01, 0x08, 0xe9, 0x02, 0x29, 0x38, 0x8a,
0x00, 0x00, 0x00, 0x38, 0x96, 0x00, 0x00, 0x00,
0x42, 0x11, 0x00, 0x00, 0x00, 0x04, 0xdc, 0x00,
0x00, 0x00, 0x24, 0x01, 0x00, 0x47, 0xe4, 0xe1,
0x06, 0x2e,
};

500 changes: 250 additions & 250 deletions src/bundles/c/stdlib/sqlite.c

Large diffs are not rendered by default.

2,180 changes: 1,090 additions & 1,090 deletions src/bundles/c/stdlib/uuid.c

Large diffs are not rendered by default.

46 changes: 15 additions & 31 deletions src/js/run-main/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,42 +1129,31 @@ function _run(g) {
'\\q exit\n');
}

function preprocessEval(input) {
const awaitMatcher = /^(?:\s*(?:(?:let|var|const)\s)?\s*([^=]+)=\s*|^\s*)(await\s[\s\S]*)/;
const asyncWrapper = (code, binder) => {
let assign = binder ? `global.${binder} = ` : '';
return `(function(){ async function _wrap() { return ${assign}${code} } return _wrap();})()`;
};

// match & transform
const match = input.match(awaitMatcher);
if (match) {
input = `${asyncWrapper(match[2], match[1])}`;
}
return input;
}

function doEval(input) {
const code = preprocessEval(input);

return evalScript(code);
}

function eval_and_print(expr) {
var result;

try {
/* eval as a script */
result = doEval(expr);
/* eval as a script */
result = evalScript(expr);
result.then(res => {
result = res.value;
stdout_write(colors[styles.result]);
print(result);
stdout_write('\n');
stdout_write(colors.none);
/* set the last result */
g._ = result;
} catch (error) {
},
error => {
dump_error(error);
}
})
.finally(() => {
level = 0;

/* run the garbage collector after each command */
tjs.gc();

cmd_readline_start();
});
}

function dump_error(error) {
Expand Down Expand Up @@ -1243,11 +1232,6 @@ function _run(g) {
mexpr = '';

eval_and_print(expr);

level = 0;

/* run the garbage collector after each command */
tjs.gc();
}

function colorize_js(str) {
Expand Down
2 changes: 1 addition & 1 deletion src/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static JSValue tjs_evalScript(JSContext *ctx, JSValue this_val, int argc, JSValu
str = JS_ToCStringLen(ctx, &len, argv[0]);
if (!str)
return JS_EXCEPTION;
ret = JS_Eval(ctx, str, len, "<evalScript>", JS_EVAL_TYPE_GLOBAL);
ret = JS_Eval(ctx, str, len, "<evalScript>", JS_EVAL_TYPE_GLOBAL | JS_EVAL_FLAG_ASYNC);
JS_FreeCString(ctx, str);
return ret;
}
Expand Down
Loading