Socket
Socket
Sign inDemoInstall

typescript-to-lua

Package Overview
Dependencies
Maintainers
2
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-to-lua - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

4

dist/transformation/visitors/class/members/constructor.js

@@ -7,3 +7,2 @@ "use strict";

const lua_ast_1 = require("../../../utils/lua-ast");
const preceding_statements_1 = require("../../../utils/preceding-statements");
const scope_1 = require("../../../utils/scope");

@@ -34,3 +33,3 @@ const function_1 = require("../../function");

const constructorFieldsDeclarations = statement.parameters.filter(p => p.modifiers !== undefined);
const [fieldsPrecedingStatements, classInstanceFields] = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => (0, fields_1.transformClassInstanceFields)(context, instanceFields));
const classInstanceFields = (0, fields_1.transformClassInstanceFields)(context, instanceFields);
// If there are field initializers and the first statement is a super call,

@@ -60,3 +59,2 @@ // move super call between default assignments and initializers

}
bodyWithFieldInitializers.push(...fieldsPrecedingStatements);
bodyWithFieldInitializers.push(...classInstanceFields);

@@ -63,0 +61,0 @@ bodyWithFieldInitializers.push(...body);

@@ -6,2 +6,3 @@ "use strict";

const lua_ast_1 = require("../../../utils/lua-ast");
const preceding_statements_1 = require("../../../utils/preceding-statements");
const literal_1 = require("../../literal");

@@ -21,10 +22,13 @@ const decorators_1 = require("../decorators");

for (const f of instanceFields) {
// Get identifier
const fieldName = (0, literal_1.transformPropertyName)(context, f.name);
const value = f.initializer ? context.transformExpression(f.initializer) : undefined;
// self[fieldName]
const selfIndex = lua.createTableIndexExpression((0, lua_ast_1.createSelfIdentifier)(), fieldName);
// self[fieldName] = value
const assignClassField = lua.createAssignmentStatement(selfIndex, value, f);
statements.push(assignClassField);
const [precedingStatements, statement] = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => {
// Get identifier
const fieldName = (0, literal_1.transformPropertyName)(context, f.name);
const value = f.initializer ? context.transformExpression(f.initializer) : undefined;
// self[fieldName]
const selfIndex = lua.createTableIndexExpression((0, lua_ast_1.createSelfIdentifier)(), fieldName);
// self[fieldName] = value
const assignClassField = lua.createAssignmentStatement(selfIndex, value, f);
return assignClassField;
});
statements.push(...precedingStatements, statement);
}

@@ -31,0 +35,0 @@ return statements;

{
"name": "typescript-to-lua",
"version": "1.3.2",
"version": "1.3.3",
"description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!",

@@ -5,0 +5,0 @@ "repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc