isaacscript 1.2.43 → 1.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json
CHANGED
|
@@ -48,19 +48,15 @@ const plugin: tstl.Plugin = {
|
|
|
48
48
|
// Call the normal TSTL enum transpilation method
|
|
49
49
|
const statements = context.superTransformStatements(node);
|
|
50
50
|
|
|
51
|
-
//
|
|
52
|
-
// local ____exports.Foo = {}
|
|
53
|
-
const name = node.name.escapedText as string;
|
|
54
|
-
const identifier = tstl.createIdentifier(name, node.name);
|
|
55
|
-
const table = tstl.createTableExpression();
|
|
56
|
-
const declaration = tstl.createVariableDeclarationStatement(
|
|
57
|
-
identifier,
|
|
58
|
-
table,
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
// Swap the old first element, which will be equal to:
|
|
51
|
+
// Get the first element, which will be equal to something like:
|
|
62
52
|
// local ____exports.Foo = Foo or ({})
|
|
63
|
-
statements[0]
|
|
53
|
+
const oldDeclaration = statements[0];
|
|
54
|
+
if (tstl.isAssignmentStatement(oldDeclaration)) {
|
|
55
|
+
// Replace the right side of the assignment with a blank Lua table, e.g.
|
|
56
|
+
// local ____exports.Foo = {}
|
|
57
|
+
const blankTable = tstl.createTableExpression();
|
|
58
|
+
oldDeclaration.right = [blankTable];
|
|
59
|
+
}
|
|
64
60
|
|
|
65
61
|
return statements;
|
|
66
62
|
},
|