Skip to content

Commit 21bbfda

Browse files
author
Nicolas Laurent
committed
inline constant variable
1 parent 9a958b5 commit 21bbfda

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/truffleruby/parser/lexer/HeredocTerm.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public int parseString(RubyLexer lexer) {
118118
// TODO what's in lbuf?
119119
do { // iterate on lines, while end marker not found
120120
Rope lbuf = lexer.lexb;
121-
final int p = 0; // TODO inline this
122121
int pend = lexer.lex_pend;
123122

124123
// Adjust pend so that it doesn't cover the final newline, excepted if the line
@@ -142,17 +141,17 @@ public int parseString(RubyLexer lexer) {
142141
// if we are dealing with a squiggly heredoc
143142
if (lexer.getHeredocIndent() > 0) {
144143
// update the indent for the current line
145-
for (int i = 0; p + i < pend && lexer.update_heredoc_indent(lexer.p(p + i)); i++) {
144+
for (int i = 0; i < pend && lexer.update_heredoc_indent(lexer.p(i)); i++) {
146145
}
147146
// reset heredoc_line_indent to 0 (was -1 after we matched the first non-whitespace character)
148147
lexer.setHeredocLineIndent(0);
149148
}
150149

151150
if (str != null) {
152-
str.append(lbuf.getBytes(), p, pend - p);
151+
str.append(lbuf.getBytes(), 0, pend);
153152
} else {
154153
// lazy initialization of string builder
155-
final RopeBuilder builder = RopeBuilder.createRopeBuilder(lbuf.getBytes(), p, pend - p);
154+
final RopeBuilder builder = RopeBuilder.createRopeBuilder(lbuf.getBytes(), 0, pend);
156155
builder.setEncoding(lbuf.getEncoding());
157156
str = builder;
158157
}

0 commit comments

Comments
 (0)