Skip to content

Commit d7bceed

Browse files
author
Alex D
committed
fixes
1 parent 8ff2bdf commit d7bceed

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

spec/variable_declarations.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ describe('Variable Declarations', () => {
9999
'const numLivesForCat = 9; \
100100
const kitty = { \
101101
name: "Aurora", \
102-
numLives: numLivesForCat, \
103-
} \
102+
numLives: numLivesForCat \
103+
}; \
104104
\
105105
kitty.name = "Rory"; \
106106
kitty.name = "Kitty"; \

src/emitterlua.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,7 @@ export class EmitterLua {
743743
if (effectiveLocation.kind !== ts.SyntaxKind.MethodDeclaration
744744
&& effectiveLocation.kind !== ts.SyntaxKind.GetAccessor
745745
&& effectiveLocation.kind !== ts.SyntaxKind.SetAccessor
746-
&& (effectiveLocation.parent.kind === ts.SyntaxKind.SourceFile
747-
|| effectiveLocation.parent.kind === ts.SyntaxKind.NamespaceKeyword))
746+
&& !this.isValueNotRequired(effectiveLocation.parent))
748747
{
749748
this.functionContext.textCode.push(name);
750749
}
@@ -3539,6 +3538,12 @@ export class EmitterLua {
35393538
&& node.parent.kind === ts.SyntaxKind.CallExpression
35403539
&& (<ts.CallExpression>node.parent).expression == node) {
35413540
thisCall = true;
3541+
3542+
const typeInfo = this.typeInfo.getVariableDeclarationOfTypeOfNode(node.expression);
3543+
if (typeInfo && typeInfo.kind === ts.SyntaxKind.ModuleDeclaration)
3544+
{
3545+
thisCall = false;
3546+
}
35423547
}
35433548

35443549
// support __wrapper calls

test/test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
function f() {
2-
var message = "Hello, world!";
3-
return message;
1+
function f() {
2+
var a = 10;
3+
return function g() {
4+
var b = a + 1;
5+
return b;
6+
}
47
}
5-
console.log(f());
8+
9+
var g = f();
10+
console.log(g());

0 commit comments

Comments
 (0)