Skip to content

allowing all strings to be thrown, not just literals - #244

Merged
Perryvw merged 2 commits into
TypeScriptToLua:masterfrom
tomblind:throw_fix
Oct 16, 2018
Merged

allowing all strings to be thrown, not just literals#244
Perryvw merged 2 commits into
TypeScriptToLua:masterfrom
tomblind:throw_fix

Conversation

@tomblind

Copy link
Copy Markdown
Collaborator

This PR enables other strings, such as template strings, to be thrown. It also fixes indentation on the transpiled code.

Comment thread src/Transpiler.ts Outdated
return this.transpileTry(node as ts.TryStatement);
case ts.SyntaxKind.ThrowStatement:
return this.transpileThrow(node as ts.ThrowStatement);
return this.indent + this.transpileThrow(node as ts.ThrowStatement) + "\n";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should there be a ; after this line?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's not strictly necessary since error() would stop execution before anything after it tried to execute. But it might be good just for consistency.

@Perryvw
Perryvw merged commit e08753a into TypeScriptToLua:master Oct 16, 2018
@tomblind
tomblind deleted the throw_fix branch October 18, 2018 17:00
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.

3 participants