@@ -2895,15 +2895,15 @@ napi_set_property_descriptor(napi_env env, napi_value object, napi_property_desc
2895
2895
} else if (descriptor .method ) {
2896
2896
flags |= JS_PROP_HAS_VALUE ;
2897
2897
napi_value function = NULL ;
2898
- napi_create_function (env , NULL , 0 , descriptor .method , descriptor .data , & function );
2898
+ napi_create_function (env , descriptor . utf8name , NAPI_AUTO_LENGTH , descriptor .method , descriptor .data , & function );
2899
2899
if (function ) {
2900
2900
value = * ((JSValue * ) function );
2901
2901
}
2902
2902
} else if (descriptor .getter || descriptor .setter ) {
2903
2903
if (descriptor .getter ) {
2904
2904
napi_value getter = NULL ;
2905
2905
flags |= JS_PROP_HAS_GET ;
2906
- napi_create_function (env , NULL , 0 , descriptor .getter , descriptor .data , & getter );
2906
+ napi_create_function (env , descriptor . utf8name , NAPI_AUTO_LENGTH , descriptor .getter , descriptor .data , & getter );
2907
2907
if (getter ) {
2908
2908
getterValue = * ((JSValue * ) getter );
2909
2909
}
@@ -2912,7 +2912,7 @@ napi_set_property_descriptor(napi_env env, napi_value object, napi_property_desc
2912
2912
if (descriptor .setter ) {
2913
2913
napi_value setter = NULL ;
2914
2914
flags |= JS_PROP_HAS_SET ;
2915
- napi_create_function (env , NULL , 0 , descriptor .setter , descriptor .data , & setter );
2915
+ napi_create_function (env , descriptor . utf8name , NAPI_AUTO_LENGTH , descriptor .setter , descriptor .data , & setter );
2916
2916
if (setter ) {
2917
2917
setterValue = * ((JSValue * ) setter );
2918
2918
}
@@ -3009,6 +3009,8 @@ napi_status napi_call_function(napi_env env, napi_value thisValue, napi_value fu
3009
3009
for (size_t i = 0 ; i < argc ; ++ i ) {
3010
3010
args [i ] = * ((JSValue * ) argv [i ]);
3011
3011
}
3012
+
3013
+
3012
3014
returnValue = JS_Call (env -> context , jsFunction , jsThis , (int ) argc ,
3013
3015
args );
3014
3016
if (argc > 8 ) mi_free (args );
@@ -3054,13 +3056,16 @@ CallCFunction(JSContext *context, JSValueConst thisVal, int argc, JSValueConst *
3054
3056
struct napi_callback_info__ callbackInfo = {JSUndefined , thisVal , argv , functionInfo -> data ,
3055
3057
argc };
3056
3058
3059
+
3057
3060
napi_handle_scope__ handleScope ;
3058
3061
handleScope .type = HANDLE_STACK_ALLOCATED ;
3059
3062
handleScope .handleCount = 0 ;
3060
3063
handleScope .escapeCalled = false;
3061
3064
SLIST_INIT (& handleScope .handleList );
3062
3065
LIST_INSERT_HEAD (& env -> handleScopeList , & handleScope , node );
3063
3066
3067
+
3068
+
3064
3069
napi_value result = functionInfo -> callback (env , & callbackInfo );
3065
3070
3066
3071
if (useGlobalValue ) {
@@ -3132,15 +3137,9 @@ napi_create_function(napi_env env, const char *utf8name, size_t length, napi_cal
3132
3137
RETURN_STATUS_IF_FALSE (!JS_IsException (functionValue ), napi_pending_exception )
3133
3138
3134
3139
if (utf8name && strcmp (utf8name , "" ) != 0 ) {
3135
- int returnStatus = JS_DefinePropertyValue (env -> context , functionValue , env -> atoms .name ,
3140
+ JS_DefinePropertyValue (env -> context , functionValue , env -> atoms .name ,
3136
3141
JS_NewString (env -> context , utf8name ),
3137
3142
JS_PROP_CONFIGURABLE );
3138
-
3139
- if (TRUTHY (returnStatus == -1 )) {
3140
- JS_FreeValue (env -> context , functionValue );
3141
-
3142
- return napi_set_last_error (env , napi_pending_exception , NULL , 0 , NULL );
3143
- }
3144
3143
}
3145
3144
3146
3145
return CreateScopedResult (env , functionValue , result );
0 commit comments