Skip to content

Commit 5ea71c2

Browse files
committed
Merge remote-tracking branch 'original/master'
2 parents 5f0f599 + 8a0a85d commit 5ea71c2

14 files changed

Lines changed: 112 additions & 19 deletions

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"jest": "^29.5.0",
6666
"jest-circus": "^29.7.0",
6767
"lua-types": "^2.13.0",
68-
"lua-wasm-bindings": "^0.3.1",
68+
"lua-wasm-bindings": "^0.5.3",
6969
"prettier": "^2.8.8",
7070
"ts-jest": "^29.2.5",
7171
"ts-node": "^10.9.2",

src/CompilerOptions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export enum LuaTarget {
6868
Lua52 = "5.2",
6969
Lua53 = "5.3",
7070
Lua54 = "5.4",
71+
Lua55 = "5.5",
7172
LuaJIT = "JIT",
7273
Luau = "Luau",
7374
}

src/transformation/visitors/break-continue.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const transformContinueStatement: FunctionVisitor<ts.ContinueStatement> =
1919
[LuaTarget.Lua52]: LoopContinued.WithGoto,
2020
[LuaTarget.Lua53]: LoopContinued.WithGoto,
2121
[LuaTarget.Lua54]: LoopContinued.WithGoto,
22+
[LuaTarget.Lua55]: LoopContinued.WithGoto,
2223
[LuaTarget.LuaJIT]: LoopContinued.WithGoto,
2324
[LuaTarget.Luau]: LoopContinued.WithContinue,
2425
}[context.luaTarget];

test/cli/parse.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ describe("tsconfig", () => {
247247
["luaTarget", "5.2", { luaTarget: tstl.LuaTarget.Lua52 }],
248248
["luaTarget", "5.3", { luaTarget: tstl.LuaTarget.Lua53 }],
249249
["luaTarget", "5.4", { luaTarget: tstl.LuaTarget.Lua54 }],
250+
["luaTarget", "5.5", { luaTarget: tstl.LuaTarget.Lua55 }],
250251
["luaTarget", "jit", { luaTarget: tstl.LuaTarget.LuaJIT }],
251252
["luaTarget", "luau", { luaTarget: tstl.LuaTarget.Luau }],
252253

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`enum nested in namespace 1`] = `
4+
"A = A or ({})
5+
do
6+
A.TestEnum = A.TestEnum or ({})
7+
A.TestEnum.B = 0
8+
A.TestEnum[A.TestEnum.B] = "B"
9+
A.TestEnum.C = 1
10+
A.TestEnum[A.TestEnum.C] = "C"
11+
end"
12+
`;

test/unit/__snapshots__/expressions.spec.ts.snap

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,77 @@ ____exports.__result = a | b
482482
return ____exports"
483483
`;
484484
485+
exports[`Bitop [5.5] ("~a") 1`] = `
486+
"local ____exports = {}
487+
____exports.__result = ~a
488+
return ____exports"
489+
`;
490+
491+
exports[`Bitop [5.5] ("a&=b") 1`] = `
492+
"local ____exports = {}
493+
a = a & b
494+
____exports.__result = a
495+
return ____exports"
496+
`;
497+
498+
exports[`Bitop [5.5] ("a&b") 1`] = `
499+
"local ____exports = {}
500+
____exports.__result = a & b
501+
return ____exports"
502+
`;
503+
504+
exports[`Bitop [5.5] ("a<<=b") 1`] = `
505+
"local ____exports = {}
506+
a = a << b
507+
____exports.__result = a
508+
return ____exports"
509+
`;
510+
511+
exports[`Bitop [5.5] ("a<<b") 1`] = `
512+
"local ____exports = {}
513+
____exports.__result = a << b
514+
return ____exports"
515+
`;
516+
517+
exports[`Bitop [5.5] ("a>>>=b") 1`] = `
518+
"local ____exports = {}
519+
a = a >> b
520+
____exports.__result = a
521+
return ____exports"
522+
`;
523+
524+
exports[`Bitop [5.5] ("a>>>b") 1`] = `
525+
"local ____exports = {}
526+
____exports.__result = a >> b
527+
return ____exports"
528+
`;
529+
530+
exports[`Bitop [5.5] ("a^=b") 1`] = `
531+
"local ____exports = {}
532+
a = a ~ b
533+
____exports.__result = a
534+
return ____exports"
535+
`;
536+
537+
exports[`Bitop [5.5] ("a^b") 1`] = `
538+
"local ____exports = {}
539+
____exports.__result = a ~ b
540+
return ____exports"
541+
`;
542+
543+
exports[`Bitop [5.5] ("a|=b") 1`] = `
544+
"local ____exports = {}
545+
a = a | b
546+
____exports.__result = a
547+
return ____exports"
548+
`;
549+
550+
exports[`Bitop [5.5] ("a|b") 1`] = `
551+
"local ____exports = {}
552+
____exports.__result = a | b
553+
return ____exports"
554+
`;
555+
485556
exports[`Bitop [JIT] ("~a") 1`] = `
486557
"local ____exports = {}
487558
____exports.__result = bit.bnot(a)

test/unit/builtins/math.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ util.testEachVersion("Math.atan2", () => util.testExpression`Math.atan2(4, 5)`,
9696
[tstl.LuaTarget.Lua52]: builder => builder.tap(expectMathAtan2),
9797
[tstl.LuaTarget.Lua53]: builder => builder.tap(expectMathAtan),
9898
[tstl.LuaTarget.Lua54]: builder => builder.tap(expectMathAtan2),
99+
[tstl.LuaTarget.Lua55]: builder => builder.tap(expectMathAtan2),
99100
[tstl.LuaTarget.Luau]: builder => builder.tap(expectMathAtan2),
100101
});
101102

test/unit/enum.spec.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,9 @@ test("enum nested in namespace", () => {
208208
util.testModule`
209209
namespace A {
210210
export enum TestEnum {
211-
C,
212-
D
211+
B,
212+
C
213213
}
214214
}
215-
`.tap(builder => {
216-
const lua = builder.getMainLuaCodeChunk();
217-
expect(lua).toMatch(
218-
'A = A or ({})\ndo\n A.TestEnum = A.TestEnum or ({})\n A.TestEnum.C = 0\n A.TestEnum[A.TestEnum.C] = "C"\n A.TestEnum.D = 1\n A.TestEnum[A.TestEnum.D] = "D"\nend'
219-
);
220-
});
215+
`.expectLuaToMatchSnapshot();
221216
});

test/unit/expressions.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ test.each(supportedInAll)("Bitop [5.4] (%p)", input => {
9696
.expectLuaToMatchSnapshot();
9797
});
9898

99+
test.each(supportedInAll)("Bitop [5.5] (%p)", input => {
100+
util.testExpression(input)
101+
.setOptions({ luaTarget: tstl.LuaTarget.Lua55, luaLibImport: tstl.LuaLibImportKind.None })
102+
.disableSemanticCheck()
103+
.expectLuaToMatchSnapshot();
104+
});
105+
99106
test.each(unsupportedIn53And54)("Unsupported bitop 5.3 (%p)", input => {
100107
util.testExpression(input)
101108
.setOptions({ luaTarget: tstl.LuaTarget.Lua53, luaLibImport: tstl.LuaLibImportKind.None })

0 commit comments

Comments
 (0)