|
@@ -1909,6 +1909,15 @@ let cpp_variant_type_of t = match t with
|
|
| TCppVariant -> TCppVariant
|
|
| TCppVariant -> TCppVariant
|
|
;;
|
|
;;
|
|
|
|
|
|
|
|
+let cpp_cast_variant_type_of t = match t with
|
|
|
|
+ | TCppObjectArray _
|
|
|
|
+ | TCppScalarArray _
|
|
|
|
+ | TCppDynamicArray
|
|
|
|
+ | TCppClass
|
|
|
|
+ | TCppEnum _
|
|
|
|
+ | TCppInst _ -> t
|
|
|
|
+ | _ -> cpp_variant_type_of t;
|
|
|
|
+;;
|
|
|
|
|
|
let cpp_base_type_of t =
|
|
let cpp_base_type_of t =
|
|
match cpp_variant_type_of t with
|
|
match cpp_variant_type_of t with
|
|
@@ -2083,8 +2092,7 @@ let retype_expression ctx request_type function_args expression_tree forInjectio
|
|
match expr.eexpr with
|
|
match expr.eexpr with
|
|
| TEnumParameter( enumObj, enumField, enumIndex ) ->
|
|
| TEnumParameter( enumObj, enumField, enumIndex ) ->
|
|
let retypedObj = retype TCppDynamic enumObj in
|
|
let retypedObj = retype TCppDynamic enumObj in
|
|
- (* hxcpp actually stores enum parametes in Array<Dynamic> *)
|
|
|
|
- CppEnumParameter( retypedObj, enumField, enumIndex ), cpp_variant_type_of (cpp_type_of (get_nth_type enumField enumIndex))
|
|
|
|
|
|
+ CppEnumParameter( retypedObj, enumField, enumIndex ), cpp_cast_variant_type_of (cpp_type_of (get_nth_type enumField enumIndex))
|
|
|
|
|
|
| TConst TThis ->
|
|
| TConst TThis ->
|
|
uses_this := Some !this_real;
|
|
uses_this := Some !this_real;
|
|
@@ -3121,11 +3129,21 @@ let gen_cpp_ast_expression_tree ctx class_name func_name function_args injection
|
|
out ((string_of_path enum.e_path) ^ "::" ^ (cpp_enum_name_of field) ^ "_dyn()" );
|
|
out ((string_of_path enum.e_path) ^ "::" ^ (cpp_enum_name_of field) ^ "_dyn()" );
|
|
|
|
|
|
| CppEnumParameter(obj,field,index) ->
|
|
| CppEnumParameter(obj,field,index) ->
|
|
- let baseType = cpp_base_type_of (cpp_type_of ctx (get_nth_type field index) ) in
|
|
|
|
|
|
+ let valueType = cpp_type_of ctx (get_nth_type field index) in
|
|
|
|
+ let baseType = cpp_base_type_of valueType in
|
|
gen obj;
|
|
gen obj;
|
|
if cpp_is_dynamic_type obj.cpptype then
|
|
if cpp_is_dynamic_type obj.cpptype then
|
|
out ".StaticCast< ::hx::EnumBase >()";
|
|
out ".StaticCast< ::hx::EnumBase >()";
|
|
- out ( "->_hx_get" ^ baseType ^ "(" ^ (string_of_int index) ^ ")")
|
|
|
|
|
|
+ out ( "->_hx_get" ^ baseType ^ "(" ^ (string_of_int index) ^ ")");
|
|
|
|
+ (match valueType with
|
|
|
|
+ | TCppObjectArray _
|
|
|
|
+ | TCppScalarArray _
|
|
|
|
+ | TCppDynamicArray
|
|
|
|
+ | TCppClass
|
|
|
|
+ | TCppEnum _
|
|
|
|
+ | TCppInst _ -> out (".StaticCast< " ^ (tcpp_to_string valueType ) ^ ">()")
|
|
|
|
+ | _ ->()
|
|
|
|
+ )
|
|
|
|
|
|
| CppIntSwitch(condition, cases, defVal) ->
|
|
| CppIntSwitch(condition, cases, defVal) ->
|
|
out "switch((int)("; gen condition; out "))";
|
|
out "switch((int)("; gen condition; out "))";
|