@@ -15,14 +15,14 @@ Struct::Struct(std::string name, std::vector<std::shared_ptr<Field>> fields,
1515
1616std::shared_ptr<TypeDef> Struct::generateTypeDef () {
1717 if (isRepresentedAsStruct ()) {
18- return std::make_shared<TypeDef>(getTypeAlias (), shared_from_this (),
18+ return std::make_shared<TypeDef>(getTypeName (), shared_from_this (),
1919 nullptr );
2020 } else {
2121 // There is no easy way to represent it as a struct in scala native,
2222 // have to represent it as an array and then Add helpers to help with
2323 // its manipulation
2424 return std::make_shared<TypeDef>(
25- getTypeAlias (),
25+ getTypeName (),
2626 std::make_shared<ArrayType>(std::make_shared<PrimitiveType>(" Byte" ),
2727 typeSize),
2828 location);
@@ -32,7 +32,7 @@ std::shared_ptr<TypeDef> Struct::generateTypeDef() {
3232std::string Struct::generateHelperClass () const {
3333 assert (hasHelperMethods ());
3434 std::stringstream s;
35- std::string type = getTypeAlias ( );
35+ std::string type = replaceChar ( getTypeName (), " " , " _ " );
3636 s << " implicit class " << type << " _ops(val p: native.Ptr[" << type
3737 << " ])"
3838 << " extends AnyVal {\n " ;
@@ -83,7 +83,7 @@ std::string Struct::generateHelperClassMethodsForArrayRepresentation() const {
8383 return s.str ();
8484}
8585
86- std::string Struct::getTypeAlias () const { return " struct_ " + name; }
86+ std::string Struct::getTypeName () const { return " struct " + name; }
8787
8888std::string Struct::str () const {
8989 std::stringstream ss;
@@ -248,7 +248,7 @@ Struct::getTypeReplacement(std::shared_ptr<const Type> type,
248248 std::make_shared<PointerType>(std::make_shared<PrimitiveType>(" Byte" ));
249249 for (const auto &recordType : structTypesThatShouldBeReplaced) {
250250 std::shared_ptr<TypeDef> recordTypeDef = std::make_shared<TypeDef>(
251- recordType->getTypeAlias (), recordType, nullptr );
251+ recordType->getTypeName (), recordType, nullptr );
252252 std::shared_ptr<Type> pointerToRecord =
253253 std::make_shared<PointerType>(recordTypeDef);
254254 if (*replacementType == *pointerToRecord) {
@@ -330,11 +330,11 @@ bool Struct::findAllCycles(
330330bool Struct::hasBiggestName (const CycleNode &node,
331331 std::vector<std::string> namesInCycle) const {
332332 if (!node.isValueType ) {
333- namesInCycle.push_back (node.s ->getTypeAlias ());
333+ namesInCycle.push_back (node.s ->getTypeName ());
334334 }
335335 if (node.cycleNodes .empty ()) {
336336 std::sort (namesInCycle.begin (), namesInCycle.end ());
337- return getTypeAlias () >= namesInCycle.back ();
337+ return getTypeName () >= namesInCycle.back ();
338338 }
339339 for (const auto &cycleNode : node.cycleNodes ) {
340340 if (hasBiggestName (cycleNode, namesInCycle)) {
0 commit comments