Browse Source

Fixed the TypeCompletionChecker pass to not walk recursively through all the types as that can lead to some wrong ignore behavior.

pull/1/head
triton 12 years ago
parent
commit
d73b631115
  1. 54
      src/Generator/Types/Types.cs

54
src/Generator/Types/Types.cs

@ -9,6 +9,12 @@ namespace CppSharp @@ -9,6 +9,12 @@ namespace CppSharp
/// </summary>
public class TypeCompletionChecker : AstVisitor
{
public TypeCompletionChecker()
{
Options.VisitClassBases = false;
Options.VisitTemplateArguments = false;
}
public override bool VisitDeclaration(Declaration decl)
{
if (decl.CompleteDeclaration != null)
@ -16,39 +22,6 @@ namespace CppSharp @@ -16,39 +22,6 @@ namespace CppSharp
return !decl.IsIncomplete;
}
public override bool VisitBuiltinType(BuiltinType builtin, TypeQualifiers quals)
{
return true;
}
public override bool VisitFunctionType(FunctionType function, TypeQualifiers quals)
{
if (!function.ReturnType.Visit(this))
return false;
foreach (var arg in function.Parameters)
{
if (!arg.Type.Visit(this))
return false;
}
return true;
}
public override bool VisitFunctionDecl(Function function)
{
if (!function.ReturnType.Type.Visit(this, function.ReturnType.Qualifiers))
return false;
foreach (var param in function.Parameters)
{
if (!param.Visit(this))
return false;
}
return true;
}
}
/// <summary>
@ -62,7 +35,8 @@ namespace CppSharp @@ -62,7 +35,8 @@ namespace CppSharp
public TypeIgnoreChecker(ITypeMapDatabase database)
{
TypeMapDatabase = database;
IsIgnored = false;
Options.VisitClassBases = false;
Options.VisitTemplateArguments = false;
}
void Ignore()
@ -88,6 +62,12 @@ namespace CppSharp @@ -88,6 +62,12 @@ namespace CppSharp
return true;
}
public override bool VisitClassDecl(Class @class)
{
VisitDeclaration(@class);
return false;
}
public override bool VisitTypedefType(TypedefType typedef,
TypeQualifiers quals)
{
@ -121,10 +101,10 @@ namespace CppSharp @@ -121,10 +101,10 @@ namespace CppSharp
var decl = template.Template.TemplatedDecl;
TypeMap typeMap;
if (TypeMapDatabase.FindTypeMap(decl, out typeMap)
&& typeMap.IsIgnored)
if (TypeMapDatabase.FindTypeMap(decl, out typeMap))
{
Ignore();
if (typeMap.IsIgnored)
Ignore();
return false;
}

Loading…
Cancel
Save