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); }
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); }
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); }
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); }
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); }
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); }
private IAnalysisSet DictionaryPop(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) { _keysAndValues.AddDependency(unit); return(_keysAndValues.AllValueTypes); }
protected override IAnalysisSet IteratorNext(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) { return(_iterable.UnionType); }
protected override IAnalysisSet IteratorNext(Node node, Analysis.AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) { return(_indexTypes.GetTypesNoCopy(unit, DeclaringModule)); }
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); }