Ignore:
Timestamp:
Oct 23, 2019 2:44:30 PM (7 weeks ago)
Author:
Jonathan Kämpe
Message:

#5862 Now printing empty array subscripts in order to detect them in tests. Fixed a couple of occurences.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-jk-2597/Compiler/ModelicaMiddleEnd/src/jastadd/scalarization/ScalarizeFunctions.jrag

    r13817 r13822  
    497497                List<FSubscript> subs = new List<FSubscript>();
    498498                subs.add(new FIntegerSubscript(i+1));
    499                 subs.addAll(names.createFArraySubscripts().copyAsFArrayExpSubscripts().getFSubscriptListNoTransform());
     499                if (names.hasNames()) {
     500                    subs.addAll(names.createFArraySubscripts().copyAsFArrayExpSubscripts().getFSubscriptListNoTransform());
     501                }
    500502                left = tempExp(new FArrayExpSubscripts(subs));
    501503                right.createArrayTemporaries(s);
     
    12131215         * Creates a new FArraySubscripts with uses of the <code>d1</code> to <code>d2</code> names
    12141216         * in the top layer as subscripts. When out of names, adds 1s.
     1217         *
     1218         * Returns null if d1 == d2.
    12151219         */
    12161220        public FArrayExpSubscripts createFArraySubscripts(int d1, int d2) {
    1217             if (d1 < 0)
    1218                 throw new UnsupportedOperationException();
     1221            if (d1 == d2) {
     1222                return null;
     1223            }
    12191224            FArrayExpSubscripts fas = new FArrayExpSubscripts();
    12201225            for (int i = d1; i < d2; ++i) {
    1221                 if (i < topLayer().length)
     1226                if (i < topLayer().length) {
    12221227                    fas.addFSubscript(new FExpSubscript(new FTempAccessExp(new FAccessFull(topLayer()[i]))));
    1223                 else
     1228                } else {
    12241229                    fas.addFSubscript(new FIntegerSubscript(1));
     1230                }
    12251231            }
    12261232            return fas;
     
    12301236         * Creates a new FArraySubscripts with uses of the <code>d</code>
    12311237         * first names in the top layer as subscripts. When out of names, adds 1s.
     1238         * Returns null if d == 0.
    12321239         */
    12331240        public FArrayExpSubscripts createFArraySubscripts(int d) {
     
    12371244        /**
    12381245         * Creates a new FArraySubscripts with uses of all the names in the top layer.
     1246         * Returns null if no names available.
    12391247         */
    12401248        public FArrayExpSubscripts createFArraySubscripts() {
Note: See TracChangeset for help on using the changeset viewer.