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.

"global" object

+4 -2
+1
include/internal.h
··· 32 32 jsoff_t tlen; // length of the last parsed token 33 33 jsval_t tval; // holds last parsed numeric or string literal value 34 34 jsval_t scope; // current scope 35 + jsval_t global; // global root object 35 36 jsval_t this_val; // 'this' value for currently executing function 36 37 jsval_t super_val; // 'super' value for class methods 37 38 jsval_t new_target; // constructor called with 'new', undefined otherwise
+3 -2
src/ant.c
··· 22184 22184 js = (struct js *) buf; 22185 22185 js->mem = (uint8_t *) (js + 1); 22186 22186 js->size = (jsoff_t) (len - sizeof(*js)); 22187 - js->scope = mkobj(js, 0); 22187 + js->global = mkobj(js, 0); 22188 + js->scope = js->global; 22188 22189 js->size = js->size / 8U * 8U; 22189 22190 js->this_val = js->scope; 22190 22191 js->super_val = js_mkundef(); ··· 22834 22835 inline jsval_t js_mknull(void) { return mkval(T_NULL, 0); } 22835 22836 inline jsval_t js_mknum(double value) { return tov(value); } 22836 22837 inline jsval_t js_mkobj(struct js *js) { return mkobj(js, 0); } 22837 - inline jsval_t js_glob(struct js *js) { (void) js; return mkval(T_OBJ, 0); } 22838 + inline jsval_t js_glob(struct js *js) { return js->global; } 22838 22839 inline jsval_t js_getscope(struct js *js) { return js->scope; } 22839 22840 inline jsval_t js_mkfun(jsval_t (*fn)(struct js *, jsval_t *, int)) { return mkval(T_CFUNC, (size_t) (void *) fn); } 22840 22841