Fix no self in file check in call visitor#1510
Fix no self in file check in call visitor#1510Z3rio wants to merge 15 commits intoTypeScriptToLua:masterfrom
Conversation
|
Yeah, this perhaps does not seem to be working as it should (considering the failed tests) |
Perryvw
left a comment
There was a problem hiding this comment.
Missing a test verifying this change actually does what is advertised
|
I've added the requested test, although there currently seems to be some issues with the current solution, when importing functions from other files with |
Oh I was just expecting a more complicated version of the test you already had with |
Ah, yeah, I could do that, didn't know that was possible actually. |
* Cleanup code / make more readable * Further readability fix * Fix noSelfInFile check for call visitor * Fix/further rewrite of `isContextualCallExpression` * Further readability improvements * Change back returns in `isContextualCallExpression` * Add testcase for noSelfInFile over noImplicitSelf * Simplify testcase * Improve NoSelfInFile check * Further hasnoselfinfile fix * wrap declaration statement again * Add noSelfInFile check for func declared in other file * Remove accidentally commited debug logs * Rework function call context checking * Add back some caching that was removed in last commit --------- Co-authored-by: Zerio <neoboij@gmail.com>
|
Closing this as superseded by #1519 |
This PR aims to resolve the issue addressed in issue #1387
Also went ahead and made the
isContextualCallExpressionfunction more readable, as the previous one was a bit "hacky" in my opinionCode to reproduce the issue:
You will notice that the first function in the outputted code will include the self parameter, and the second one won't include it. Whereas neither one should have the self parameter, as the file has
noSelfInFileExample output before changes
https://typescripttolua.github.io/play/#code/PQKhAIAEDsHsGUCmAbAZgSWgMQJbMeGMAFDEDGs0AzgC7ioCu0ZAQgJ4BqAhsg4gFzgASogoAnACYAeWmJzQA5gBpwWJmRo5KAPnABecAG9i4U+ABEACxTJY5wQAoAlPt0BGJcQC+AblIVqOkZmfXp1dm5eRABtKxs7AF0-YLIHNyd-Slow5giePgAmQRFxaVl5ZXAHADparjEFKkEuaDZohJc9XRa2XQNjMwtrZFt7Ks73Ty9MwJyyAtCUvKiC2OHRpOIUgrSMoA