Selaa lähdekoodia

Only set the fake 'this' pointer on inline function definitions

Hugh Sanderson 14 vuotta sitten
vanhempi
commit
e905954a98
1 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
  1. 7 1
      gencpp.ml

+ 7 - 1
gencpp.ml

@@ -281,6 +281,12 @@ List.filter (function (t,pl) ->
 	| _ -> true
 	| _ -> true
 );;
 );;
 
 
+let rec is_function_expr expr =
+   match expr.eexpr with
+   | TParenthesis expr -> is_function_expr expr
+   | TFunction _ -> true
+   | _ -> false;;
+
 
 
 let rec has_rtti_interface c interface =
 let rec has_rtti_interface c interface =
 	List.exists (function (t,pl) ->
 	List.exists (function (t,pl) ->
@@ -1062,6 +1068,7 @@ and define_local_return_block_ctx ctx expression name =
 				find_local_functions_and_return_blocks_ctx ctx true value;
 				find_local_functions_and_return_blocks_ctx ctx true value;
 				output_i ( "__result->Add(" ^ (str name) ^ " , ");
 				output_i ( "__result->Add(" ^ (str name) ^ " , ");
 				gen_expression ctx true value;
 				gen_expression ctx true value;
+				output (if is_function_expr value then ",true" else ",false" );
 				output (");\n");
 				output (");\n");
 			) decl_list;
 			) decl_list;
 			pop_names();
 			pop_names();
@@ -1677,7 +1684,6 @@ let is_data_member field =
 	| Some { eexpr = TFunction function_def } -> is_dynamic_haxe_method field
 	| Some { eexpr = TFunction function_def } -> is_dynamic_haxe_method field
 	| _ -> true;;
 	| _ -> true;;
 
 
-
 let default_value_string = function
 let default_value_string = function
 	| TInt i -> Printf.sprintf "%ld" i
 	| TInt i -> Printf.sprintf "%ld" i
 	| TFloat float_as_string -> float_as_string
 	| TFloat float_as_string -> float_as_string