comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/codewriter/AbstractCodeWriter.java @ 11200:380e0248f873

Truffle-DSL: Fixed a bug in the code writer when a line overflowed with an exact size of 200.
author Christian Humer <christian.humer@gmail.com>
date Mon, 05 Aug 2013 19:48:15 +0200
parents 58f09779319c
children 2b9fcffd6f36
comparison
equal deleted inserted replaced
11199:86af3ced0fce 11200:380e0248f873
659 int size = 0; 659 int size = 0;
660 for (int i = 0; i < string.length(); i += size) { 660 for (int i = 0; i < string.length(); i += size) {
661 if (i != 0) { 661 if (i != 0) {
662 write("+ "); 662 write("+ ");
663 } 663 }
664
664 int nextSize = MAX_LINE_LENGTH - lineLength - 2; 665 int nextSize = MAX_LINE_LENGTH - lineLength - 2;
666 if (nextSize <= 0) {
667 writeLn();
668 nextSize = MAX_LINE_LENGTH - lineLength - 2;
669 }
670
665 int end = Math.min(i + nextSize, string.length()); 671 int end = Math.min(i + nextSize, string.length());
666 672
667 assert lineLength + (end - i) + 2 < MAX_LINE_LENGTH; 673 assert lineLength + (end - i) + 2 < MAX_LINE_LENGTH;
668 write("\"" + string.substring(i, end) + "\""); 674 write("\"" + string.substring(i, end) + "\"");
669 size = nextSize; 675 size = nextSize;