Skip to content

[WIP] Module rework#22

Merged
Perryvw merged 6 commits intoTypeScriptToLua:masterfrom
lolleko:module-rework
Feb 11, 2018
Merged

[WIP] Module rework#22
Perryvw merged 6 commits intoTypeScriptToLua:masterfrom
lolleko:module-rework

Conversation

@lolleko
Copy link
Copy Markdown
Member

@lolleko lolleko commented Feb 9, 2018

No description provided.

src/TSHelper.ts Outdated
// export statement, we only check for export statements
let hasExport = false;
sourceFile.statements.forEach(statement => {
if (!!(ts.getCombinedModifierFlags(statement) & ts.ModifierFlags.Export)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This !! looks extremely hacky.

src/TSHelper.ts Outdated
// Vanilla ts flags files as external module if they have an import or
// export statement, we only check for export statements
let hasExport = false;
sourceFile.statements.forEach(statement => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably be simplified using sourceFile.statements.some(...


makeExport(name: string | ts.__String, node: ts.Node): string {
let result: string = "";
if (node && node.modifiers && !!(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another !!, hacky


result += this.makeExport(methodName, node);


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many newlines

exports.TestSpace = exports.TestSpace or {}
do
end`
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test with non-empty namespace.

exports.TestSpace = exports.TestSpace or {}
do
end`
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test with (non-empty) class.


const dedent = require('dedent')

export class LuaLoopTests {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loop tests?

@Perryvw Perryvw merged commit 0139c88 into TypeScriptToLua:master Feb 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants