(&mut self, stream_iter: &mut I)
| 495 | } |
| 496 | |
| 497 | fn build_let<I>(&mut self, stream_iter: &mut I) -> Result<MirRelationExpr, String> |
| 498 | where |
| 499 | I: Iterator<Item = TokenTree>, |
| 500 | { |
| 501 | let name = match stream_iter.next() { |
| 502 | Some(TokenTree::Ident(ident)) => Ok(ident.to_string()), |
| 503 | invalid_token => Err(format!( |
| 504 | "Invalid let specification {:?}", |
| 505 | invalid_token.map(|token_tree| format!("`{}`", token_tree)) |
| 506 | )), |
| 507 | }?; |
| 508 | |
| 509 | let value: MirRelationExpr = deserialize(stream_iter, "MirRelationExpr", self)?; |
| 510 | |
| 511 | let (id, prev) = self.scope.insert(&name, value.typ()); |
| 512 | |
| 513 | let body: MirRelationExpr = deserialize(stream_iter, "MirRelationExpr", self)?; |
| 514 | |
| 515 | if let Some((old_id, old_val)) = prev { |
| 516 | self.scope.set(&name, old_id, old_val); |
| 517 | } else { |
| 518 | self.scope.remove(&name) |
| 519 | } |
| 520 | |
| 521 | Ok(MirRelationExpr::Let { |
| 522 | id, |
| 523 | value: Box::new(value), |
| 524 | body: Box::new(body), |
| 525 | }) |
| 526 | } |
| 527 | |
| 528 | fn build_union<I>(&mut self, stream_iter: &mut I) -> Result<MirRelationExpr, String> |
| 529 | where |
no test coverage detected