Skip to content

output cleanup#501

Merged
tomblind merged 14 commits intomasterfrom
output-cleanup
Apr 3, 2019
Merged

output cleanup#501
tomblind merged 14 commits intomasterfrom
output-cleanup

Conversation

@tomblind
Copy link
Copy Markdown
Collaborator

Removed wrapping all binary & unary expressions in parenthesis and fixed issues that arose. Also removed empty string literals from template strings.

I'd like to test this against some real code bases and see how fragile it is.

@tomblind tomblind marked this pull request as ready for review April 1, 2019 19:34
tomblind added 2 commits April 2, 2019 07:29
- using `function foo()` syntax instead of `foo = function()`
  - Exception made for assigned function expressions
- inlining arrow functions with no body
- also stripping empty do...end statements
@tomblind
Copy link
Copy Markdown
Collaborator Author

tomblind commented Apr 2, 2019

Added to this PR:

  • functions are now output as function foo() instead of foo = function(), except for methods which were assigned as function expressions in the original TS
  • arrow functions with no body are inlined
  • arrow functions with no parameters don't include the dummy parameter ____, since it's not necessary
  • empty do...end statements are not generated
  • continue labels are only output if the loop actually has a continue statement

@tomblind
Copy link
Copy Markdown
Collaborator Author

tomblind commented Apr 3, 2019

Last addition to this PR: tables with more than one entry are now formatted into multiple lines.

@tomblind tomblind requested a review from Perryvw April 3, 2019 13:18
@tomblind
Copy link
Copy Markdown
Collaborator Author

tomblind commented Apr 3, 2019

Updated with fixes for feedback

Copy link
Copy Markdown
Member

@Perryvw Perryvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely certain on adding the parentheses inside printFunctionParameters, I personally would have put them in the function header printing. I doubt it really matters though, so approved 👍

@tomblind tomblind merged commit 422a36a into master Apr 3, 2019
@tomblind tomblind deleted the output-cleanup branch April 3, 2019 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants