Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
569 changes: 292 additions & 277 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"node": ">=16.10.0"
},
"peerDependencies": {
"typescript": "5.8.2"
"typescript": "5.9.3"
},
"dependencies": {
"@typescript-to-lua/language-extensions": "1.19.0",
Expand All @@ -69,7 +69,7 @@
"prettier": "^2.8.8",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "5.8.2",
"typescript-eslint": "^8.26.0"
"typescript": "5.9.3",
"typescript-eslint": "^8.46.3"
}
}
1 change: 0 additions & 1 deletion src/lualib/SourceMapTraceBack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ interface SourceMap {

declare global {
function __TS__originalTraceback(this: void, thread?: LuaThread, message?: string, level?: number): void;
// eslint-disable-next-line no-var
var __TS__sourcemap: Record<string, SourceMap>;
}

Expand Down
4 changes: 1 addition & 3 deletions src/lualib/StringSplit.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const sub = string.sub;
const find = string.find;
export function __TS__StringSplit(this: void, source: string, separator?: string, limit?: number): string[] {
if (limit === undefined) {
limit = 4294967295;
}
limit ??= 4294967295;

if (limit === 0) {
return [];
Expand Down
9 changes: 3 additions & 6 deletions src/transformation/utils/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ export function markSymbolAsReferencedInCurrentScopes(
identifier: ts.Identifier
): void {
for (const scope of context.scopeStack) {
if (!scope.referencedSymbols) {
scope.referencedSymbols = new Map();
}
scope.referencedSymbols ??= new Map();

const references = getOrUpdate(scope.referencedSymbols, symbolId, () => []);
references.push(identifier);
Expand All @@ -87,9 +85,8 @@ export function findScope(context: TransformationContext, scopeTypes: ScopeType)
}

export function addScopeVariableDeclaration(scope: Scope, declaration: lua.VariableDeclarationStatement) {
if (!scope.variableDeclarations) {
scope.variableDeclarations = [];
}
scope.variableDeclarations ??= [];

scope.variableDeclarations.push(declaration);
}

Expand Down
6 changes: 2 additions & 4 deletions src/transformation/visitors/class/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,8 @@ export const transformSuperExpression: FunctionVisitor<ts.SuperExpression> = (ex
}
}

if (!baseClassName) {
// Use "className.____super" if the base is not a simple identifier
baseClassName = lua.createTableIndexExpression(className, lua.createStringLiteral("____super"), expression);
}
// Use "className.____super" if the base is not a simple identifier
baseClassName ??= lua.createTableIndexExpression(className, lua.createStringLiteral("____super"), expression);

const f = findFirstNodeAbove(expression, ts.isFunctionLike);
if (f && ts.canHaveModifiers(f) && isStaticNode(f)) {
Expand Down
4 changes: 1 addition & 3 deletions src/transformation/visitors/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ export const transformEnumDeclaration: FunctionVisitor<ts.EnumDeclaration> = (no
}
}

if (!valueExpression) {
valueExpression = context.transformExpression(member.initializer);
}
valueExpression ??= context.transformExpression(member.initializer);
} else {
valueExpression = lua.createNilLiteral();
}
Expand Down
4 changes: 1 addition & 3 deletions src/transformation/visitors/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,7 @@ export const transformFunctionDeclaration: FunctionVisitor<ts.FunctionDeclaratio
// Remember symbols referenced in this function for hoisting later
if (name.symbolId !== undefined) {
const scope = peekScope(context);
if (!scope.functionDefinitions) {
scope.functionDefinitions = new Map();
}
scope.functionDefinitions ??= new Map();

const functionInfo = { referencedSymbols: functionScope.referencedSymbols ?? new Map() };
scope.functionDefinitions.set(name.symbolId, functionInfo);
Expand Down
4 changes: 1 addition & 3 deletions src/transformation/visitors/modules/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ function transformImportSpecifier(
export const transformImportDeclaration: FunctionVisitor<ts.ImportDeclaration> = (statement, context) => {
const scope = peekScope(context);

if (!scope.importStatements) {
scope.importStatements = [];
}
scope.importStatements ??= [];

const result: lua.Statement[] = [];
const requireCall = createModuleRequire(context, statement.moduleSpecifier);
Expand Down
Loading