Merged
Conversation
Perryvw
requested changes
Dec 30, 2018
src/Transpiler.ts
Outdated
| return `[${this.transpileExpression(identifier.expression)}]`; | ||
| } | ||
|
|
||
| if (identifier.text === "Symbol") { |
Member
There was a problem hiding this comment.
This will also trigger on myClass.Symbol = 3, which I don't think is something we want.
Collaborator
Author
There was a problem hiding this comment.
Technically it doesn't break anything - it just pulls in the lib when it isn't needed. But I'll see if we can prevent that somehow.
- luaLibFeatureSet returned to being a Set - added lua lib dependency table - moved lua lib stuff to its own file - fixed logic for importing Symbol lib so it isn't accidentally imported when it shouldn't be - reworked property name transpiling to properly handle numeric/string literals and computed names in all places - updated Map and Set to take a generic Iterable in their constructors
Perryvw
requested changes
Dec 31, 2018
Perryvw
approved these changes
Dec 31, 2018
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.
This adds support for using ES6 Iterables in for...of loops. It also adds a custom decorator 'LuaIterator' to indicate a declared function is actually a proper lua iterator and should be used directly in the transpiled for...in loop.
This feature required a lot of additions and changes:
Something to note about LuaIterator is that it can be combined TupleReturn:
But if a function is declared this way, the variable(s) in the for...of loop MUST be destructured or an error will be thrown:
This is because there is no straight forward way to represent this in lua. A solution could be to wrap the iterator call in another custom lib function that bundles the results, but this is pretty tricky and I suspect most of the time this error will be hit by accident when the intention was to use the destructured version.