Skip to content

Commit f2ffccc

Browse files
committed
Remove options argument from LuaTransformer
1 parent 946f16a commit f2ffccc

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/LuaTransformer.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ export class LuaTransformer {
4343
"not", "or", "repeat", "return", "self", "then", "until", "while",
4444
]);
4545

46-
private isStrict = true;
46+
private isStrict: boolean;
4747
private luaTarget: LuaTarget;
4848

4949
private checker: ts.TypeChecker;
5050
protected options: CompilerOptions;
51-
protected program: ts.Program;
5251

5352
private isModule = false;
5453

@@ -69,17 +68,16 @@ export class LuaTransformer {
6968

7069
private readonly typeValidationCache: Map<ts.Type, Set<ts.Type>> = new Map<ts.Type, Set<ts.Type>>();
7170

72-
public constructor(program: ts.Program, options: CompilerOptions) {
71+
public constructor(protected program: ts.Program) {
7372
this.checker = program.getTypeChecker();
74-
this.options = options;
75-
this.program = program;
73+
this.options = program.getCompilerOptions();
7674
this.isStrict = this.options.alwaysStrict !== undefined
7775
|| (this.options.strict !== undefined && this.options.alwaysStrict !== false)
7876
|| (this.isModule
7977
&& this.options.target !== undefined
8078
&& this.options.target >= ts.ScriptTarget.ES2015);
8179

82-
this.luaTarget = options.luaTarget || LuaTarget.LuaJIT;
80+
this.luaTarget = this.options.luaTarget || LuaTarget.LuaJIT;
8381

8482
this.setupState();
8583
}

test/util.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,8 @@ export function executeLua(luaStr: string, withLib = true): any {
9393
}
9494

9595
// Get a mock transformer to use for testing
96-
export function makeTestTransformer(
97-
target: tstl.LuaTarget = tstl.LuaTarget.Lua53,
98-
): tstl.LuaTransformer {
99-
const options = { luaTarget: target };
100-
return new tstl.LuaTransformer(ts.createProgram([], options), options);
96+
export function makeTestTransformer(luaTarget = tstl.LuaTarget.Lua53): tstl.LuaTransformer {
97+
return new tstl.LuaTransformer(ts.createProgram([], { luaTarget }));
10198
}
10299

103100
export function transpileAndExecute(

0 commit comments

Comments
 (0)