ThePix / QuestJS

A major re-write of Quest that is written in JavaScript and will run in the browser.
MIT License
66 stars 12 forks source link

Q5 to QJS Convertor: Operator Mistranslations #91

Closed Zanderkat closed 1 year ago

Zanderkat commented 1 year ago

When an if statement includes multiple conditions, an operator is not translated properly after it appears for the first time in that statement. For instance, the following:

if (John.parent = Apartments and Bob.parent = Apartments and Bob.buddy = false and John.buddy = false)

...will become:

if (John.loc === Apartments && Bob.loc = Apartments and Bob.buddy = false and John.buddy = false)

This doesn't seem to happen with the "!==" operator, which seems to translate properly in all of the instances I've seen. All other operators appear to be affected, however.

On a related note that may or may not help with finding the issue, the convertor translates all instances of "&" into "&&", even if they are in something like a comment.

ThePix commented 1 year ago

I think I have fixed this (slightly worried about false positives but should be good). Surprisingly simple to fix.

Zanderkat commented 1 year ago

I haven't found any further issues here but I'll keep an eye out!