MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

JS_FUNC and JS_OBJ

+14 -12
+2 -2
include/ant.h
··· 9 9 typedef uint64_t jsval_t; 10 10 11 11 enum { 12 - JS_UNDEF, JS_NULL, JS_TRUE, JS_FALSE, 13 - JS_STR, JS_NUM, JS_ERR, JS_PRIV, JS_PROMISE, JS_OBJ 12 + JS_UNDEF, JS_NULL, JS_TRUE, JS_FALSE, JS_STR, JS_NUM, 13 + JS_ERR, JS_PRIV, JS_PROMISE, JS_OBJ, JS_FUNC 14 14 }; 15 15 16 16 struct js *js_create(void *buf, size_t len);
+1 -1
meson.build
··· 74 74 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 75 75 76 76 version_conf = configuration_data() 77 - version_conf.set('ANT_VERSION', '0.1.0.31') 77 + version_conf.set('ANT_VERSION', '0.1.0.32') 78 78 version_conf.set('ANT_GIT_HASH', git_hash) 79 79 version_conf.set('ANT_BUILD_DATE', build_date) 80 80
+3 -1
src/ant.c
··· 14400 14400 case T_NUM: return JS_NUM; 14401 14401 case T_ERR: return JS_ERR; 14402 14402 case T_PROMISE: return JS_PROMISE; 14403 - case T_OBJ: return JS_OBJ; 14403 + case T_OBJ: 14404 + case T_ARR: return JS_OBJ; 14405 + case T_FUNC: return JS_FUNC; 14404 14406 default: return JS_PRIV; 14405 14407 } 14406 14408 }
+2 -2
src/modules/events.c
··· 91 91 return js_mkerr(js, "eventType must be a string"); 92 92 } 93 93 94 - if (js_type(args[1]) != JS_PRIV) { 94 + if (js_type(args[1]) != JS_FUNC) { 95 95 return js_mkerr(js, "listener must be a function"); 96 96 } 97 97 ··· 130 130 return js_mkerr(js, "eventType must be a string"); 131 131 } 132 132 133 - if (js_type(args[1]) != JS_PRIV) { 133 + if (js_type(args[1]) != JS_FUNC) { 134 134 return js_mkerr(js, "listener must be a function"); 135 135 } 136 136
+2 -2
src/modules/json.c
··· 97 97 return yyjson_mut_strncpy(doc, str, len); 98 98 } 99 99 100 - case JS_PRIV: { 100 + case JS_OBJ: { 101 101 jsval_t length_val = js_get(js, val, "length"); 102 102 103 103 if (js_type(length_val) == JS_NUM) { ··· 123 123 124 124 while (js_prop_iter_next(&iter, &key, &key_len, &prop_value)) { 125 125 if (key_len > 2 && key[0] == '_' && key[1] == '_') continue; 126 - if (js_type(prop_value) == JS_PRIV) { 126 + if (js_type(prop_value) == JS_OBJ) { 127 127 jsval_t code = js_get(js, prop_value, "__code"); 128 128 if (js_type(code) == JS_STR) continue; 129 129 }
+1 -1
src/modules/path.c
··· 333 333 // path.format(pathObject) 334 334 static jsval_t builtin_path_format(struct js *js, jsval_t *args, int nargs) { 335 335 if (nargs < 1) return js_mkerr(js, "format() requires a path object argument"); 336 - if (js_type(args[0]) != JS_PRIV) return js_mkerr(js, "format() argument must be an object"); 336 + if (js_type(args[0]) != JS_OBJ) return js_mkerr(js, "format() argument must be an object"); 337 337 338 338 jsval_t obj = args[0]; 339 339
+3 -3
src/modules/shell.c
··· 72 72 (void)nargs; 73 73 74 74 jsval_t this_val = js_getthis(js); 75 - if (js_type(this_val) != JS_PRIV) { 75 + if (js_type(this_val) != JS_OBJ) { 76 76 return js_mkerr(js, "text() must be called on a shell result"); 77 77 } 78 78 ··· 85 85 (void)nargs; 86 86 87 87 jsval_t this_val = js_getthis(js); 88 - if (js_type(this_val) != JS_PRIV) return js_mkerr(js, "lines() must be called on a shell result"); 88 + if (js_type(this_val) != JS_OBJ) return js_mkerr(js, "lines() must be called on a shell result"); 89 89 90 90 jsval_t stdout_val = js_get(js, this_val, "stdout"); 91 91 if (js_type(stdout_val) != JS_STR) return js_mkerr(js, "No stdout available"); ··· 123 123 static jsval_t builtin_shell_dollar(struct js *js, jsval_t *args, int nargs) { 124 124 if (nargs < 1) return js_mkerr(js, "$() requires at least one argument"); 125 125 126 - if (js_type(args[0]) != JS_PRIV) { 126 + if (js_type(args[0]) != JS_OBJ) { 127 127 if (js_type(args[0]) == JS_STR) { 128 128 size_t cmd_len; 129 129 char *cmd = js_getstr(js, args[0], &cmd_len);