private static IType GetQualifierExpressionType([CanBeNull] ICSharpExpression qualifierExpression, [NotNull] ICSharpTreeNode context) { if (qualifierExpression.IsThisOrBaseOrNull()) { var structDeclaration = context.GetContainingTypeDeclaration() as IStructDeclaration; var structTypeElement = structDeclaration?.DeclaredElement; if (structTypeElement == null) { return(null); } return(TypeFactory.CreateType(structTypeElement)); } var expressionType = qualifierExpression.GetExpressionType(); return(expressionType.ToIType()); }
public bool IsUnder(ICSharpTreeNode node) { var store = node.GetSettingsStore(); var customTypes = store.EnumIndexedValues(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes).ToArray(); if (customTypes.IsNullOrEmpty()) { return(false); } var containingFunctionLikeDeclarationOrClosure = node.GetContainingTypeDeclaration(); if (containingFunctionLikeDeclarationOrClosure?.ContainsAttribute(customTypes) == true) { return(true); } return(false); }
public ICSharpTypeDeclaration GetContainingTypeDeclaration() { return(_treeNode.GetContainingTypeDeclaration()); }