summaryrefslogtreecommitdiff
path: root/tools/Scanner/Processor.lean
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2026-04-06 07:19:48 +0200
committerHannes Schulze <haschu0103@outlook.de>2026-04-06 07:20:06 +0200
commit92da08078a5459ca1089743eb58385e752bdb5fa (patch)
treee1c63ba933610dbee41182c547a4a1f04d95723b /tools/Scanner/Processor.lean
parent578b90344c4e9be44955d4c4779f452c0b8dc036 (diff)
fix generic new_ids
Diffstat (limited to 'tools/Scanner/Processor.lean')
-rw-r--r--tools/Scanner/Processor.lean13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/Scanner/Processor.lean b/tools/Scanner/Processor.lean
index a50767f..fd952a2 100644
--- a/tools/Scanner/Processor.lean
+++ b/tools/Scanner/Processor.lean
@@ -87,14 +87,13 @@ private def processArgument (raw : Raw.ArgumentDesc) : TrackingProcessor Client.
| .string => Client.ArgumentType.string (.ofAllowNull raw.allowNull) |> pure
| .array => Client.ArgumentType.array |> pure
| .fd => Client.ArgumentType.fd |> pure
- | .newID => Client.ArgumentType.object .notNull <$> raw.interface.mapM resolveInterface
+ | .newID => Client.ArgumentType.newID <$> raw.interface.mapM resolveInterface
| .object => Client.ArgumentType.object (.ofAllowNull raw.allowNull) <$> raw.interface.mapM resolveInterface
description := raw.description
}
private def processRequest (raw : Raw.MessageDesc) : TrackingProcessor Client.RequestDesc := do
let newIDArgs := raw.arguments.filter fun arg ↦ arg.type == .newID
- let otherArgs := raw.arguments.filter fun arg ↦ arg.type != .newID
let returnType ←
match newIDArgs with
| #[] => Client.ReturnType.unit |> pure
@@ -107,12 +106,17 @@ private def processRequest (raw : Raw.MessageDesc) : TrackingProcessor Client.Re
isDestructor := raw.type == .destructor
since := raw.since
deprecatedSince := raw.deprecatedSince
- rawArguments := raw.arguments
- arguments := ← otherArgs.mapM processArgument
+ arguments := ← raw.arguments.mapM processArgument
returnType := returnType
}
private def processEvent (raw : Raw.MessageDesc) : TrackingProcessor Client.EventDesc := do
+ let hasInvalidArg := raw.arguments.any fun arg ↦
+ match arg.type, arg.interface with
+ | .newID, .none => true
+ | _, _ => false
+ if hasInvalidArg then
+ throw s!"Event arguments of type new_id must have an interface type specified (in {raw.name})"
return {
name := raw.name
opcode := raw.opcode
@@ -120,7 +124,6 @@ private def processEvent (raw : Raw.MessageDesc) : TrackingProcessor Client.Even
isDestructor := raw.type == .destructor
since := raw.since
deprecatedSince := raw.deprecatedSince
- rawArguments := raw.arguments
arguments := ← raw.arguments.mapM processArgument
}