private IAnalysisSet ObjectNew(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
 {
     if (args.Length >= 1)
     {
         var instance = AnalysisSet.Empty;
         foreach (var n in args[0])
         {
             var bci = n as BuiltinClassInfo;
             var ci  = n as ClassInfo;
             if (bci != null)
             {
                 instance = instance.Union(bci.Instance);
             }
             else if (ci != null)
             {
                 instance = instance.Union(ci.Instance);
             }
             else if (n is LazyValueInfo lv)
             {
                 instance = instance.Union(LazyValueInfo.GetInstance(node, lv));
             }
         }
         return(instance);
     }
     return(ProjectState.ClassInfos[BuiltinTypeId.Object].Instance);
 }
예제 #2
0
        private IAnalysisSet DictionaryIterValues(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
        {
            _keysAndValues.AddDependency(unit);

            if (_valuesIter == null)
            {
                _valuesIter = new SingleIteratorValue(
                    ValuesVariable,
                    unit.ProjectState.ClassInfos[BuiltinTypeId.DictValues],
                    DeclaringModule
                    );
            }
            return(_valuesIter);
        }
 private IAnalysisSet ObjectSetAttr(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
 {
     if (args.Length >= 3)
     {
         foreach (var ii in args[0].Resolve(unit).OfType <InstanceInfo>())
         {
             foreach (var key in args[1].Resolve(unit).GetConstantValueAsString())
             {
                 ii.SetMember(node, unit, key, args[2].Resolve(unit));
             }
         }
     }
     return(AnalysisSet.Empty);
 }
예제 #4
0
        private IAnalysisSet DictionaryIterKeys(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
        {
            _keysAndValues.AddDependency(unit);

            if (_keysIter == null)
            {
                _keysIter = new IteratorInfo(
                    new[] { KeysVariable },
                    unit.ProjectState.ClassInfos[BuiltinTypeId.DictKeys],
                    node
                    );
            }
            return(_keysIter);
        }
예제 #5
0
        private IAnalysisSet DictionaryGet(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
        {
            _keysAndValues.AddDependency(unit);

            if (args.Length == 1)
            {
                return(_keysAndValues.GetValueType(args[0]));
            }
            else if (args.Length >= 2)
            {
                return(_keysAndValues.GetValueType(args[0]).Union(args[1]));
            }

            return(AnalysisSet.Empty);
        }
예제 #6
0
        private IAnalysisSet DictionaryValues(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
        {
            _keysAndValues.AddDependency(unit);

            if (_valuesList == null)
            {
                _valuesList = new ListInfo(
                    new[] { ValuesVariable },
                    unit.ProjectState.ClassInfos[BuiltinTypeId.List],
                    node,
                    unit.ProjectEntry
                    );
            }
            return(_valuesList);
        }
예제 #7
0
        private IAnalysisSet DictionaryUpdate(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
        {
            if (args.Length >= 1)
            {
                foreach (var otherDict in args[0].OfType <DictionaryInfo>())
                {
                    if (!Object.ReferenceEquals(otherDict, this))
                    {
                        _keysAndValues.CopyFrom(otherDict._keysAndValues);
                    }
                }
            }
            // TODO: Process keyword args and add those values to our dictionary, plus a string key

            return(AnalysisSet.Empty);
        }
예제 #8
0
        private IAnalysisSet DictionaryPop(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
        {
            _keysAndValues.AddDependency(unit);

            return(_keysAndValues.AllValueTypes);
        }
예제 #9
0
 protected override IAnalysisSet IteratorNext(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
 {
     return(_iterable.UnionType);
 }
예제 #10
0
 protected override IAnalysisSet IteratorNext(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
 {
     return(_indexTypes.GetTypesNoCopy(unit, DeclaringModule));
 }
예제 #11
0
 protected abstract IAnalysisSet IteratorNext(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames);
 private IAnalysisSet IteratorNext(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames)
 {
     return(UnionType);
 }