Skip to content

Commit 4ad266c

Browse files
committed
Modify generation to include real file names.
1 parent 12d9264 commit 4ad266c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/generation/base_type_generator.mts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export abstract class BaseTypeGenerator<Type extends RustType> {
4343
* @param type
4444
*/
4545
generate(type: Type) {
46-
const fileContents = this.generateFileContents(type);
46+
const fileName = this.swiftTypeName(type) + '.swift';
47+
const fileContents = this.generateFileContents(type)
48+
.replaceAll('#{swift_class_name}', fileName);
4749
this.persist(type, fileContents);
4850
}
4951

@@ -875,7 +877,7 @@ export abstract class BaseTypeGenerator<Type extends RustType> {
875877
*/
876878
const hasRecursiveOwnershipFlags = this.isRecursivelyPerpetuallySafelyFreeable(returnType.type);
877879

878-
const instantiationContextInfixTemplate = ', instantiationContext: "#{swift_class_name}::\\(#function):\\(#line)"'
880+
const instantiationContextInfixTemplate = ', instantiationContext: "#{swift_class_name}::\\(#function):\\(#line)"';
879881

880882
/**
881883
* The returned object cannot live on its own. It needs the container to stick around.

src/generation/bindings_file_generator.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export default class BindingsFileGenerator extends BaseTypeGenerator<GlobalBindi
2323
// this call is the sole reason we need this inheritance
2424
const swiftMethodName = this.swiftMethodName(currentMethod.method);
2525
const methodCode = this.generateMethod(currentMethod.method);
26-
const renamedMethodCode = methodCode.replace(swiftMethodName, currentMethod.swiftName);
26+
const renamedMethodCode = methodCode
27+
.replace(swiftMethodName, currentMethod.swiftName);
2728
generatedMethods += Generator.reindentCode(renamedMethodCode, 4);
2829
}
2930

0 commit comments

Comments
 (0)