@@ -156,6 +156,14 @@ static bool string_object_length(string& object) {
156156 return true ;
157157}
158158
159+ static bool array_object_length (string& object) {
160+ base_array* array_class=NULL ;
161+ support_javascript_variant_type array_class_type=NONE ;
162+ get_variant (object,(void *)&array_class,&array_class_type);
163+ set_variant (JAVASCRIPT_VARIANT_KEYNAME_FUNCTION_RESULT ,(void *)array_class->length (),NUMBER );
164+ return true ;
165+ }
166+
159167void init_native_function (void ) {
160168 local_function_table[JAVASCRIPT_NATIVE_OBJECT_CONSOLE ][" log" ].is_native_function =true ;
161169 local_function_table[JAVASCRIPT_NATIVE_OBJECT_CONSOLE ][" log" ].native_function =console_log;
@@ -225,6 +233,12 @@ static bool call_javascript_object_native_function(string base_object,string fun
225233 return true ;
226234 }
227235 }
236+ } else if (INT_ARRAY ==variant_type) {
237+ if (" length" ==function_name)
238+ return array_object_length (base_object);
239+ } else if (OBJECT_ARRAY ==variant_type) {
240+ if (" length" ==function_name)
241+ return array_object_length (base_object);
228242 }
229243 }
230244 return false ;
@@ -273,7 +287,8 @@ bool eval_function(string express) { // console.log(express); or console.log(e
273287 trim (express);
274288 unsigned long first_left_bracket_index=express.find (' (' );
275289 unsigned long match_right_bracket_index=get_matching_outside_right_bracket (express,0 );
276- if (INVALID_VALUE ==first_left_bracket_index || INVALID_VALUE ==match_right_bracket_index)
290+ unsigned long equal_index=express.find (' =' );
291+ if (INVALID_VALUE ==first_left_bracket_index || INVALID_VALUE ==match_right_bracket_index || INVALID_VALUE !=equal_index)
277292 return false ;
278293
279294 string function_name (express.substr (0 ,first_left_bracket_index));
@@ -318,7 +333,7 @@ bool eval_function(string express) { // console.log(express); or console.log(e
318333 }
319334 trim (object_name);
320335 trim (function_name);
321- if (! is_exist_native_object (object_name) && is_exist_variant (object_name))
336+ if (is_exist_variant (object_name))
322337 return call_javascript_object_native_function (object_name,function_name,function_argments_list);
323338 if (is_exist_native_object_function (object_name,function_name)) {
324339 if (local_function_table[object_name][function_name].is_native_function ) {
0 commit comments