Skip to content

Commit 4bc488d

Browse files
committed
Unsupported for target error message now correctly formats LuaJIT
1 parent b8eee68 commit 4bc488d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/TSTLErrors.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as ts from "typescript";
22
import { TranspileError } from "./TranspileError";
3-
import { TSHelper as tsHelper } from "./TSHelper";
3+
import { LuaTarget } from "./CompilerOptions";
4+
5+
const getLuaTargetName = (version: LuaTarget) =>
6+
version === LuaTarget.LuaJIT ? "LuaJIT" : `Lua ${version}`;
47

58
export class TSTLErrors {
69
public static CouldNotCast = (castName: string) =>
@@ -120,8 +123,8 @@ export class TSTLErrors {
120123
public static UnsupportedProperty = (parentName: string, property: string, node: ts.Node) =>
121124
new TranspileError(`Unsupported property on ${parentName}: ${property}`, node);
122125

123-
public static UnsupportedForTarget = (functionality: string, version: string, node: ts.Node) =>
124-
new TranspileError(`${functionality} is/are not supported for target Lua ${version}.`, node);
126+
public static UnsupportedForTarget = (functionality: string, version: LuaTarget, node: ts.Node) =>
127+
new TranspileError(`${functionality} is/are not supported for target ${getLuaTargetName(version)}.`, node);
125128

126129
public static UnsupportedFunctionWithoutBody = (node: ts.FunctionLikeDeclaration) =>
127130
new TranspileError("Functions with undefined bodies are not supported.", node);

0 commit comments

Comments
 (0)