From 1e27e57b1d4f48ad017f0a069ce4e0d751ff7f78 Mon Sep 17 00:00:00 2001 From: Elizabeth Worstell Date: Thu, 28 Sep 2023 16:36:34 -0700 Subject: [PATCH] chore: small naming fixes --- .../xyz/block/ftl/generator/ModuleGenerator.kt | 14 +++++++------- .../xyz/block/ftl/generator/ModuleGeneratorTest.kt | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kotlin-runtime/ftl-generator/src/main/kotlin/xyz/block/ftl/generator/ModuleGenerator.kt b/kotlin-runtime/ftl-generator/src/main/kotlin/xyz/block/ftl/generator/ModuleGenerator.kt index 6fd4585a3f..d8fd539284 100644 --- a/kotlin-runtime/ftl-generator/src/main/kotlin/xyz/block/ftl/generator/ModuleGenerator.kt +++ b/kotlin-runtime/ftl-generator/src/main/kotlin/xyz/block/ftl/generator/ModuleGenerator.kt @@ -41,13 +41,13 @@ class ModuleGenerator() { } } - internal fun generateModule(schema: Module): FileSpec { - val namespace = "ftl.${schema.name}" - val className = schema.name.replaceFirstChar(Char::titlecase) + internal fun generateModule(module: Module): FileSpec { + val namespace = "ftl.${module.name}" + val className = module.name.replaceFirstChar(Char::titlecase) val file = FileSpec.builder(namespace, className) - .addFileComment("Code generated by FTL-Plugin, do not edit.") + .addFileComment("Code generated by FTL-Generator, do not edit.") - schema.comments.let { + module.comments.let { file.addFileComment("\n") file.addFileComment(it.joinToString("\n")) } @@ -58,10 +58,10 @@ class ModuleGenerator() { FunSpec.constructorBuilder().build() ) - val types = schema.decls.mapNotNull { it.data_ } + val types = module.decls.mapNotNull { it.data_ } types.forEach { file.addType(buildDataClass(it)) } - val verbs = schema.decls.mapNotNull { it.verb } + val verbs = module.decls.mapNotNull { it.verb } verbs.forEach { moduleClass.addFunction(buildVerbFunction(className, it)) } file.addType(moduleClass.build()) diff --git a/kotlin-runtime/ftl-generator/src/test/kotlin/xyz/block/ftl/generator/ModuleGeneratorTest.kt b/kotlin-runtime/ftl-generator/src/test/kotlin/xyz/block/ftl/generator/ModuleGeneratorTest.kt index 4277a5c0a5..bd7475f25c 100644 --- a/kotlin-runtime/ftl-generator/src/test/kotlin/xyz/block/ftl/generator/ModuleGeneratorTest.kt +++ b/kotlin-runtime/ftl-generator/src/test/kotlin/xyz/block/ftl/generator/ModuleGeneratorTest.kt @@ -32,7 +32,7 @@ class ModuleGeneratorTest { @Test fun `should generate basic module`() { val file = generator.generateModule(Module(name = "test")) - val expected = """// Code generated by FTL-Plugin, do not edit. + val expected = """// Code generated by FTL-Generator, do not edit. // package ftl.test @@ -83,7 +83,7 @@ public class Test() val module = Module(name = "test", comments = listOf("Module comments"), decls = decls) val file = generator.generateModule(module) - val expected = """// Code generated by FTL-Plugin, do not edit. + val expected = """// Code generated by FTL-Generator, do not edit. // Module comments package ftl.test @@ -156,7 +156,7 @@ public class Test() ) val module = Module(name = "test", comments = listOf("Module comments"), decls = decls) val file = generator.generateModule(module) - val expected = """// Code generated by FTL-Plugin, do not edit. + val expected = """// Code generated by FTL-Generator, do not edit. // Module comments package ftl.test