Browse Source

Reworked type map finding to take typedefs in account by desugaring the type one layer at a time and searching for that typemap.

pull/34/merge
triton 12 years ago
parent
commit
362fff872d
  1. 11
      src/Generator/Types/TypeMap.cs

11
src/Generator/Types/TypeMap.cs

@ -131,6 +131,10 @@ namespace CppSharp.Types
} }
public bool FindTypeMap(Type type, out TypeMap typeMap) public bool FindTypeMap(Type type, out TypeMap typeMap)
{
typeMap = null;
while (true)
{ {
var typePrinter = new CppTypePrinter(this); var typePrinter = new CppTypePrinter(this);
var output = type.Visit(typePrinter); var output = type.Visit(typePrinter);
@ -145,7 +149,14 @@ namespace CppSharp.Types
if (FindTypeMap(output, out typeMap)) if (FindTypeMap(output, out typeMap))
return true; return true;
var desugaredType = type.Desugar();
if (desugaredType == type)
return false; return false;
type = desugaredType;
}
return true;
} }
public bool FindTypeMap(string name, out TypeMap typeMap) public bool FindTypeMap(string name, out TypeMap typeMap)

Loading…
Cancel
Save