File tree Expand file tree Collapse file tree
src/backend/llvm/code-generation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ export class ClassDeclarationGenerator implements NodeGenerateInterface<ts.Class
2020
2121 const properties = ctx . typeChecker . getPropertiesOfType ( classType ) ;
2222
23- const struct = llvm . StructType . get ( ctx . llvmContext , properties . map (
23+ const structName = node . name ? < string > node . name . escapedText : 'class_' + Math . random ( ) ;
24+ const struct = llvm . StructType . create ( ctx . llvmContext , structName ) ;
25+
26+ struct . setBody ( properties . map (
2427 ( property : ts . Symbol ) => {
2528 const nativeType = NativeTypeResolver . getType (
2629 ctx . typeChecker . getTypeOfSymbolAtLocation ( property , node ) ,
@@ -31,7 +34,7 @@ export class ClassDeclarationGenerator implements NodeGenerateInterface<ts.Class
3134 }
3235 ) ) ;
3336
34- ctx . scope . classes . set ( node . name ? < string > node . name . escapedText : 'class_' + Math . random ( ) , struct ) ;
37+ ctx . scope . classes . set ( structName , struct ) ;
3538
3639 if ( node . members ) {
3740 node . members . forEach (
You can’t perform that action at this time.
0 commit comments