}
+njs_ret_t
+njs_function_function(njs_vm_t *vm, njs_param_t *param)
+{
+ return NXT_ERROR;
+}
+
+
nxt_noinline njs_ret_t
njs_function_apply(njs_vm_t *vm, njs_value_t *name, njs_param_t *param)
{
return njs_object_hash_create(vm, hash, njs_function_prototype_properties,
nxt_nitems(njs_function_prototype_properties));
}
+
+
+njs_ret_t
+njs_eval_function(njs_vm_t *vm, njs_param_t *param)
+{
+ return NXT_ERROR;
+}
+
+
+static const njs_object_prop_t njs_eval_function_properties[] =
+{
+ /* eval.name == "eval". */
+ { njs_string("eval"),
+ njs_string("name"),
+ NJS_PROPERTY, 0, 0, 0, },
+
+ /* eval.length == 1. */
+ { njs_value(NJS_NUMBER, 0, 1.0),
+ njs_string("length"),
+ NJS_PROPERTY, 0, 0, 0, },
+};
+
+
+nxt_int_t
+njs_eval_function_hash(njs_vm_t *vm, nxt_lvlhsh_t *hash)
+{
+ return njs_object_hash_create(vm, hash, njs_eval_function_properties,
+ nxt_nitems(njs_eval_function_properties));
+}
njs_function_t *njs_function_alloc(njs_vm_t *vm);
+njs_ret_t njs_function_function(njs_vm_t *vm, njs_param_t *param);
njs_ret_t njs_function_apply(njs_vm_t *vm, njs_value_t *name,
njs_param_t *param);
njs_value_t *njs_vmcode_native_frame(njs_vm_t *vm, njs_value_t *method,
nxt_int_t njs_function_function_hash(njs_vm_t *vm, nxt_lvlhsh_t *hash);
nxt_int_t njs_function_prototype_hash(njs_vm_t *vm, nxt_lvlhsh_t *hash);
+njs_ret_t njs_eval_function(njs_vm_t *vm, njs_param_t *param);
+nxt_int_t njs_eval_function_hash(njs_vm_t *vm, nxt_lvlhsh_t *hash);
+
#endif /* _NJS_FUNCTION_H_INCLUDED_ */
typedef nxt_int_t (*njs_shared_hash_t) (njs_vm_t *vm, nxt_lvlhsh_t *hash);
-/* STUB */
-static nxt_int_t
-njs_stub_hash(njs_vm_t *vm, nxt_lvlhsh_t *hash)
-{
- return NXT_OK;
-}
-static njs_ret_t
-njs_stub_function(njs_vm_t *vm, njs_param_t *param)
-{
- return NXT_ERROR;
-}
-/**/
-
-
nxt_int_t
njs_shared_objects_create(njs_vm_t *vm)
{
njs_string_function_hash,
njs_function_function_hash,
njs_regexp_function_hash,
- njs_stub_hash,
+
+ njs_eval_function_hash,
};
- static const njs_native_t native_functions[] = {
+ static const njs_native_t native_functions[] = {
njs_object_function,
njs_array_function,
njs_boolean_function,
njs_number_function,
njs_string_ctor_function,
- njs_stub_function,
+ njs_function_function,
njs_regexp_function,
- njs_stub_function,
+
+ njs_eval_function,
};
size = NJS_PROTOTYPE_MAX * sizeof(njs_object_t);
* Array.__proto__ -> Function_Prototype,
* Array_Prototype.__proto__ -> Object_Prototype,
*
+ * Boolean(),
+ * Boolean.__proto__ -> Function_Prototype,
+ * Boolean_Prototype.__proto__ -> Object_Prototype,
+ *
+ * Number(),
+ * Number.__proto__ -> Function_Prototype,
+ * Number_Prototype.__proto__ -> Object_Prototype,
+ *
+ * String(),
+ * String.__proto__ -> Function_Prototype,
+ * String_Prototype.__proto__ -> Object_Prototype,
+ *
* Function(),
* Function.__proto__ -> Function_Prototype,
* Function_Prototype.__proto__ -> Object_Prototype,
*
- * [...]
+ * RegExp(),
+ * RegExp.__proto__ -> Function_Prototype,
+ * RegExp_Prototype.__proto__ -> Object_Prototype,
*
- * eval().
+ * eval(),
+ * eval.__proto__ -> Function_Prototype.
*/
nxt_int_t
{ nxt_string("var o = Object.create(null); '__proto__' in o"),
nxt_string("false") },
+ /* eval(). */
+
+ { nxt_string("eval.name"),
+ nxt_string("eval") },
+
+ { nxt_string("eval.length"),
+ nxt_string("1") },
+
+ { nxt_string("eval.prototype"),
+ nxt_string("undefined") },
+
+ { nxt_string("eval.__proto__ === Function.prototype"),
+ nxt_string("true") },
+
+ { nxt_string("eval.constructor === Function"),
+ nxt_string("true") },
+
+ { nxt_string("eval()"),
+ nxt_string("") },
+
/* es5id: 8.2_A1_T1 */
/* es5id: 8.2_A1_T2 */