File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ export class TransformHelper {
44 // Helper to create simple lua variable statement;
55 public static createLuaVariableStatement ( identifier : ts . Identifier ,
66 expression ?: ts . Expression ,
7- typeNode ?: ts . TypeNode ) : ts . VariableStatement {
7+ typeNode ?: ts . TypeNode ,
8+ modifiers : ReadonlyArray < ts . Modifier > = [ ] ) : ts . VariableStatement {
89 const declaration = ts . createVariableDeclaration ( identifier , typeNode , expression ) ;
9- const statement = ts . createVariableStatement ( [ ] , ts . createVariableDeclarationList ( [ declaration ] ) ) ;
10+ const statement = ts . createVariableStatement ( modifiers , ts . createVariableDeclarationList ( [ declaration ] ) ) ;
1011 return statement ;
1112 }
1213
Original file line number Diff line number Diff line change @@ -304,6 +304,11 @@ export class LuaTransformer {
304304 return undefined ;
305305 }
306306 public visitVariableStatement ( node : ts . VariableStatement ) : ts . VisitResult < ts . VariableStatement > {
307+ // TODO maybe flag as gglobal/local here somehow?
308+ if ( ! this . isModule && ! this . currentNamespace ) {
309+ return ts . updateVariableStatement (
310+ node , [ ts . createModifier ( ts . SyntaxKind . StaticKeyword ) ] , node . declarationList ) ;
311+ }
307312 return node ;
308313 }
309314 public visitExpressionStatement ( node : ts . ExpressionStatement ) : ts . VisitResult < ts . ExpressionStatement > {
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ fs.copyFileSync(
2323testRunner . outputStream
2424 // this will use alsatian's default output if you remove this
2525 // you'll get TAP or you can add your favourite TAP reporter in it's place
26- // .pipe(TapBark.create().getPipeable())
26+ . pipe ( TapBark . create ( ) . getPipeable ( ) )
2727 // pipe to the console
2828 . pipe ( process . stdout ) ;
2929
You can’t perform that action at this time.
0 commit comments