Skip to content

Commit

Permalink
fix: extend builder
Browse files Browse the repository at this point in the history
  • Loading branch information
CertainLach committed Aug 10, 2023
1 parent fd53380 commit 0d47e9f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions crates/jrsonnet-evaluator/src/obj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,19 @@ impl ObjValue {
ObjValueBuilder::with_capacity(capacity)
}
pub(crate) fn extend_with_raw_member(self, key: IStr, value: ObjMember) -> Self {
// let mut new = GcHashMap::with_capacity(1);
// new.insert(key, value);
// Self::new(Some(self), Cc::new(new), Cc::new(Vec::new()))
todo!()
let mut out = ObjValueBuilder::with_capacity(1);
out.with_super(self);
let mut member = out.member(key);
if value.flags.add() {
member = member.add()

Check warning on line 356 in crates/jrsonnet-evaluator/src/obj.rs

View workflow job for this annotation

GitHub Actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting --> crates/jrsonnet-evaluator/src/obj.rs:356:4 | 356 | member = member.add() | ^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `member = member.add();` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned = note: `#[warn(clippy::semicolon_if_nothing_returned)]` implied by `#[warn(clippy::pedantic)]`
}
if let Some(loc) = value.location {
member = member.with_location(loc);
}
let _ = member
.with_visibility(value.flags.visibility())
.binding(value.invoke);
out.build()
}
pub fn extend_field(&mut self, name: IStr) -> ObjMemberBuilder<ExtendBuilder<'_>> {
ObjMemberBuilder::new(ExtendBuilder(self), name, FieldIndex::default())
Expand Down

0 comments on commit 0d47e9f

Please sign in to comment.