Explorar el Código

Add Pointer.endOf. Use haxe typing for TCast value, Closes #5180

hughsando hace 9 años
padre
commit
0c69f8806a
Se han modificado 2 ficheros con 4 adiciones y 1 borrados
  1. 2 1
      src/generators/gencpp.ml
  2. 2 0
      std/cpp/Pointer.hx

+ 2 - 1
src/generators/gencpp.ml

@@ -2371,7 +2371,7 @@ let retype_expression ctx request_type function_args expression_tree forInjectio
                let cppType = cpp_type_of expr.etype in
                (*
                let retypedArgs = List.map2 (fun arg (var,opt) ->
-                   retype (cpp_fun_arg_type_of var opt) arg
+                   retype (cpp_fun_arg_type_of ctx var opt) arg
                    ) args, func.tf_args in
                *)
                let retypedArgs = List.map (retype TCppDynamic ) args in
@@ -2665,6 +2665,7 @@ let retype_expression ctx request_type function_args expression_tree forInjectio
          | TReturn eo ->
             CppReturn(match eo with None -> None | Some e -> Some (retype (cpp_type_of e.etype) e)), TCppVoid
          | TCast (base,None) -> (* Use auto-cast rules *)
+            let return_type = cpp_type_of expr.etype in
             let baseCpp = retype (return_type) base in
             let baseStr = (tcpp_to_string baseCpp.cpptype) in
             let returnStr = (tcpp_to_string return_type) in

+ 2 - 0
std/cpp/Pointer.hx

@@ -43,6 +43,8 @@ extern class Pointer<T> extends ConstPointer<T> implements ArrayAccess<T>
 
    public static function addressOf<T>(inVariable:T) : Pointer<T>;
 
+   public static function endOf<T:{}>(inVariable:T) : Pointer<cpp.Void>;
+
    public static function arrayElem<T>(array:Array<T>, inElem:Int):Pointer<T>;
 
    public static function ofArray<T>(array:Array<T>):Pointer<T>;