Skip to content

Commit 24825a1

Browse files
committed
Fix make two expressions collapsed to a single call
1 parent 81bc21d commit 24825a1

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

src/LuaTransformer.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4350,24 +4350,14 @@ export class LuaTransformer {
43504350
case "concat":
43514351
return this.transformLuaLibFunction(LuaLibFeature.StringConcat, node, caller, ...params);
43524352
case "indexOf":
4353-
const stringExpression =
4354-
node.arguments.length === 1
4355-
? this.createStringCall(
4356-
"find",
4357-
node,
4358-
caller,
4359-
params[0],
4360-
tstl.createNilLiteral(),
4361-
tstl.createBooleanLiteral(true)
4362-
)
4363-
: this.createStringCall(
4364-
"find",
4365-
node,
4366-
caller,
4367-
params[0],
4368-
this.expressionPlusOne(params[1]),
4369-
tstl.createBooleanLiteral(true)
4370-
);
4353+
const stringExpression = this.createStringCall(
4354+
"find",
4355+
node,
4356+
caller,
4357+
params[0],
4358+
params[1] ? this.expressionPlusOne(params[1]) : tstl.createNilLiteral(),
4359+
tstl.createBooleanLiteral(true)
4360+
);
43714361

43724362
return tstl.createParenthesizedExpression(
43734363
tstl.createBinaryExpression(

0 commit comments

Comments
 (0)