예제 #1
0
        private IVariable GetCurrentVariable(Document document, int offset)
        {
            DomRegion domRegion;
            var resolveResult = document.GetLanguageItem(offset, out domRegion);
            IVariable element = null;

            if (resolveResult is LocalResolveResult)
            {
                element = ((LocalResolveResult)resolveResult).Variable;
            }
            else if (resolveResult is NamedArgumentResolveResult)
            {
                element = ((NamedArgumentResolveResult)resolveResult).Parameter;
            }

            return element;
        }
예제 #2
0
        private INamedElement GetCurrentElement(Document document, int offset)
        {
            DomRegion domRegion;
            var resolveResult = document.GetLanguageItem(offset, out domRegion);
            INamedElement element = null;

            if (resolveResult is TypeResolveResult)
            {
                element = resolveResult.Type;
            }
            else if (resolveResult is InvocationResolveResult)
            {
                element = ((InvocationResolveResult)resolveResult).Member;
            }
            else if (resolveResult is MemberResolveResult)
            {
                element = ((MemberResolveResult)resolveResult).Member;
            }

            return element;
        }