Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hl] Respect hl-legacy32 for I64 arrays #11903

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
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/generators/genhl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type array_impl = {
ai32 : tclass;
af32 : tclass;
af64 : tclass;
ai64 : tclass;
ai64 : tclass option;
}

type constval =
Expand Down Expand Up @@ -289,7 +289,10 @@ let array_class ctx t =
| HF64 ->
ctx.array_impl.af64
| HI64 ->
ctx.array_impl.ai64
begin match ctx.array_impl.ai64 with
| None -> die "" __LOC__
| Some c -> c
end
| HDyn ->
ctx.array_impl.adyn
| _ ->
Expand Down Expand Up @@ -4153,7 +4156,7 @@ let create_context com dump =
ai32 = get_class "ArrayBytes_Int";
af32 = get_class "ArrayBytes_hl_F32";
af64 = get_class "ArrayBytes_Float";
ai64 = get_class "ArrayBytes_hl_I64";
ai64 = if Gctx.raw_defined com "hl_legacy32" then None else Some (get_class "ArrayBytes_hl_I64");
};
base_class = get_class "Class";
base_enum = get_class "Enum";
Expand Down
2 changes: 2 additions & 0 deletions std/hl/types/ArrayBase.hx
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ class ArrayBase extends ArrayAccess {
return a;
}

#if !hl_legacy32
public static function allocI64(bytes:BytesAccess<I64>, length:Int) @:privateAccess {
var a:ArrayBytes.ArrayI64 = untyped $new(ArrayBytes.ArrayI64);
a.length = length;
a.bytes = bytes;
a.size = length;
return a;
}
#end
}
2 changes: 2 additions & 0 deletions std/hl/types/ArrayBytes.hx
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,6 @@ typedef ArrayI32 = ArrayBytes<Int>;
typedef ArrayUI16 = ArrayBytes<UI16>;
typedef ArrayF32 = ArrayBytes<F32>;
typedef ArrayF64 = ArrayBytes<Float>;
#if !hl_legacy32
typedef ArrayI64 = ArrayBytes<I64>;
#end
Loading