Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/codegen/swfLoader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let rec make_tpath x =
let pack, name = match pack, name with
| [], "void" -> [], "Void"
| [], "int" -> [], "Int"
| [], "uint" -> [], "UInt"
| [], "uint" -> ["haxe"], "UInt32"
| [], "Number" -> [], "Float"
| [], "Boolean" -> [], "Bool"
| [], "Object" -> ["flash";"utils"], "Object"
Expand Down Expand Up @@ -399,8 +399,10 @@ let build_class com c file =
| [] -> []
| f :: l ->
match f.cff_kind with
| FVar (Some ((CTPath {path = { tpackage = []; tname = ("String" | "Int" | "UInt")}} as real_t),_),None)
| FProp (("default",_),("never",_),Some ((CTPath { path = { tpackage = []; tname = ("String" | "Int" | "UInt")}}) as real_t,_),None) when List.mem_assoc AStatic f.cff_access ->
| FVar (Some ((CTPath {path = { tpackage = []; tname = ("String" | "Int")}} as real_t),_),None)
| FVar (Some ((CTPath {path = { tpackage = ["haxe"]; tname = "UInt32"}} as real_t),_),None)
| FProp (("default",_),("never",_),Some ((CTPath { path = { tpackage = ["haxe"]; tname = "UInt32"}}) as real_t,_),None)
| FProp (("default",_),("never",_),Some ((CTPath { path = { tpackage = []; tname = ("String" | "Int")}}) as real_t,_),None) when List.mem_assoc AStatic f.cff_access ->
(match !real_type with
| None ->
real_type := Some real_t
Expand Down Expand Up @@ -463,6 +465,7 @@ let extract_data (_,tags) =
let path = (make_tpath f.hlf_name).path in
(match path with
| { tpackage = []; tname = "Float" | "Bool" | "Int" | "UInt" | "Dynamic" } -> ()
| { tpackage = ["haxe"]; tname = "UInt32" } -> ()
| { tpackage = _; tname = "MethodClosure" } -> ()
| _ -> Hashtbl.add h (path.tpackage,path.tname) c)
| _ -> ()
Expand Down
4 changes: 2 additions & 2 deletions src/generators/genhl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ let member_fun c t =

let rec unsigned t =
match follow t with
| TAbstract ({ a_path = [],"UInt" },_) -> true
| TAbstract ({ a_path = ["haxe"],"UInt32" },_) -> true
| TAbstract (a,pl) -> unsigned (Abstract.get_underlying_type a pl)
| _ -> false

Expand Down Expand Up @@ -462,7 +462,7 @@ let rec to_type ?tref ctx t =
if Meta.has Meta.CoreType a.a_meta then
(match a.a_path with
| [], "Void" -> HVoid
| [], "Int" | [], "UInt" -> HI32
| [], "Int" | ["haxe"], "UInt32" -> HI32
| [], "Float" -> HF64
| [], "Single" -> HF32
| [], "Bool" -> HBool
Expand Down
3 changes: 2 additions & 1 deletion src/generators/genhxold.ml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ let generate_type com t =
else
(* we have not found a default value stored in metadata, let's generate it *)
n ^ " : " ^ stype t ^ " = " ^ (match follow t with
| TAbstract ({ a_path = [],("Int"|"Float"|"UInt") },_) -> "0"
| TAbstract ({ a_path = [],("Int"|"Float"|"UInt") },_)
| TAbstract ({ a_path = ["haxe"],"UInt32" },_) -> "0"
| TAbstract ({ a_path = [],"Bool" },_) -> "false"
| _ -> "null")
| Some v ->
Expand Down
1 change: 1 addition & 0 deletions src/generators/genpy.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,7 @@ module Generator = struct
| TClassDecl c -> gen_class ctx c
| TEnumDecl en when not (has_enum_flag en EnExtern) -> gen_enum ctx en
| TAbstractDecl {a_path = [],"UInt"} -> ()
| TAbstractDecl {a_path = ["haxe"],"UInt32"} -> ()
| TAbstractDecl {a_path = [],"Enum"} -> ()
| TAbstractDecl {a_path = [],"EnumValue"} when not (has_feature ctx "has_enum") -> ()
| TAbstractDecl {a_path = [],"Void"} -> ()
Expand Down
10 changes: 5 additions & 5 deletions src/generators/genswf9.ml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ let jump_back ctx =
let real_path = function
| [] , "Int" -> [] , "int"
| [] , "UInt" -> [] , "uint"
| ["haxe"] , "UInt32" -> [] , "uint"
| [] , "Float" -> [] , "Number"
| [] , "Bool" -> [] , "Boolean"
| [] , "Enum" -> [] , "Class"
Expand Down Expand Up @@ -213,12 +214,11 @@ let rec follow_basic t =
| TFun _
| TAbstract ({ a_path = ([],"Int") },[])
| TAbstract ({ a_path = ([],"Float") },[])
| TAbstract ({ a_path = [],"UInt" },[])
| TAbstract ({ a_path = ["haxe"],"UInt32" },[])
| TAbstract ({ a_path = ([],"Bool") },[])
| TInst ({ cl_path = (["haxe"],"Int32") },[]) -> t
| t -> t)
| TType ({ t_path = ["flash";"utils"],"Function" },[])
| TType ({ t_path = [],"UInt" },[]) ->
| TType ({ t_path = ["flash";"utils"],"Function" },[]) ->
t
| TType (t,tl) ->
follow_basic (apply_typedef t tl)
Expand Down Expand Up @@ -253,7 +253,7 @@ let rec type_id ctx t =
type_path ctx a.a_path
| TFun _ | TType ({ t_path = ["flash";"utils"],"Function" },[]) ->
type_path ctx ([],"Function")
| TType ({ t_path = ([],"UInt") as path },_) ->
| TAbstract ({ a_path = (["haxe"],"UInt32") as path },_) ->
type_path ctx path
| TEnum ({ e_path = ["flash"],"XmlType" } as e,_) when has_enum_flag e EnExtern ->
HMPath ([],"String")
Expand Down Expand Up @@ -288,7 +288,7 @@ let classify ctx t =
KType (HMPath ([],"String"))
| TEnum (e,_) ->
KType (type_id ctx t)
| TAbstract ({ a_path = [],"UInt" },_) | TType ({ t_path = [],"UInt" },_) ->
| TAbstract ({ a_path = ["haxe"],"UInt32" },_) | TType ({ t_path = [],"UInt" },_) ->
KUInt
| TFun _ | TType ({ t_path = ["flash";"utils"],"Function" },[]) ->
KType (HMPath ([],"Function"))
Expand Down
2 changes: 1 addition & 1 deletion src/typing/typer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ and type_expr ?(mode=MGet) ctx (e,p) (with_type:WithType.t) =
let call = ECall (field, [ arg_high; arg_low ]), p in
type_expr ctx call with_type
| "u32" ->
let check = ECheckType ((EConst (Int (s, None)), p), (make_ptp_th (mk_type_path ([],"UInt")) p)), p in
let check = ECheckType ((EConst (Int (s, None)), p), (make_ptp_th (mk_type_path (["haxe"],"UInt32")) p)), p in
type_expr ctx check with_type
| other -> raise_typing_error (other ^ " is not a valid integer suffix") p)
| EConst (Float (s, Some suffix) as c) ->
Expand Down
Loading
Loading