Skip to content

Commit

Permalink
Fix last patch
Browse files Browse the repository at this point in the history
  • Loading branch information
JimLaskey committed Mar 15, 2024
1 parent 9bea589 commit 8a23522
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ JCExpression bsmCall(Name name, Name bootstrapName, Type type,
syms.noSymbol,
((MethodSymbol)bsm).asHandle(),
indyType,
staticArgValues.toArray(new LoadableConstant[0])
staticArgValues.toArray(LoadableConstant[]::new)
);
JCFieldAccess qualifier = make.Select(make.Type(syms.templateRuntimeType), dynSym.name);
qualifier.sym = dynSym;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,41 +709,37 @@ JCExpression stringTemplate() {
int endPos = stringToken.endPos;
TokenKind kind = stringToken.kind;
String string = token.stringVal();
List<String> literals = List.of(string);
List<String> fragments = List.nil();
List<String> fragments = List.of(string);
List<JCExpression> expressions = List.nil();
nextToken();
if (kind != STRINGLITERAL) {
while (token.kind == STRINGFRAGMENT) {
stringToken = token;
endPos = stringToken.endPos;
string = stringToken.stringVal();
literals = literals.append(string);
fragments = fragments.append(string);
nextToken();
}
String fragment = literals.head;
literals = literals.tail;
while (token.pos < endPos && token.kind != DEFAULT && token.kind != ERROR) {
accept(LBRACE);
JCExpression expression = token.kind == RBRACE ? F.at(pos).Literal(TypeTag.BOT, null)
: term(EXPR);
: term(EXPR);
expressions = expressions.append(expression);
if (token.kind != ERROR) {
accept(RBRACE);
}
}
fragments = fragments.append(fragment);
// clean up remaining expression tokens if error
while (token.pos < endPos && token.kind != DEFAULT) {
nextToken();
}
S.setPrevToken(stringToken);
}
JCExpression t = toP(F.at(pos).StringTemplate(fragments, expressions));
setMode(oldmode);
if (200 < expressions.size()) { // StringConcatFactory.MAX_INDY_CONCAT_ARG_SLOTS
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.TooManyEmbeddedExpressions);
}
JCExpression t = toP(F.at(pos).StringTemplate(fragments, expressions));
setMode(oldmode);
return t;
}

Expand Down

0 comments on commit 8a23522

Please sign in to comment.