File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,10 @@ export class LuaTransformer {
229229 }
230230 }
231231
232- public transformClassDeclaration ( statement : ts . ClassDeclaration , nameOverride ?: tstl . Identifier ) : tstl . Statement [ ] {
232+ public transformClassDeclaration (
233+ statement : ts . ClassLikeDeclaration ,
234+ nameOverride ?: tstl . Identifier
235+ ) : tstl . Statement [ ] {
233236 let className = statement . name ? this . transformIdentifier ( statement . name ) : nameOverride ;
234237 if ( ! className ) {
235238 throw TSTLErrors . MissingClassName ( statement ) ;
@@ -1496,11 +1499,9 @@ export class LuaTransformer {
14961499 // TODO move to extra function (consistency)
14971500 return undefined ;
14981501 case ts . SyntaxKind . ClassExpression :
1499- /*this.namespace.push("");
1500- const classDeclaration = this.transformClassDeclaration(node as ts.ClassExpression, "_");
1501- this.namespace.pop();
1502- return `(function() ${classDeclaration}; return _ end)()`;*/
1503- throw new Error ( "Not yet implemented" ) ;
1502+ const className = tstl . createIdentifier ( "____" ) ;
1503+ const classDeclaration = this . transformClassDeclaration ( expression as ts . ClassExpression , className ) ;
1504+ return this . createImmediatelyInvokedFunctionExpression ( classDeclaration , className , expression ) ;
15041505 default :
15051506 throw TSTLErrors . UnsupportedKind ( "expression" , expression . kind , expression ) ;
15061507 }
You can’t perform that action at this time.
0 commit comments