summaryrefslogtreecommitdiff
path: root/tools/Scanner/Generator.lean
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2026-04-05 16:18:40 +0200
committerHannes Schulze <haschu0103@outlook.de>2026-04-05 16:18:40 +0200
commit1a59b19a615483ade6284e554c53f17afabb7287 (patch)
tree52a31ca6594d3e67d1ab0a8aafc2cb4196c3ded2 /tools/Scanner/Generator.lean
parent1f5491a5af7bd0f1ec4046994d6344886465cba5 (diff)
some cleanup
Diffstat (limited to 'tools/Scanner/Generator.lean')
-rw-r--r--tools/Scanner/Generator.lean16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/Scanner/Generator.lean b/tools/Scanner/Generator.lean
index 1ac8139..5884a0d 100644
--- a/tools/Scanner/Generator.lean
+++ b/tools/Scanner/Generator.lean
@@ -61,12 +61,12 @@ private def Generator.runIndex (rootModule : String) (gen : Generator Unit) : St
gen.run.run { rootModule, currentModule := rootModule }
private def resolveInterface (iface : InterfaceRef) (suffix : String := ".Header") : Generator String := do
- emitLocalImport iface.moduleName suffix
- return iface.typeName.pascalCase
+ emitLocalImport iface.protocol suffix
+ return iface.interface.pascalCase
private def resolveEnum (enum : EnumRef) : Generator String := do
let iface ← resolveInterface enum.toInterfaceRef
- return s!"{iface}.{enum.enumName.pascalCase}"
+ return s!"{iface}.{enum.enum.pascalCase}"
section Header
@@ -114,8 +114,8 @@ private def emitEventDefinitions (protocol : ProtocolDesc) : Generator Unit := d
match arg.type with
| .int .none => emitLine s!" ({argName} : Int32)"
| .int (.some enum) => emitLine s!" ({argName} : {← resolveEnum enum})"
- | .uInt .none => emitLine s!" ({argName} : UInt32)"
- | .uInt (.some enum) => emitLine s!" ({argName} : {← resolveEnum enum})"
+ | .uint .none => emitLine s!" ({argName} : UInt32)"
+ | .uint (.some enum) => emitLine s!" ({argName} : {← resolveEnum enum})"
| .fixed => emitLine s!" ({argName} : Float)"
| .string .nullable => emitLine s!" ({argName} : Option String)"
| .string .notNull => emitLine s!" ({argName} : String)"
@@ -140,7 +140,7 @@ private def emitInterfaceInstances (protocol : ProtocolDesc) : Generator Unit :=
let argumentDesc (arg : Raw.ArgumentDesc) : String :=
match arg.type with
| .int => ".int"
- | .uInt => ".uint"
+ | .uint => ".uint"
| .fixed => ".fixed"
| .string => s!".string {nullability arg}"
| .object => s!".object {nullability arg} {interfaceName arg}"
@@ -216,8 +216,8 @@ private def emitRequests (protocol : ProtocolDesc) : Generator Unit := do
match arg.type with
| .int .none => emitLine s!" ({argName} : Int32)"
| .int (.some enum) => emitLine s!" ({argName} : {← resolveEnum enum})"
- | .uInt .none => emitLine s!" ({argName} : UInt32)"
- | .uInt (.some enum) => emitLine s!" ({argName} : {← resolveEnum enum})"
+ | .uint .none => emitLine s!" ({argName} : UInt32)"
+ | .uint (.some enum) => emitLine s!" ({argName} : {← resolveEnum enum})"
| .fixed => emitLine s!" ({argName} : Float)"
| .string .nullable => emitLine s!" ({argName} : Option String)"
| .string .notNull => emitLine s!" ({argName} : String)"