/// <summary>
/// Updates the template arguments (symbols and user types).
/// </summary>
/// <param name="factory">The user type factory.</param>
/// <returns><c>true</c> if all template arguments are resolved as user types.</returns>
public bool UpdateTemplateArguments(UserTypeFactory factory)
{
bool result = true;
templateArgumentsAsSymbols = ParseTemplateArguments(factory, Module, Symbol.Namespaces.Last()).ToList();
templateArgumentsAsUserTypes.Clear();
foreach (Symbol symbol in templateArgumentsAsSymbols)
{
// Try to get user type for the symbol
UserType specializationUserType = null;
if (!factory.GetUserType(symbol, out specializationUserType))
{
if (symbol.Tag != CodeTypeTag.Enum && symbol.Tag != CodeTypeTag.Class && symbol.Tag != CodeTypeTag.Structure && symbol.Tag != CodeTypeTag.Union)
{
try
{
var typeString = GetSymbolTypeTree(symbol, factory).GetTypeString();
specializationUserType = new TemplateArgumentUserType(typeString, symbol);
}
catch
{
}
}
}
templateArgumentsAsUserTypes.Add(specializationUserType);
result = result && specializationUserType != null;
}
// Enumerate all template arguments as strings
IEnumerable <Symbol> allTemplateArguments = Enumerable.Empty <Symbol>();
foreach (string symbolName in Symbol.Namespaces)
{
allTemplateArguments = allTemplateArguments.Concat(ParseTemplateArguments(factory, Module, symbolName));
}
AllTemplateArguments = allTemplateArguments.Select(s => s.Name).ToList();
// TODO: Unused types should be removed
return(result);
}