示例#1
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);
        }
示例#2
0
        public override ISet <Namespace> GetEnumeratorTypes(Node node, AnalysisUnit unit)
        {
            ReturnValue.AddDependency(unit);

            // TODO: This should be a union of the index types
            if (_indexTypes.Length == 0)
            {
                return(EmptySet <Namespace> .Instance);
            }

            return(_indexTypes[0]);
        }
示例#3
0
        private void AddCall(Node node, string[] keywordArgNames, AnalysisUnit unit, ISet <Namespace>[] args)
        {
            ReturnValue.AddDependency(unit);

            if (ParameterTypes != null)
            {
                bool added = false;

                // TODO: Warn when a keyword argument is provided and it maps to
                // something which is also a positional argument:
                // def f(a, b, c):
                //    print a, b, c
                //
                // f(2, 3, a=42)

                if (PropagateCall(node, keywordArgNames, unit, args, added))
                {
                    // new inputs to the function, it needs to be analyzed.
                    _analysisUnit.Enqueue();
                }
            }
        }