-
-
Notifications
You must be signed in to change notification settings - Fork 682
Open
Description
// MyPointer.hx
class MyPointer extends cpp.Pointer<Int> {}
# build.hxml
MyPointer
--cpp out
This has always generated broken code, however, it has only started triggering an infinite loop since: 145e55f.
Prior to that change, it seems ids didn't get added for extern classes, however, now they are added. Since cpp.ConstPointer
and cpp.Pointer
both point to the same native type, the same id is added twice, which breaks an assumption made by this dump_classes function and causes the code to loop forever.
haxe/src/generators/cpp/gen/cppGenClassImplementation.ml
Lines 372 to 388 in aa3ecc5
let rec dump_classes indent classes = | |
match classes with | |
| [] -> () | |
| [ c ] -> output_cpp (indent ^ "return inClassId==(int)" ^ txt c ^ ";\n") | |
| [ c; c1 ] -> | |
output_cpp | |
(indent ^ "return inClassId==(int)" ^ txt c ^ " || inClassId==(int)" ^ txt c1 ^ ";\n") | |
| _ -> | |
let len = List.length classes in | |
let mid = List.nth classes (len / 2) in | |
let low, high = List.partition (fun e -> e <= mid) classes in | |
output_cpp (indent ^ "if (inClassId<=(int)" ^ txt mid ^ ") {\n"); | |
dump_classes (indent ^ "\t") low; | |
output_cpp (indent ^ "} else {\n"); | |
dump_classes (indent ^ "\t") high; | |
output_cpp (indent ^ "}\n") | |
in |
@Aidan63 Do you think we should exclude @:nativeGen and extern classes from the id generation?
Metadata
Metadata
Assignees
Labels
No labels