summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars/src/helpers/block_util.rs
blob: 6971fdd8a46f77df9854b19aed439173be9cfaca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::block::BlockContext;
use crate::json::value::PathAndJson;

pub(crate) fn create_block<'reg: 'rc, 'rc>(
    param: &'rc PathAndJson<'reg, 'rc>,
) -> BlockContext<'reg> {
    let mut block = BlockContext::new();

    if let Some(new_path) = param.context_path() {
        *block.base_path_mut() = new_path.clone();
    } else {
        // use clone for now
        block.set_base_value(param.value().clone());
    }

    block
}