Browse Source

Mark local function this pointers

Hugh Sanderson 14 years ago
parent
commit
2eecf83170
1 changed files with 2 additions and 6 deletions
  1. 2 6
      gencpp.ml

+ 2 - 6
gencpp.ml

@@ -928,7 +928,8 @@ let rec define_local_function_ctx ctx func_name func_def =
 		if (has_this) then Hashtbl.remove undeclared "this";
 		let typed_vars = hash_iterate undeclared (fun key value -> value ^ "," ^ (keyword_remap key) ) in
 		let func_name_sep = func_name ^ (if List.length typed_vars > 0 then "," else "") in
-		output_i ("HX_BEGIN_LOCAL_FUNC" ^ (list_num typed_vars) ^ "(" ^ func_name_sep ^
+		output_i ("HX_BEGIN_LOCAL_FUNC_S" ^ (list_num typed_vars) ^ "(" ^
+         (if has_this then "hx::LocalThisFunc," else "hx::LocalFunc,") ^ func_name_sep ^
 						(String.concat "," typed_vars) ^ ")\n" );
 
 		(* actual function, called "run" *)
@@ -973,11 +974,6 @@ let rec define_local_function_ctx ctx func_name func_def =
 		end;
 		pop_real_this_ptr();
 
-		if (has_this) then begin
-			output_i "Dynamic __this;\n";
-			output_i "void __SetThis(Dynamic inThis) { __this = inThis; }\n";
-		end;
-
 		let return = if (type_string func_def.tf_type ) = "Void" then "(void)" else "return" in
 		output_i ("HX_END_LOCAL_FUNC" ^ (list_num args_and_types) ^ "(" ^ return ^ ")\n\n");