-
-
Notifications
You must be signed in to change notification settings - Fork 186
Version split #117
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
Merged
Version split #117
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8388918
Intial Split
lolleko 31c50b3
Redeclared LuaTranspiler as abstract
lolleko 9edd0ea
Moved version specific string functions
lolleko 6b5ae16
Improved error message for string properties
lolleko ae4621d
Changed inheritance & fixed tests
lolleko 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,7 @@ | ||
| import { LuaTranspiler, TranspileError } from "../Transpiler"; | ||
| import { TSHelper as tsHelper } from "../TSHelper"; | ||
|
|
||
| import * as ts from "typescript"; | ||
|
|
||
| export class LuaTranspiler51 extends LuaTranspiler { | ||
| } |
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 @@ | ||
| import { TSHelper as tsHelper } from "../TSHelper"; | ||
| import { LuaTranspiler51 } from "./Transpiler.51"; | ||
|
|
||
| import * as ts from "typescript"; | ||
|
|
||
| export class LuaTranspiler52 extends LuaTranspiler51 { | ||
|
|
||
| } |
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,51 @@ | ||
| import { TranspileError } from "../Transpiler"; | ||
| import { TSHelper as tsHelper } from "../TSHelper"; | ||
| import { LuaTranspiler52 } from "./Transpiler.52"; | ||
|
|
||
| import * as ts from "typescript"; | ||
|
|
||
| export class LuaTranspiler53 extends LuaTranspiler52 { | ||
| public transpileBitOperation(node: ts.BinaryExpression, lhs: string, rhs: string): string { | ||
| switch (node.operatorToken.kind) { | ||
| case ts.SyntaxKind.AmpersandToken: | ||
| return `${lhs}&${rhs}`; | ||
| case ts.SyntaxKind.AmpersandEqualsToken: | ||
| if (tsHelper.hasSetAccessor(node.left, this.checker)) { | ||
| return this.transpileSetAccessor(node.left as ts.PropertyAccessExpression, `${lhs}&${rhs}`); | ||
| } | ||
| return `${lhs}=${lhs}&${rhs}`; | ||
| case ts.SyntaxKind.BarToken: | ||
| return `${lhs}|${rhs}`; | ||
| case ts.SyntaxKind.BarEqualsToken: | ||
| if (tsHelper.hasSetAccessor(node.left, this.checker)) { | ||
| return this.transpileSetAccessor(node.left as ts.PropertyAccessExpression, `${lhs}|${rhs}`); | ||
| } | ||
| return `${lhs}=${lhs}|${rhs}`; | ||
| case ts.SyntaxKind.LessThanLessThanToken: | ||
| return `${lhs}<<${rhs}`; | ||
| case ts.SyntaxKind.LessThanLessThanEqualsToken: | ||
| if (tsHelper.hasSetAccessor(node.left, this.checker)) { | ||
| return this.transpileSetAccessor(node.left as ts.PropertyAccessExpression, `${lhs}<<${rhs}`); | ||
| } | ||
| return `${lhs}=${lhs}<<${rhs}`; | ||
| case ts.SyntaxKind.GreaterThanGreaterThanToken: | ||
| return `${lhs}>>${rhs}`; | ||
| case ts.SyntaxKind.GreaterThanGreaterThanEqualsToken: | ||
| if (tsHelper.hasSetAccessor(node.left, this.checker)) { | ||
| return this.transpileSetAccessor(node.left as ts.PropertyAccessExpression, `${lhs}>>${rhs}`); | ||
| } | ||
| return `${lhs}=${lhs}>>${rhs}`; | ||
| case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: | ||
| throw new TranspileError("Bitwise operator >>> not supported in Lua 5.3", node); | ||
| case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: | ||
| throw new TranspileError("Bitwise operator >>> not supported in Lua 5.3", node); | ||
| } | ||
| } | ||
| public getValidStringProperties(): {[js: string]: string} { | ||
| return { | ||
| fromCharCode: "string.char", | ||
| fromCodePoint: "utf8.char", | ||
| }; | ||
| } | ||
|
|
||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed any more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It prevents the class from being instantiated.