@@ -124,10 +124,19 @@ jerry_make_api_unavailable (void)
124
124
jerry_api_available = false;
125
125
} /* jerry_make_api_unavailable */
126
126
127
+ /**
128
+ * Returns whether the given jerry_value_t is error.
129
+ */
130
+ inline bool __attr_always_inline___
131
+ jerry_value_is_error (const jerry_value_t value ) /**< api value */
132
+ {
133
+ return ECMA_IS_VALUE_ERROR (value );
134
+ } /* jerry_value_is_error */
135
+
127
136
/**
128
137
* Returns whether the given jerry_value_t is null.
129
138
*/
130
- bool
139
+ inline bool __attr_always_inline___
131
140
jerry_value_is_null (const jerry_value_t value ) /**< api value */
132
141
{
133
142
return ecma_is_value_null (value );
@@ -136,7 +145,7 @@ jerry_value_is_null (const jerry_value_t value) /**< api value */
136
145
/**
137
146
* Returns whether the given jerry_value_t is undefined.
138
147
*/
139
- bool
148
+ inline bool __attr_always_inline___
140
149
jerry_value_is_undefined (const jerry_value_t value ) /**< api value */
141
150
{
142
151
return ecma_is_value_undefined (value );
@@ -145,7 +154,7 @@ jerry_value_is_undefined (const jerry_value_t value) /**< api value */
145
154
/**
146
155
* Returns whether the given jerry_value_t has boolean type.
147
156
*/
148
- bool
157
+ inline bool __attr_always_inline___
149
158
jerry_value_is_boolean (const jerry_value_t value ) /**< api value */
150
159
{
151
160
return ecma_is_value_boolean (value );
@@ -157,7 +166,7 @@ jerry_value_is_boolean (const jerry_value_t value) /**< api value */
157
166
* More specifically, returns true if the type is JERRY_DATA_TYPE_FLOAT32,
158
167
* JERRY_DATA_TYPE_FLOAT64 or JERRY_DATA_TYPE_UINT32, false otherwise.
159
168
*/
160
- bool
169
+ inline bool __attr_always_inline___
161
170
jerry_value_is_number (const jerry_value_t value ) /**< api value */
162
171
{
163
172
return ecma_is_value_number (value );
@@ -166,7 +175,7 @@ jerry_value_is_number (const jerry_value_t value) /**< api value */
166
175
/**
167
176
* Returns whether the given jerry_value_t is string.
168
177
*/
169
- bool
178
+ inline bool __attr_always_inline___
170
179
jerry_value_is_string (const jerry_value_t value ) /**< api value */
171
180
{
172
181
return ecma_is_value_string (value );
@@ -175,7 +184,7 @@ jerry_value_is_string (const jerry_value_t value) /**< api value */
175
184
/**
176
185
* Returns whether the given jerry_value_t is object.
177
186
*/
178
- bool
187
+ inline bool __attr_always_inline___
179
188
jerry_value_is_object (const jerry_value_t value ) /**< api value */
180
189
{
181
190
return ecma_is_value_object (value );
@@ -184,7 +193,7 @@ jerry_value_is_object (const jerry_value_t value) /**< api value */
184
193
/**
185
194
* Returns whether the given jerry_value_t is a function object.
186
195
*/
187
- bool
196
+ inline bool __attr_always_inline___
188
197
jerry_value_is_function (const jerry_value_t value ) /**< api value */
189
198
{
190
199
return ecma_op_is_callable (value );
@@ -310,10 +319,10 @@ jerry_create_string_value (jerry_string_t *str_p) /**< jerry_string_t from which
310
319
*
311
320
* @return completion code
312
321
*/
313
- inline static jerry_completion_code_t __attr_always_inline___
314
- jerry_convert_eval_completion_to_retval (jerry_value_t * retval_p , /**< [out] api value */
315
- ecma_value_t completion ) /**< completion of 'eval'-mode
322
+ static inline jerry_completion_code_t __attr_always_inline___
323
+ jerry_convert_eval_completion_to_retval (ecma_value_t completion , /**< completion of 'eval'-mode
316
324
* code execution */
325
+ jerry_value_t * retval_p ) /**< [out] api value */
317
326
{
318
327
* retval_p = completion ;
319
328
@@ -715,9 +724,9 @@ jerry_dispatch_external_function (ecma_object_t *function_object_p, /**< externa
715
724
716
725
bool is_successful = ((jerry_external_handler_t ) handler_p ) (function_object_p ,
717
726
this_arg_value ,
718
- & ret_value ,
719
727
arguments_list_p ,
720
- arguments_list_len );
728
+ arguments_list_len ,
729
+ & ret_value );
721
730
722
731
if (!is_successful )
723
732
{
@@ -877,14 +886,13 @@ jerry_delete_object_field (jerry_object_t *object_p, /**< object to delete field
877
886
* - there is field with specified name in the object;
878
887
* false - otherwise.
879
888
*/
880
- bool jerry_get_object_field_value ( jerry_object_t * object_p , /**< object */
881
- const jerry_char_t * field_name_p , /**< field name */
882
- jerry_value_t * field_value_p ) /**< [out] field value */
889
+ jerry_value_t
890
+ jerry_get_object_field_value ( jerry_object_t * object_p , /**< object */
891
+ const jerry_char_t * field_name_p ) /**< field name */
883
892
{
884
893
return jerry_get_object_field_value_sz (object_p ,
885
894
field_name_p ,
886
- lit_zt_utf8_string_size (field_name_p ),
887
- field_value_p );
895
+ lit_zt_utf8_string_size (field_name_p ));
888
896
} /* jerry_get_object_field_value */
889
897
890
898
/**
@@ -946,35 +954,29 @@ jerry_foreach_object_field (jerry_object_t *object_p, /**< object */
946
954
* if value was retrieved successfully, it should be freed
947
955
* with jerry_release_value just when it becomes unnecessary.
948
956
*
949
- * @return true, if field value was retrieved successfully, i.e. upon the call:
950
- * - there is field with specified name in the object;
951
- * false - otherwise.
957
+ * @return ecma value
952
958
*/
953
- bool
959
+ jerry_value_t
954
960
jerry_get_object_field_value_sz (jerry_object_t * object_p , /**< object */
955
961
const jerry_char_t * field_name_p , /**< name of the field */
956
- jerry_size_t field_name_size , /**< size of field name in bytes */
957
- jerry_value_t * field_value_p ) /**< [out] field value, if retrieved successfully */
962
+ jerry_size_t field_name_size ) /**< size of field name in bytes */
958
963
{
959
964
jerry_assert_api_available ();
960
965
961
966
ecma_string_t * field_name_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t * ) field_name_p ,
962
967
(lit_utf8_size_t ) field_name_size );
963
968
964
- * field_value_p = ecma_op_object_get (object_p , field_name_str_p );
969
+ ecma_value_t field_value = ecma_op_object_get (object_p , field_name_str_p );
965
970
966
971
ecma_deref_ecma_string (field_name_str_p );
967
972
968
- return (!ECMA_IS_VALUE_ERROR (* field_value_p )
969
- && !ecma_is_value_undefined (* field_value_p ));
973
+ return field_value ;
970
974
} /* jerry_get_object_field_value_sz */
971
975
972
976
/**
973
977
* Set value of field in the specified object
974
978
*
975
- * @return true, if field value was set successfully, i.e. upon the call:
976
- * - field value is writable;
977
- * false - otherwise.
979
+ * @return ecma value
978
980
*/
979
981
bool
980
982
jerry_set_object_field_value (jerry_object_t * object_p , /**< object */
@@ -1112,12 +1114,12 @@ jerry_invoke_function (bool is_invoke_as_constructor, /**< true - invoke functio
1112
1114
* if function is invoked as constructor;
1113
1115
* in case of simple function call set 'this'
1114
1116
* binding to the global object) */
1115
- jerry_value_t * retval_p , /**< pointer to place for function's
1116
- * return value / thrown exception value
1117
- * or NULL (to ignore the values) */
1118
1117
const jerry_value_t args_p [], /**< function's call arguments
1119
1118
* (NULL if arguments number is zero) */
1120
- jerry_length_t args_count ) /**< number of the arguments */
1119
+ jerry_length_t args_count , /**< number of the arguments */
1120
+ jerry_value_t * retval_p ) /**< pointer to place for function's
1121
+ * return value / thrown exception value
1122
+ * or NULL (to ignore the values) */
1121
1123
{
1122
1124
JERRY_ASSERT (args_count == 0 || args_p != NULL );
1123
1125
JERRY_STATIC_ASSERT (sizeof (args_count ) == sizeof (ecma_length_t ),
@@ -1173,13 +1175,14 @@ jerry_invoke_function (bool is_invoke_as_constructor, /**< true - invoke functio
1173
1175
1174
1176
/**
1175
1177
* Construct new TypeError object
1178
+ *
1179
+ * @return TypeError object value
1176
1180
*/
1177
- static void
1178
- jerry_construct_type_error (jerry_value_t * retval_p ) /**< [out] value with constructed
1179
- * TypeError object */
1181
+ static inline jerry_value_t __attr_always_inline___
1182
+ jerry_construct_type_error (void )
1180
1183
{
1181
1184
ecma_object_t * type_error_obj_p = ecma_new_standard_error (ECMA_ERROR_TYPE );
1182
- * retval_p = ecma_make_object_value (type_error_obj_p );
1185
+ return ecma_make_object_value (type_error_obj_p );
1183
1186
} /* jerry_construct_type_error */
1184
1187
1185
1188
/**
@@ -1200,24 +1203,24 @@ bool
1200
1203
jerry_call_function (jerry_object_t * function_object_p , /**< function object to call */
1201
1204
jerry_object_t * this_arg_p , /**< object for 'this' binding
1202
1205
* or NULL (set 'this' binding to the global object) */
1203
- jerry_value_t * retval_p , /**< pointer to place for function's
1204
- * return value / thrown exception value
1205
- * or NULL (to ignore the values) */
1206
1206
const jerry_value_t args_p [], /**< function's call arguments
1207
1207
* (NULL if arguments number is zero) */
1208
- uint16_t args_count ) /**< number of the arguments */
1208
+ uint16_t args_count , /**< number of the arguments */
1209
+ jerry_value_t * retval_p ) /**< [out] pointer to place for function's
1210
+ * return value / thrown exception value
1211
+ * or NULL (to ignore the values) */
1209
1212
{
1210
1213
jerry_assert_api_available ();
1211
1214
1212
1215
if (jerry_is_function (function_object_p ))
1213
1216
{
1214
- return jerry_invoke_function (false, function_object_p , this_arg_p , retval_p , args_p , args_count );
1217
+ return jerry_invoke_function (false, function_object_p , this_arg_p , args_p , args_count , retval_p );
1215
1218
}
1216
1219
else
1217
1220
{
1218
1221
if (retval_p != NULL )
1219
1222
{
1220
- jerry_construct_type_error (retval_p );
1223
+ * retval_p = jerry_construct_type_error ();
1221
1224
}
1222
1225
1223
1226
return false;
@@ -1240,24 +1243,24 @@ jerry_call_function (jerry_object_t *function_object_p, /**< function object to
1240
1243
*/
1241
1244
bool
1242
1245
jerry_construct_object (jerry_object_t * function_object_p , /**< function object to call */
1243
- jerry_value_t * retval_p , /**< pointer to place for function's
1244
- * return value / thrown exception value
1245
- * or NULL (to ignore the values) */
1246
1246
const jerry_value_t args_p [], /**< function's call arguments
1247
1247
* (NULL if arguments number is zero) */
1248
- uint16_t args_count ) /**< number of the arguments */
1248
+ uint16_t args_count , /**< number of the arguments */
1249
+ jerry_value_t * retval_p ) /**< [out] pointer to place for function's
1250
+ * return value / thrown exception value
1251
+ * or NULL (to ignore the values) */
1249
1252
{
1250
1253
jerry_assert_api_available ();
1251
1254
1252
1255
if (jerry_is_constructor (function_object_p ))
1253
1256
{
1254
- return jerry_invoke_function (true, function_object_p , NULL , retval_p , args_p , args_count );
1257
+ return jerry_invoke_function (true, function_object_p , NULL , args_p , args_count , retval_p );
1255
1258
}
1256
1259
else
1257
1260
{
1258
1261
if (retval_p != NULL )
1259
1262
{
1260
- jerry_construct_type_error (retval_p );
1263
+ * retval_p = jerry_construct_type_error ();
1261
1264
}
1262
1265
1263
1266
return false;
@@ -1306,7 +1309,7 @@ jerry_eval (const jerry_char_t *source_p, /**< source code */
1306
1309
is_direct ,
1307
1310
is_strict );
1308
1311
1309
- status = jerry_convert_eval_completion_to_retval (retval_p , completion );
1312
+ status = jerry_convert_eval_completion_to_retval (completion , retval_p );
1310
1313
1311
1314
return status ;
1312
1315
} /* jerry_eval */
@@ -2086,7 +2089,7 @@ jerry_exec_snapshot (const void *snapshot_p, /**< snapshot */
2086
2089
/* vm should be already initialized */
2087
2090
ecma_value_t completion = vm_run_eval (bytecode_p , false);
2088
2091
2089
- ret_code = jerry_convert_eval_completion_to_retval (retval_p , completion );
2092
+ ret_code = jerry_convert_eval_completion_to_retval (completion , retval_p );
2090
2093
2091
2094
ecma_free_value (completion );
2092
2095
}
0 commit comments