ref: 5de1f97c520cbf9cb410853f473f8ba228874b20
parent: 8b52b57782033cae677d40b373fd4fe2b032e105
author: Tor Andersson <tor.andersson@artifex.com>
date: Tue Mar 12 12:50:44 EDT 2019
Set appropriate internal class property of arguments object.
--- a/jsdump.c
+++ b/jsdump.c
@@ -889,6 +889,7 @@
case JS_CNUMBER: printf("[Number %g]", v.u.object->u.number); break;
case JS_CSTRING: printf("[String'%s']", v.u.object->u.s.string); break;
case JS_CERROR: printf("[Error]"); break;
+ case JS_CARGUMENTS: printf("[Arguments %p]", (void*)v.u.object); break;
case JS_CITERATOR: printf("[Iterator %p]", (void*)v.u.object); break;
case JS_CUSERDATA:
printf("[Userdata %s %p]", v.u.object->u.user.tag, v.u.object->u.user.data);
--- a/jsi.h
+++ b/jsi.h
@@ -93,6 +93,7 @@
/* Private stack functions */
+void js_newarguments(js_State *J);
void js_newfunction(js_State *J, js_Function *function, js_Environment *scope);
void js_newscript(js_State *J, js_Function *function, js_Environment *scope);
void js_loadeval(js_State *J, const char *filename, const char *source);
--- a/jsobject.c
+++ b/jsobject.c
@@ -40,6 +40,7 @@
case JS_CDATE: js_pushliteral(J, "[object Date]"); break;
case JS_CMATH: js_pushliteral(J, "[object Math]"); break;
case JS_CJSON: js_pushliteral(J, "[object JSON]"); break;
+ case JS_CARGUMENTS: js_pushliteral(J, "[object Arguments]"); break;
case JS_CITERATOR: js_pushliteral(J, "[Iterator]"); break;
case JS_CUSERDATA:
js_pushliteral(J, "[object ");
--- a/jsrun.c
+++ b/jsrun.c
@@ -975,7 +975,7 @@
jsR_savescope(J, scope);
if (F->arguments) {
- js_newobject(J);
+ js_newarguments(J);
if (!J->strict) {
js_currentfunction(J);
js_defproperty(J, -2, "callee", JS_DONTENUM);
--- a/jsvalue.c
+++ b/jsvalue.c
@@ -378,6 +378,11 @@
js_pushobject(J, jsV_newobject(J, JS_COBJECT, J->Object_prototype));
}
+void js_newarguments(js_State *J)
+{
+ js_pushobject(J, jsV_newobject(J, JS_CARGUMENTS, J->Object_prototype));
+}
+
void js_newarray(js_State *J)
{
js_pushobject(J, jsV_newobject(J, JS_CARRAY, J->Array_prototype));
--- a/jsvalue.h
+++ b/jsvalue.h
@@ -36,6 +36,7 @@
JS_CDATE,
JS_CMATH,
JS_CJSON,
+ JS_CARGUMENTS,
JS_CITERATOR,
JS_CUSERDATA,
};