MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / build_let

Method build_let

src/expr-test-util/src/lib.rs:497–526  ·  view source on GitHub ↗
(&mut self, stream_iter: &mut I)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 7

deserializeFunction · 0.50
nextMethod · 0.45
to_stringMethod · 0.45
insertMethod · 0.45
typMethod · 0.45
setMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected