Beispiel #1
0
        public override IAnalysisSet GetIndex(Node node, AnalysisUnit unit, IAnalysisSet index)
        {
            int?constIndex = GetConstantIndex(index);

            if (constIndex != null && constIndex.Value < IndexTypes.Length)
            {
                // TODO: Warn if outside known index and no appends?
                IndexTypes[constIndex.Value].AddDependency(unit);
                return(IndexTypes[constIndex.Value].Types);
            }

            SliceInfo sliceInfo = GetSliceIndex(index);

            if (sliceInfo != null)
            {
                return(this.SelfSet);
            }

            if (IndexTypes.Length == 0)
            {
                IndexTypes = new[] { new VariableDef() };
            }

            IndexTypes[0].AddDependency(unit);

            EnsureUnionType();
            return(UnionType);
        }
Beispiel #2
0
        public override ISet <Namespace> GetIndex(Node node, AnalysisUnit unit, ISet <Namespace> index)
        {
            ReturnValue.AddDependency(unit);
            int?constIndex = GetConstantIndex(index);

            if (constIndex != null && constIndex.Value < _indexTypes.Length)
            {
                // TODO: Warn if outside known index and no appends?
                return(_indexTypes[constIndex.Value]);
            }

            SliceInfo sliceInfo = GetSliceIndex(index);

            if (sliceInfo != null)
            {
                return(this.SelfSet);
            }

            EnsureUnionType();
            return(_unionType);
        }