Skip to content

Instantly share code, notes, and snippets.

@controlflow
Created December 10, 2019 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save controlflow/e60726e69cab730161b03b346a3d52ba to your computer and use it in GitHub Desktop.
Save controlflow/e60726e69cab730161b03b346a3d52ba to your computer and use it in GitHub Desktop.
public override bool Accepts(IDeclaredElement declaredElement, ISubstitution substitution)
{
switch (declaredElement)
{
case ISymbolAlias symbolAlias:
{
var aliasedSymbol = symbolAlias.GetAliasedSymbol();
if (aliasedSymbol == null) return true;
return Accepts(aliasedSymbol.Element, aliasedSymbol.Substitution);
}
case INamespace _:
return true;
default:
return myPredicate(declaredElement);
}
}
public override bool Accepts(IDeclaredElement declaredElement, ISubstitution substitution)
{
switch (declaredElement)
{
case ISymbolAlias (aliasedSymbol: var (element, subst)):
return Accepts(element, subst);
case ISymbolAlias _:
return true;
case INamespace _:
return true;
default:
return myPredicate(declaredElement);
}
}
public override bool Accepts(IDeclaredElement declaredElement, ISubstitution substitution)
{
return declaredElement switch
{
ISymbolAlias (aliasedSymbol: var (element, subst)) => Accepts(element, subst),
ISymbolAlias _ => true,
INamespace _ => true,
_ => myPredicate(declaredElement)
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment