|
@@ -745,7 +745,9 @@ let rec class_string klass suffix params remap =
|
|
|
(* Normal class *)
|
|
|
| path when klass.cl_extern && (not (is_internal_class path) )->
|
|
|
(join_class_path_remap klass.cl_path "::") ^ suffix
|
|
|
- | _ -> "::" ^ (join_class_path_remap klass.cl_path "::") ^ suffix
|
|
|
+ | _ ->
|
|
|
+ let globalNamespace = if (get_meta_string klass.cl_meta Meta.Native)<>"" then "" else "::" in
|
|
|
+ globalNamespace ^ (join_class_path_remap klass.cl_path "::") ^ suffix
|
|
|
)
|
|
|
and type_string_suff suffix haxe_type remap =
|
|
|
let type_string = type_string_remap remap in
|
|
@@ -1687,7 +1689,8 @@ and tcpp_to_string tcpp =
|
|
|
tcpp_to_string_suffix "" tcpp
|
|
|
|
|
|
and cpp_class_path_of klass =
|
|
|
- " ::" ^ (join_class_path_remap klass.cl_path "::")
|
|
|
+ let globalNamespace = if (get_meta_string klass.cl_meta Meta.Native)<>"" then " " else " ::" in
|
|
|
+ globalNamespace ^ (join_class_path_remap klass.cl_path "::")
|
|
|
;;
|
|
|
|
|
|
|
|
@@ -1973,7 +1976,8 @@ let cpp_enum_path_of enum =
|
|
|
rename
|
|
|
else
|
|
|
*)
|
|
|
- "::" ^ (join_class_path_remap enum.e_path "::")
|
|
|
+ let globalNamespace = if (get_meta_string enum.e_meta Meta.Native)<>"" then "" else "::" in
|
|
|
+ globalNamespace ^ (join_class_path_remap enum.e_path "::")
|
|
|
;;
|
|
|
|
|
|
|
|
@@ -2013,10 +2017,9 @@ let cpp_class_name klass =
|
|
|
rename ^ "_obj"
|
|
|
else
|
|
|
*)
|
|
|
- begin
|
|
|
- let path = "::" ^ (join_class_path_remap klass.cl_path "::") in
|
|
|
- if path="::String" then path else path ^ "_obj"
|
|
|
- end
|
|
|
+ let globalNamespace = if (get_meta_string klass.cl_meta Meta.Native)<>"" then "" else "::" in
|
|
|
+ let path = globalNamespace ^ (join_class_path_remap klass.cl_path "::") in
|
|
|
+ if path="::String" then path else path ^ "_obj"
|
|
|
;;
|
|
|
|
|
|
|
|
@@ -2972,6 +2975,7 @@ let retype_expression ctx request_type function_args expression_tree forInjectio
|
|
|
CppTry(cppBlock, cppCatches), TCppVoid
|
|
|
|
|
|
| TReturn eo ->
|
|
|
+ (*CppReturn(match eo with None -> None | Some e -> Some (retype (cpp_type_of expr.etype) e)), TCppVoid*)
|
|
|
CppReturn(match eo with None -> None | Some e -> Some (retype (cpp_type_of e.etype) e)), TCppVoid
|
|
|
|
|
|
| TCast (base,None) -> (* Use auto-cast rules *)
|
|
@@ -3030,6 +3034,11 @@ let retype_expression ctx request_type function_args expression_tree forInjectio
|
|
|
end else if (cppExpr.cpptype=TCppVariant || cppExpr.cpptype=TCppDynamic) then begin
|
|
|
match return_type with
|
|
|
| TCppUnchanged -> cppExpr
|
|
|
+ | TCppInst(t) when (has_meta_key t.cl_meta Meta.StructAccess) ->
|
|
|
+ let structType = TCppStruct( TCppInst(t) ) in
|
|
|
+ let structCast = mk_cppexpr (CppCast(cppExpr,structType)) structType in
|
|
|
+ mk_cppexpr (CppCast(structCast,(TCppInst t))) (TCppInst t)
|
|
|
+
|
|
|
| TCppObjectArray _
|
|
|
| TCppScalarArray _
|
|
|
| TCppNativePointer _
|
|
@@ -3057,6 +3066,11 @@ let retype_expression ctx request_type function_args expression_tree forInjectio
|
|
|
| TCppDynamic when cppExpr.cpptype=TCppVariant
|
|
|
-> mk_cppexpr (CppCastVariant(cppExpr)) return_type
|
|
|
|
|
|
+ | TCppStar(t,const) ->
|
|
|
+ let ptrType = TCppPointer((if const then "ConstPointer" else "Pointer"),t) in
|
|
|
+ let ptrCast = mk_cppexpr (CppCast(cppExpr,ptrType)) ptrType in
|
|
|
+ mk_cppexpr (CppCast(ptrCast,TCppStar(t,const))) (TCppStar(t,const))
|
|
|
+
|
|
|
| _ -> cppExpr
|
|
|
end else match cppExpr.cpptype, return_type with
|
|
|
| _, TCppUnchanged -> cppExpr
|
|
@@ -3105,10 +3119,7 @@ let retype_expression ctx request_type function_args expression_tree forInjectio
|
|
|
let ptrType = TCppPointer((if const then "ConstPointer" else "Pointer"),t) in
|
|
|
let ptrCast = mk_cppexpr (CppCast(cppExpr,ptrType)) ptrType in
|
|
|
mk_cppexpr (CppCast(ptrCast,TCppDynamic)) TCppDynamic
|
|
|
- | TCppDynamic, TCppStar(t,const) ->
|
|
|
- let ptrType = TCppPointer((if const then "ConstPointer" else "Pointer"),t) in
|
|
|
- let ptrCast = mk_cppexpr (CppCast(cppExpr,ptrType)) ptrType in
|
|
|
- mk_cppexpr (CppCast(ptrCast,TCppStar(t,const))) (TCppStar(t,const))
|
|
|
+
|
|
|
|
|
|
| TCppStar(t,const), TCppInst _
|
|
|
| TCppStar(t,const), TCppStruct _ ->
|