Skip to content

Fix side effects in string index causing issues#868

Merged
Perryvw merged 2 commits intomasterfrom
bugfix/string-index-side-effects
May 11, 2020
Merged

Fix side effects in string index causing issues#868
Perryvw merged 2 commits intomasterfrom
bugfix/string-index-side-effects

Conversation

@Perryvw
Copy link
Copy Markdown
Member

@Perryvw Perryvw commented May 9, 2020

Fixes #867

Comment on lines 40 to 41
const table = context.transformExpression(expression.expression);
return lua.createTableIndexExpression(table, transformElementAccessArgument(context, expression), expression);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That table variable name might be a bit confusing, since you don't necessarily access a property on a table. And in general the variable in this case doesn't seem to be very helpful here

Suggested change
const table = context.transformExpression(expression.expression);
return lua.createTableIndexExpression(table, transformElementAccessArgument(context, expression), expression);
return lua.createTableIndexExpression(
context.transformExpression(expression.expression),
transformElementAccessArgument(context, expression),
expression
);

@Perryvw Perryvw merged commit 00735b7 into master May 11, 2020
@Perryvw Perryvw deleted the bugfix/string-index-side-effects branch May 11, 2020 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indexing on string fails when index is an expression with side effects

2 participants