git.delta.rocks / jrsonnet / refs/commits / c40e554d3917

difftreelog

fix make std.format not consume field on %%

Лач2020-07-24parent: #40f4374.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-evaluator/src/builtin/format.rsdiffbeforeafterboth
670 Element::Code(c) => {670 Element::Code(c) => {
671 // TODO: Operate on ref671 // TODO: Operate on ref
672 let f: Rc<str> = c.mkey.into();672 let f: Rc<str> = c.mkey.into();
673 if f.is_empty() {
674 throw!(MappingKeysRequired);
675 }
676 let width = match c.width {673 let width = match c.width {
677 Width::Star => {674 Width::Star => {
678 throw!(CannotUseStarWidthWithObject);675 throw!(CannotUseStarWidthWithObject);
687 None => None,684 None => None,
688 };685 };
686
687 let value = if c.convtype == ConvTypeV::Percent {
688 Val::Null
689 } else {
690 if f.is_empty() {
691 throw!(MappingKeysRequired);
692 }
689 let value = if let Some(v) = values.get(f.clone())? {693 let value = if let Some(v) = values.get(f.clone())? {
690 v694 v
691 } else {695 } else {
692 throw!(NoSuchFormatField(f));696 throw!(NoSuchFormatField(f));
693 };697 };
698 value
699 };
694700
695 format_code(&mut out, &value, &c, width, precision)?;701 format_code(&mut out, &value, &c, width, precision)?;
696 }702 }