Пример #1
0
        public override IAnalysisSet GetDescriptor(Node node, AnalysisValue instance, AnalysisValue context, AnalysisUnit unit)
        {
            if ((instance == ProjectState._noneInst && !IsClassMethod) || IsStatic)
            {
                return(SelfSet);
            }
            if (_methods == null)
            {
                _methods = new Dictionary <AnalysisValue, IAnalysisSet>();
            }

            IAnalysisSet result;

            if (!_methods.TryGetValue(instance, out result) || result == null)
            {
                if (IsClassMethod)
                {
                    _methods[instance] = result = new BoundMethodInfo(this, context).SelfSet;
                }
                else
                {
                    _methods[instance] = result = new BoundMethodInfo(this, instance).SelfSet;
                }
            }

            if (IsProperty)
            {
                return(result.Call(node, unit, ExpressionEvaluator.EmptySets, ExpressionEvaluator.EmptyNames));
            }

            return(result);
        }
Пример #2
0
        public override ISet <Namespace> GetDescriptor(Namespace instance, AnalysisUnit unit)
        {
            if (instance == null || IsStatic)
            {
                return(SelfSet);
            }
            if (IsProperty)
            {
                ReturnValue.AddDependency(unit);
                return(ReturnValue.Types);
            }

            if (_methods == null)
            {
                _methods = new Dictionary <Namespace, ISet <Namespace> >();
            }

            ISet <Namespace> result;

            if (!_methods.TryGetValue(instance, out result) || result == null)
            {
                _methods[instance] = result = new BoundMethodInfo(this, instance).SelfSet;
            }
            return(result);
        }