Browse Source

Fix finding of symbols for members of templates

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1485/head
Dimitar Dobrev 6 years ago
parent
commit
927c2a5c18
  1. 28
      src/Generator/Passes/FindSymbolsPass.cs

28
src/Generator/Passes/FindSymbolsPass.cs

@ -1,4 +1,5 @@
using System.Threading; using System.Linq;
using System.Threading;
using CppSharp.AST; using CppSharp.AST;
namespace CppSharp.Passes namespace CppSharp.Passes
@ -56,19 +57,22 @@ namespace CppSharp.Passes
if (!Options.CheckSymbols || Options.IsCLIGenerator) if (!Options.CheckSymbols || Options.IsCLIGenerator)
return false; return false;
if (decl.IsDependent) var @class = decl.Namespace as Class;
if (@class?.IsDependent == true)
{ {
var @class = decl.Namespace as Class; // Search for a match but always go through all
if (@class != null && @class.IsDependent) switch (decl)
{ {
foreach (var specialization in @class.Specializations) case Method _:
{ return (from specialization in @class.Specializations
var specializedFunction = specialization.Methods.Find( from specializedFunction in specialization.Methods
m => m.InstantiatedFrom == decl); select specializedFunction.InstantiatedFrom == decl &&
if (specializedFunction != null && CheckForSymbol(specializedFunction)).DefaultIfEmpty().Max();
CheckForSymbol(specializedFunction)) case Variable _:
return true; return (from specialization in @class.Specializations
} from specializedVariable in specialization.Variables
select specializedVariable.Name == decl.Name &&
CheckForSymbol(specializedVariable)).DefaultIfEmpty().Max();
} }
} }
return CheckForSymbol(decl); return CheckForSymbol(decl);

Loading…
Cancel
Save