Skip to content

Commit 9a31a89

Browse files
fix: Visitor correctly visits Directives, ListType, & ListValue
1 parent 478d2b3 commit 9a31a89

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Sources/GraphQL/Language/AST.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,15 @@ public final class ListValue {
921921
self.loc = loc
922922
self.values = values
923923
}
924+
925+
public func get(key: String) -> NodeResult? {
926+
switch key {
927+
case "values":
928+
return .array(values)
929+
default:
930+
return nil
931+
}
932+
}
924933
}
925934

926935
extension ListValue: Equatable {
@@ -1007,6 +1016,17 @@ public final class Directive {
10071016
self.name = name
10081017
self.arguments = arguments
10091018
}
1019+
1020+
public func get(key: String) -> NodeResult? {
1021+
switch key {
1022+
case "name":
1023+
return .node(name)
1024+
case "arguments":
1025+
return .array(arguments)
1026+
default:
1027+
return nil
1028+
}
1029+
}
10101030
}
10111031

10121032
extension Directive: Equatable {
@@ -1077,6 +1097,15 @@ public final class ListType {
10771097
self.loc = loc
10781098
self.type = type
10791099
}
1100+
1101+
public func get(key: String) -> NodeResult? {
1102+
switch key {
1103+
case "type":
1104+
return .node(type)
1105+
default:
1106+
return nil
1107+
}
1108+
}
10801109
}
10811110

10821111
extension ListType: Equatable {

0 commit comments

Comments
 (0)