Skip to content

Commit

Permalink
feat: support default value for set (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
Millione authored May 20, 2024
1 parent 87fb28f commit 6accbe5
Show file tree
Hide file tree
Showing 3 changed files with 22,692 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pilota-build/src/middle/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,20 @@ impl Context {

(format! { "::std::vec![{stream}]" }.into(), false)
}
(Literal::List(els), CodegenTy::Set(inner)) => {
let stream = els
.iter()
.map(|el| self.lit_into_ty(el, inner))
.try_collect::<_, Vec<_>, _>()?
.into_iter()
.map(|(s, _)| s)
.join(",");

(
format! { "::pilota::AHashSet::from([{stream}])" }.into(),
false,
)
}
(Literal::Bool(b), CodegenTy::Bool) => (format! { "{b}" }.into(), true),
(Literal::String(s), CodegenTy::Bytes) => {
let s = &**s;
Expand Down
Loading

0 comments on commit 6accbe5

Please sign in to comment.