Skip to content

Commit 7facc11

Browse files
committed
2 parents 9689192 + 893791b commit 7facc11

35 files changed

Lines changed: 153 additions & 68 deletions

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
steps:
4848
- name: Lua Install
4949
run: sudo apt-get install lua5.3 luajit
50+
- name: Add Brew to Path (Required since Nov 2022)
51+
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
5052
- name: Glow Install
5153
run: brew install glow
5254
# Checkout master & commit

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 1.11.0
4+
5+
- **[Breaking]** Upgraded TypeScript to 4.9.
6+
- `--tstlVerbose` now prints more resolver output when failing to resolve Lua sources.
7+
- Fixed a bug breaking default exported classes with unicode names
8+
- Relaxed conditions for the always-true warning to false positives.
9+
310
## 1.10.0
411

512
- **[Breaking]** Upgraded TypeScript to 4.8.

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-to-lua",
3-
"version": "1.10.0",
3+
"version": "1.11.1",
44
"description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!",
55
"repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",
66
"homepage": "https://typescripttolua.github.io/",
@@ -53,7 +53,7 @@
5353
"node": ">=16.10.0"
5454
},
5555
"peerDependencies": {
56-
"typescript": "~4.8.2"
56+
"typescript": "~4.9.3"
5757
},
5858
"dependencies": {
5959
"@typescript-to-lua/language-extensions": "1.0.0",
@@ -81,6 +81,6 @@
8181
"prettier": "^2.3.2",
8282
"ts-jest": "^28.0.8",
8383
"ts-node": "^10.9.1",
84-
"typescript": "~4.8.2"
84+
"typescript": "~4.9.3"
8585
}
8686
}

src/LuaAST.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// because we don't create the AST from text
66

77
import * as ts from "typescript";
8-
import { LuaLibFeature } from "./transformation/utils/lualib";
8+
import { LuaLibFeature } from "./LuaLib";
99
import { castArray } from "./utils";
1010

1111
export enum SyntaxKind {
@@ -816,6 +816,7 @@ export function createTableIndexExpression(
816816
}
817817

818818
export type AssignmentLeftHandSideExpression = Identifier | TableIndexExpression;
819+
819820
export function isAssignmentLeftHandSideExpression(node: Node): node is AssignmentLeftHandSideExpression {
820821
return isIdentifier(node) || isTableIndexExpression(node);
821822
}

src/LuaLib.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export enum LuaLibFeature {
5252
MathAtan2 = "MathAtan2",
5353
MathModf = "MathModf",
5454
MathSign = "MathSign",
55-
Modulo50 = "Modulo50",
5655
New = "New",
5756
Number = "Number",
5857
NumberIsFinite = "NumberIsFinite",

src/LuaPrinter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Mapping, SourceMapGenerator, SourceNode } from "source-map";
33
import * as ts from "typescript";
44
import { CompilerOptions, isBundleEnabled, LuaLibImportKind, LuaTarget } from "./CompilerOptions";
55
import * as lua from "./LuaAST";
6-
import { loadInlineLualibFeatures, LuaLibFeature, loadImportedLualibFeatures } from "./LuaLib";
6+
import { loadImportedLualibFeatures, loadInlineLualibFeatures, LuaLibFeature } from "./LuaLib";
77
import { isValidLuaIdentifier, shouldAllowUnicode } from "./transformation/utils/safe-names";
88
import { EmitHost, getEmitPath } from "./transpilation";
99
import { intersperse, normalizeSlashes } from "./utils";
@@ -899,9 +899,9 @@ export class LuaPrinter {
899899
map.addMapping(currentMapping);
900900
}
901901

902-
for (const chunk of sourceNode.children) {
902+
for (const chunk of sourceNode.children as SourceChunk[]) {
903903
if (typeof chunk === "string") {
904-
const lines = (chunk as string).split("\n");
904+
const lines = chunk.split("\n");
905905
if (lines.length > 1) {
906906
generatedLine += lines.length - 1;
907907
generatedColumn = 0;

src/cli/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function updateParsedCommandLine(parsedCommandLine: ts.ParsedCommandLine, args:
147147
if (!args[i].startsWith("-")) continue;
148148

149149
const isShorthand = !args[i].startsWith("--");
150-
const argumentName = args[i].substr(isShorthand ? 1 : 2);
150+
const argumentName = args[i].substring(isShorthand ? 1 : 2);
151151
const option = optionDeclarations.find(option => {
152152
if (option.name.toLowerCase() === argumentName.toLowerCase()) return true;
153153
if (isShorthand && option.aliases) {
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { __TS__SparseArray } from "./SparseArray";
2+
import { __TS__Unpack } from "./Unpack";
23

34
export function __TS__SparseArraySpread<T>(this: void, sparseArray: __TS__SparseArray<T>): LuaMultiReturn<T[]> {
4-
return unpack(sparseArray, 1, sparseArray.sparseLength);
5+
return __TS__Unpack(sparseArray, 1, sparseArray.sparseLength);
56
}

src/lualib/5.0/Unpack.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
export const __TS__Unpack = unpack;
1+
/** @noSelfInFile */
2+
3+
// We're not interested in emulating all of the behaviors of unpack() from Lua
4+
// 5.1, just the ones needed by other parts of lualib.
5+
export function __TS__Unpack<T>(list: T[], i: number, j?: number): LuaMultiReturn<T[]> {
6+
if (i === 1 && j === undefined) {
7+
return unpack(list);
8+
} else {
9+
j ??= list.length;
10+
const slice: T[] = [];
11+
for (let n = i; n <= j; n++) {
12+
slice[n - i] = list[n - 1]; // We don't want to add 1 to the index into list.
13+
}
14+
return $multi(...slice);
15+
}
16+
}

0 commit comments

Comments
 (0)