Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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);
        }
Esempio n. 4
0
 private T ContainingElement <T>() where T : class, ITreeNode
 {
     return(_myReferenceExpression != null
         ? _myReferenceExpression.GetContainingNode <T>()
         : null);
 }