예제 #1
0
        public ISet <Namespace> GetMemberNoReferences(Node node, AnalysisUnit unit, string name)
        {
            ISet <Namespace> result    = null;
            bool             ownResult = false;
            var v = Scope.GetVariable(node, unit, name);

            if (v != null)
            {
                ownResult = false;
                result    = v.Types;
            }

            // TODO: Need to search MRO, not bases
            foreach (var baseClass in _bases)
            {
                foreach (var baseRef in baseClass)
                {
                    if (baseRef.Push())
                    {
                        try {
                            ClassInfo        klass = baseRef as ClassInfo;
                            ISet <Namespace> baseMembers;
                            if (klass != null)
                            {
                                baseMembers = klass.GetMember(node, unit, name);
                            }
                            else
                            {
                                BuiltinClassInfo builtinClass = baseRef as BuiltinClassInfo;
                                if (builtinClass != null)
                                {
                                    baseMembers = builtinClass.GetMember(node, unit, name);
                                }
                                else
                                {
                                    baseMembers = baseRef.GetMember(node, unit, name);
                                }
                            }

                            AddNewMembers(ref result, ref ownResult, baseMembers);
                        } finally {
                            baseRef.Pop();
                        }
                    }
                }
            }
            return(result ?? EmptySet <Namespace> .Instance);
        }
예제 #2
0
        public override void DeleteMember(Node node, AnalysisUnit unit, string name)
        {
            if (_instanceAttrs == null)
            {
                _instanceAttrs = new Dictionary <string, VariableDef>();
            }

            VariableDef instMember;

            if (!_instanceAttrs.TryGetValue(name, out instMember) || instMember == null)
            {
                _instanceAttrs[name] = instMember = new VariableDef();
            }

            instMember.AddReference(node, unit);

            _classInfo.GetMember(node, unit, name);
        }