Exemple #1
0
        private IResMemberLineDecl FindMemberImpl(IResMemberSpec memberSpec)
        {
            var memberLine = FindDirectMember(memberSpec);

            if (memberLine != null)
            {
                return(memberLine);
            }

            var memberLines = (from b in _directBases.Value
                               let ml = b.FindMember(memberSpec)
                                        where ml != null
                                        select ml).Distinct().ToArray();

            if (memberLines.Length == 0)
            {
                return(null);
            }
            if (memberLines.Length > 1)
            {
                throw new NotImplementedException();
            }

            return(memberLines[0]);
        }
Exemple #2
0
        private IResMemberLineDecl FindDirectMember(IResMemberSpec memberSpec)
        {
            IResMemberNameGroup mng = null;

            CachedMemberNameGroups.TryGetValue(memberSpec.Name, out mng);
            if (mng == null)
            {
                return(null);
            }

            var mcg = mng.FindCategoryGroup(memberSpec.Decl.Line.Category);

            if (mcg == null)
            {
                return(null);
            }

            foreach (var ml in mcg.Lines)
            {
                if (ml.OriginalLexicalID == memberSpec.Decl.Line.OriginalLexicalID)
                {
                    return(ml);
                }
            }

            return(null);
        }
Exemple #3
0
        public IResMemberLineSpec FindMember(IResMemberSpec memberSpec)
        {
            var memberDecl = this.Decl.FindMember(memberSpec);

            if (memberDecl == null)
            {
                throw new NotImplementedException();
            }

            return(new ResMemberLineSpec(this, memberDecl));
        }
Exemple #4
0
        public IResMemberLineDecl FindMember(IResMemberSpec memberSpec)
        {
            var key = new MemberSpecDesc
            {
                Name              = memberSpec.Name,
                Category          = memberSpec.Decl.Line.Category,
                OriginalLexicalID = memberSpec.Decl.Line.OriginalLexicalID
            };

            return(_memberCache.Cache(key,
                                      () => FindMemberImpl(memberSpec)));
        }
        public static IResMemberLineDecl FindMember(
            this IResSimpleContainerDecl container,
            IResMemberSpec memberSpec)
        {
            var mng = container.LookupMemberNameGroup(memberSpec.Name);
            if (mng == null)
                throw new KeyNotFoundException();

            foreach (var mcg in mng.Categories)
                foreach (var line in mcg.Lines)
                    if (line.OriginalLexicalID == memberSpec.Decl.Line.OriginalLexicalID)
                        return line;

            throw new KeyNotFoundException();
        }
        public ResMemberBind(
            SourceRange range,
            IResExp obj,
            IResMemberSpec memberSpec)
        {
            _range = range;
            _obj = obj;
            _memberSpec = memberSpec;

            _subst = new Substitution( memberSpec.Container.MemberTerm.Subst );
            // \todo: Need to ensure "obj" is clone-able...
            // \todo: Need to iteratively re-subst...
            _subst.Insert(
                memberSpec.Container.ThisParameter,
                (r) => obj);
        }
Exemple #7
0
        public ResMemberBind(
            SourceRange range,
            IResExp obj,
            IResMemberSpec memberSpec)
        {
            _range      = range;
            _obj        = obj;
            _memberSpec = memberSpec;

            _subst = new Substitution(memberSpec.Container.MemberTerm.Subst);
            // \todo: Need to ensure "obj" is clone-able...
            // \todo: Need to iteratively re-subst...
            _subst.Insert(
                memberSpec.Container.ThisParameter,
                (r) => obj);
        }
Exemple #8
0
        public static IResMemberLineDecl FindMember(
            this IResSimpleContainerDecl container,
            IResMemberSpec memberSpec)
        {
            var mng = container.LookupMemberNameGroup(memberSpec.Name);

            if (mng == null)
            {
                throw new KeyNotFoundException();
            }

            foreach (var mcg in mng.Categories)
            {
                foreach (var line in mcg.Lines)
                {
                    if (line.OriginalLexicalID == memberSpec.Decl.Line.OriginalLexicalID)
                    {
                        return(line);
                    }
                }
            }

            throw new KeyNotFoundException();
        }
Exemple #9
0
 IResMemberLineSpec IResContainerRef.FindMember(IResMemberSpec memberSpec)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
        public IResMemberLineDecl FindMember(IResMemberSpec memberSpec)
        {
            var facet = FindFacetForBase(memberSpec.Container);

            return(facet.FindMember(memberSpec));
        }
Exemple #11
0
        public IResMemberLineSpec FindMember(IResMemberSpec memberSpec)
        {
            var memberLine = this.Decl.FindMember(memberSpec);

            return(new ResMemberLineSpec(this, memberLine));
        }