Ejemplo n.º 1
0
        public override bool UnionEquals(Namespace ns)
        {
            SequenceInfo si = ns as SequenceInfo;

            if (si == null)
            {
                return(false);
            }

            return(si._indexTypes.Length == _indexTypes.Length);
        }
Ejemplo n.º 2
0
        private static List <Type>[] GetSequenceTypes(SequenceInfo seq)
        {
            List <Type>[] types = new List <Type> [seq.IndexTypes.Length];
            for (int i = 0; i < types.Length; i++)
            {
                foreach (var seqIndexType in seq.IndexTypes[i])
                {
                    if (seqIndexType is BuiltinClassInfo)
                    {
                        if (types[i] == null)
                        {
                            types[i] = new List <Type>();
                        }

                        types[i].Add(seqIndexType.PythonType.__clrtype__());
                    }
                }
            }
            return(types);
        }
Ejemplo n.º 3
0
        private ISet<Namespace> MakeSequence(ExpressionEvaluator ee, Node node)
        {
            ISet<Namespace> result;
            if (!ee.GlobalScope.NodeVariables.TryGetValue(node, out result)) {
                var seqItems = ((SequenceExpression)node).Items;
                var indexValues = new ISet<Namespace>[seqItems.Count];

                for (int i = 0; i < seqItems.Count; i++) {
                    indexValues[i] = Evaluate(seqItems[i]);
                }

                ISet<Namespace> sequence;
                if (node is ListExpression) {
                    sequence = new ListInfo(indexValues, _unit.ProjectState._listType).SelfSet;
                } else {
                    Debug.Assert(node is TupleExpression);
                    sequence = new SequenceInfo(indexValues, _unit.ProjectState._tupleType).SelfSet;
                }

                ee.GlobalScope.NodeVariables[node] = result = sequence;
            }

            return result;
        }
Ejemplo n.º 4
0
        private static List<Type>[] GetSequenceTypes(SequenceInfo seq)
        {
            List<Type>[] types = new List<Type>[seq.IndexTypes.Length];
            for (int i = 0; i < types.Length; i++) {
                foreach (var seqIndexType in seq.IndexTypes[i]) {
                    if (seqIndexType is BuiltinClassInfo) {
                        if (types[i] == null) {
                            types[i] = new List<Type>();
                        }

                        types[i].Add(seqIndexType.PythonType.__clrtype__());
                    }
                }
            }
            return types;
        }