LuaIterable language extension#981
Merged
Perryvw merged 10 commits intoTypeScriptToLua:masterfrom Feb 20, 2021
Merged
Conversation
Perryvw
reviewed
Feb 13, 2021
| types: [path.resolve(__dirname, "../../../language-extensions")], | ||
| }; | ||
|
|
||
| const testIterable = ` |
Member
There was a problem hiding this comment.
I get you don't want to repeat youself, but this is not very readable in my opinion. An improvement would be to move every iterable definition you use here closer to the tests that actually use them, maybe it might even be nice to group them with describes
| )("invalid use of LuaIterable (%p)", (statement, code) => { | ||
| util.testFunction` | ||
| ${code} | ||
| ${statement} |
Member
There was a problem hiding this comment.
It is so hard to understand what this test does, wouldn't it be easier to just declare a simple iterator function and call it here instead of the current 3-fold combinations, maybe splitting this up into 3 different tests for the different iterable types.
- LuaIterable type reworked for better lua compatibility - language extensions now checked by brand instead of type alias name - fixed LuaMultiReturn indirect forward, which also affected LuaIterable - reorganized tests and added some for manual iterable usage
…eck both (also added test for property based iterables)
Perryvw
reviewed
Feb 17, 2021
Perryvw
approved these changes
Feb 20, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another language extension for #963.
This one replaces
@luaIteratorwith a new type:LuaIterable. To iterate multiple values, you can useLuaIterable<LuaMultiReturn<T>>(similar to@luaIterator+@tupleReturn).This type can be returned by functions or properties. It can be used in
for...ofloops or manually by calling the returned function (and passing the appropriate state/value variables for iterators which require them).I avoided deprecating
@luaIteratorfor now, since it is heavily depended on by lua-types. Once we are able to update the npm package, this will be deprecated along with@tupleReturn.