Back out "Disallow duplicate fragments when getting program"
@@ -42,29 +42,13 @@ impl Program {
) -> Self {
let mut operations = Vec::new();
let mut fragments = HashMap::default();
- let mut seen_operation_loc = HashMap::new();
for definition in definitions {
match definition {
ExecutableDefinition::Operation(operation) => {
- let loc = operation.name.location;
- let name = operation.name.item;
- if let Some(another) = seen_operation_loc.insert(name, loc) {
- panic!(
- "\nDuplicate operation definitions named {}: \nfirst one: {:?}\nsecond one: {:?}\n",
- name, loc, another
- );
- }
- operations.push(Arc::new(operation)); // Keep the order the operations same as inputs.
+ operations.push(Arc::new(operation));
}
ExecutableDefinition::Fragment(fragment) => {
- let loc = fragment.name.location;
- let name = fragment.name.item;
- if let Some(another) = fragments.insert(name, Arc::new(fragment)) {
- panic!(
- "\nDuplicate fragment definitions named {}: \nfirst one: {:?}\nsecond one: {:?}\n",
- name, loc, &another.name.location
- );
- }
+ fragments.insert(fragment.name.item, Arc::new(fragment));
}
}
}
