typescript-to-lua
Advanced tools
Comparing version 0.21.0 to 0.21.1
# Changelog | ||
## 0.21.0 | ||
- Imports/exports that are ambient (declarations, types, interfaces, etc) or are not used in value positions no longer generate `require` statements. | ||
- For ... of loops are now translated using `ipairs`. | ||
- Added support for `array.reduce`. | ||
- Added support for `import foo = bar.baz;` statements. | ||
- Fixed some issues with binding pattern parameter default values. | ||
- Fixed some issues with variable naming. | ||
- Enabled prettier on the entire codebase. | ||
## 0.20.0 | ||
@@ -4,0 +15,0 @@ |
@@ -52,2 +52,3 @@ import { SourceNode } from "source-map"; | ||
printBinaryExpression(expression: tstl.BinaryExpression): SourceNode; | ||
private canStripParenthesis; | ||
printParenthesizedExpression(expression: tstl.ParenthesizedExpression): SourceNode; | ||
@@ -54,0 +55,0 @@ printCallExpression(expression: tstl.CallExpression): SourceNode; |
@@ -460,4 +460,18 @@ "use strict"; | ||
} | ||
canStripParenthesis(expression) { | ||
return (tstl.isParenthesizedExpression(expression) || | ||
tstl.isTableIndexExpression(expression) || | ||
tstl.isCallExpression(expression) || | ||
tstl.isMethodCallExpression(expression) || | ||
tstl.isIdentifier(expression) || | ||
tstl.isNilLiteral(expression) || | ||
tstl.isNumericLiteral(expression) || | ||
tstl.isBooleanLiteral(expression)); | ||
} | ||
printParenthesizedExpression(expression) { | ||
return this.createSourceNode(expression, ["(", this.printExpression(expression.innerExpression), ")"]); | ||
const innerExpression = this.printExpression(expression.innerExpression); | ||
if (this.canStripParenthesis(expression.innerExpression)) { | ||
return this.createSourceNode(expression, innerExpression); | ||
} | ||
return this.createSourceNode(expression, ["(", innerExpression, ")"]); | ||
} | ||
@@ -464,0 +478,0 @@ printCallExpression(expression) { |
@@ -31,2 +31,3 @@ import * as ts from "typescript"; | ||
isReferencedAliasDeclaration(node: ts.Node, checkChildren?: boolean): boolean; | ||
isTopLevelValueImportEqualsWithEntityName(node: ts.ImportEqualsDeclaration): boolean; | ||
moduleExportsSomeValue(moduleReferenceExpression: ts.Expression): boolean; | ||
@@ -184,6 +185,9 @@ } | ||
private transformIdentifierExpression; | ||
protected isIdentifierExported(identifier: tstl.Identifier): boolean; | ||
protected getSymbolFromIdentifier(identifier: tstl.Identifier): ts.Symbol | undefined; | ||
protected getIdentifierExportScope(identifier: tstl.Identifier): ts.SourceFile | ts.ModuleDeclaration | undefined; | ||
protected isSymbolExported(symbol: ts.Symbol): boolean; | ||
protected isSymbolExportedFromScope(symbol: ts.Symbol, scope: ts.SourceFile | ts.ModuleDeclaration): boolean; | ||
protected addExportToIdentifier(identifier: tstl.Identifier): tstl.AssignmentLeftHandSideExpression; | ||
protected createExportedIdentifier(identifier: tstl.Identifier): tstl.TableIndexExpression; | ||
protected createExportedIdentifier(identifier: tstl.Identifier, exportScope?: ts.SourceFile | ts.ModuleDeclaration): tstl.AssignmentLeftHandSideExpression; | ||
protected getSymbolExportScope(symbol: ts.Symbol): ts.SourceFile | ts.ModuleDeclaration | undefined; | ||
protected transformLuaLibFunction(func: LuaLibFeature, tsParent?: ts.Expression, ...params: tstl.Expression[]): tstl.CallExpression; | ||
@@ -197,3 +201,2 @@ protected checkForLuaLibType(type: ts.Type): void; | ||
protected formatPathToLuaPath(filePath: string): string; | ||
protected shouldExportIdentifier(identifier: tstl.Identifier | tstl.Identifier[]): boolean; | ||
protected createSelfIdentifier(tsOriginal?: ts.Node): tstl.Identifier; | ||
@@ -200,0 +203,0 @@ protected createExportsIdentifier(): tstl.Identifier; |
@@ -14,2 +14,3 @@ import * as ts from "typescript"; | ||
static isStatementExported(statement: ts.Statement): boolean; | ||
static getExportedSymbolDeclaration(symbol: ts.Symbol): ts.Declaration | undefined; | ||
static isDeclaration(node: ts.Node): node is ts.Declaration; | ||
@@ -16,0 +17,0 @@ static isInDestructingAssignment(node: ts.Node): boolean; |
@@ -64,2 +64,9 @@ "use strict"; | ||
} | ||
static getExportedSymbolDeclaration(symbol) { | ||
const declarations = symbol.getDeclarations(); | ||
if (declarations) { | ||
return declarations.find(d => (ts.getCombinedModifierFlags(d) & ts.ModifierFlags.Export) !== 0); | ||
} | ||
return undefined; | ||
} | ||
static isDeclaration(node) { | ||
@@ -66,0 +73,0 @@ return (ts.isEnumDeclaration(node) || |
{ | ||
"name": "typescript-to-lua", | ||
"version": "0.21.0", | ||
"version": "0.21.1", | ||
"description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/TypeScriptToLua/TypeScriptToLua", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
483043
7585