public VariableInfo(IReferenceExpression reference) { Node = reference; IsWriteUsage = reference.Parent is IPrefixExpression || reference.Parent is IPostfixExpression || IsAssignment(reference); FunctionLike = reference.GetContainingNode<IJsFunctionLike>(); DeclaredElement = reference.Reference.Resolve().DeclaredElement; }
public VariableInfo(IReferenceExpression reference) { Node = reference; IsWriteUsage = reference.Parent is IPrefixExpression || reference.Parent is IPostfixExpression || IsAssignment(reference); FunctionLike = reference.GetContainingNode <IJsFunctionLike>(); DeclaredElement = reference.Reference.Resolve().DeclaredElement; }
private static ITypeParameter GetTypeParameter([NotNull] FSharpGenericParameter parameter, [CanBeNull] IReferenceExpression referenceOwnerToken = null) { var containingMemberDeclaration = referenceOwnerToken?.GetContainingNode <ITypeMemberDeclaration>(); if (!(containingMemberDeclaration?.DeclaredElement is IFSharpTypeParametersOwner containingMember)) { return(null); } var parameterName = parameter.Name; var typeParameter = containingMember.AllTypeParameters.FirstOrDefault(param => param.ShortName == parameterName); return(typeParameter); }
private T ContainingElement <T>() where T : class, ITreeNode { return(_myReferenceExpression != null ? _myReferenceExpression.GetContainingNode <T>() : null); }