@@ -15,14 +15,14 @@ Struct::Struct(std::string name, std::vector<std::shared_ptr<Field>> fields,
15
15
16
16
std::shared_ptr<TypeDef> Struct::generateTypeDef () {
17
17
if (isRepresentedAsStruct ()) {
18
- return std::make_shared<TypeDef>(getTypeAlias (), shared_from_this (),
18
+ return std::make_shared<TypeDef>(getTypeName (), shared_from_this (),
19
19
nullptr );
20
20
} else {
21
21
// There is no easy way to represent it as a struct in scala native,
22
22
// have to represent it as an array and then Add helpers to help with
23
23
// its manipulation
24
24
return std::make_shared<TypeDef>(
25
- getTypeAlias (),
25
+ getTypeName (),
26
26
std::make_shared<ArrayType>(std::make_shared<PrimitiveType>(" Byte" ),
27
27
typeSize),
28
28
location);
@@ -32,7 +32,7 @@ std::shared_ptr<TypeDef> Struct::generateTypeDef() {
32
32
std::string Struct::generateHelperClass () const {
33
33
assert (hasHelperMethods ());
34
34
std::stringstream s;
35
- std::string type = getTypeAlias ( );
35
+ std::string type = replaceChar ( getTypeName (), " " , " _ " );
36
36
s << " implicit class " << type << " _ops(val p: native.Ptr[" << type
37
37
<< " ])"
38
38
<< " extends AnyVal {\n " ;
@@ -83,7 +83,7 @@ std::string Struct::generateHelperClassMethodsForArrayRepresentation() const {
83
83
return s.str ();
84
84
}
85
85
86
- std::string Struct::getTypeAlias () const { return " struct_ " + name; }
86
+ std::string Struct::getTypeName () const { return " struct " + name; }
87
87
88
88
std::string Struct::str () const {
89
89
std::stringstream ss;
@@ -248,7 +248,7 @@ Struct::getTypeReplacement(std::shared_ptr<const Type> type,
248
248
std::make_shared<PointerType>(std::make_shared<PrimitiveType>(" Byte" ));
249
249
for (const auto &recordType : structTypesThatShouldBeReplaced) {
250
250
std::shared_ptr<TypeDef> recordTypeDef = std::make_shared<TypeDef>(
251
- recordType->getTypeAlias (), recordType, nullptr );
251
+ recordType->getTypeName (), recordType, nullptr );
252
252
std::shared_ptr<Type> pointerToRecord =
253
253
std::make_shared<PointerType>(recordTypeDef);
254
254
if (*replacementType == *pointerToRecord) {
@@ -330,11 +330,11 @@ bool Struct::findAllCycles(
330
330
bool Struct::hasBiggestName (const CycleNode &node,
331
331
std::vector<std::string> namesInCycle) const {
332
332
if (!node.isValueType ) {
333
- namesInCycle.push_back (node.s ->getTypeAlias ());
333
+ namesInCycle.push_back (node.s ->getTypeName ());
334
334
}
335
335
if (node.cycleNodes .empty ()) {
336
336
std::sort (namesInCycle.begin (), namesInCycle.end ());
337
- return getTypeAlias () >= namesInCycle.back ();
337
+ return getTypeName () >= namesInCycle.back ();
338
338
}
339
339
for (const auto &cycleNode : node.cycleNodes ) {
340
340
if (hasBiggestName (cycleNode, namesInCycle)) {
0 commit comments