-
-
Notifications
You must be signed in to change notification settings - Fork 185
Preceding Statements #1116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Perryvw
merged 52 commits into
TypeScriptToLua:master
from
tomblind:preceding-statements
Nov 20, 2021
Merged
Preceding Statements #1116
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
4c41fc9
working on preceding statements implementation
tomblind 69390bf
fixed issues from tests and started adding new tests (which don't pas…
tomblind c30fa75
fixed issues with short-circuit compound operator expressions
tomblind af010aa
execution order tests
tomblind 8888089
fixes for remaining broken tests
tomblind 4076afd
switch test (currently broken)
tomblind 7f45420
refactor to expression list transformation
tomblind 52714ef
more refactoring and fixes for expression lists
tomblind 306a5b9
refactored object literals a bit
tomblind 6945c7e
refactorings, including removal of old iife stuff
tomblind 70d463b
snapshot updates
tomblind 0bbf30e
cleanup, fixes, and added some original nodes for source maps
tomblind c788432
comment update
tomblind 2b3f517
fixed ifelse statements
tomblind 00d6bdb
more things to fix
tomblind e7ba530
working on fixes to assignments and creating more tests (most of whic…
tomblind d60b6fd
more fixes. more broken things.
tomblind ed8bc68
lots of fixes to call expressions and lots of new broken tests
tomblind 73f179b
Merge branch 'master' into preceding-statements
tomblind 54f61e6
more execution order fixes, more tests
tomblind e579ee2
working on fixes for destructuring exec order
tomblind 175f85a
additional object destructuring test
tomblind a537be9
Merge branch 'master' into preceding-statements
tomblind f16841c
fixes for object destructuring
tomblind 6bd5a6f
fixed switch statements
tomblind 4c154cd
refactored expression list handling
tomblind 895e589
optimized out temps in many situations
tomblind 13c6d1a
fixed execution order of computed property names in object literals
tomblind 65c6131
a little refactoring
tomblind 35771e8
removed bad optimization and refactored call stuff a bit
tomblind 0896dd5
added SparseArray lib functions to handle complex expression lists an…
tomblind c936a05
addPrecedingStatements takes a single argument now
tomblind 92afa7c
a little cleanup
tomblind a7d7b3e
fix for indirect property assignments
tomblind 40c24a8
refactoring to expression-lists
tomblind ccb1c26
fixes and refactors to tests
tomblind 09ae80b
improvements to temp variable naming
tomblind 309f90a
treating temps like consts and more temp name adjustments
tomblind 6aae347
snapshot update
tomblind ca0a27d
a couple of small refactorings
tomblind 8a7d589
refactoring based on comments & suggestions
tomblind b1c56bd
Merge branch 'master' into preceding-statements
tomblind 93923d4
change void expressions to use preceding statements
tomblind d25377a
better comments and variable names for preceding statement handling o…
tomblind 6964927
addressed feedback
tomblind 1f2d638
reverted change that didn't seem necessary
tomblind 738836f
updated transformBinaryOperation to handle preceding statements
tomblind 4264479
reverted switch handling to using lua expressions instead of manufact…
tomblind d8eacdd
constified compound assignment code
tomblind 551e951
renamed createShortCircuitBinaryExpression
tomblind ffd2666
Merge from master
tomblind 3861ec8
Merge branch 'master' into preceding-statements
tomblind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| type __TS__SparseArray<T> = T[] & { sparseLength: number }; | ||
|
|
||
| function __TS__SparseArrayNew<T>(this: void, ...args: T[]): __TS__SparseArray<T> { | ||
| const sparseArray = [...args] as __TS__SparseArray<T>; | ||
| // select("#", ...) counts the number of args passed, including nils. | ||
| // Note that we're depending on vararg optimization to occur here. | ||
| sparseArray.sparseLength = select("#", ...args); | ||
| return sparseArray; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| function __TS__SparseArrayPush<T>(this: void, sparseArray: __TS__SparseArray<T>, ...args: T[]): void { | ||
| const argsLen = select("#", ...args); | ||
| const listLen = sparseArray.sparseLength; | ||
| for (const i of $range(1, argsLen)) { | ||
| sparseArray[listLen + i - 1] = args[i - 1]; | ||
| } | ||
| sparseArray.sparseLength = listLen + argsLen; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| function __TS__SparseArraySpread<T>(this: void, sparseArray: __TS__SparseArray<T>): LuaMultiReturn<T[]> { | ||
| const _unpack = unpack ?? table.unpack; | ||
| return _unpack(sparseArray, 1, sparseArray.sparseLength); | ||
| } |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import * as lua from "../../LuaAST"; | ||
| import { TransformationContext } from "../context"; | ||
|
|
||
| export function transformInPrecedingStatementScope< | ||
| TReturn extends lua.Statement | lua.Statement[] | lua.Expression | lua.Expression[] | ||
| >(context: TransformationContext, transformer: () => TReturn): [lua.Statement[], TReturn] { | ||
| context.pushPrecedingStatements(); | ||
| const statementOrStatements = transformer(); | ||
| const precedingStatements = context.popPrecedingStatements(); | ||
| return [precedingStatements, statementOrStatements]; | ||
| } |
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.