mirror of
https://github.com/ccxvii/mujs.git
synced 2026-02-06 01:41:37 +08:00
Create readonly length property on string objects.
This commit is contained in:
@@ -54,6 +54,15 @@ js_Object *jsR_newstring(js_State *J, const char *v)
|
||||
{
|
||||
js_Object *obj = jsR_newobject(J, JS_CSTRING, J->String_prototype);
|
||||
obj->u.string = v;
|
||||
{
|
||||
js_Property *ref;
|
||||
ref = jsR_setproperty(J, obj, "length");
|
||||
ref->value.type = JS_TNUMBER;
|
||||
ref->value.u.number = strlen(v);
|
||||
ref->readonly = 1;
|
||||
ref->dontenum = 1;
|
||||
ref->dontconf = 1;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user