Skip to content

Commit

Permalink
add _context in _metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
amerelo committed Jun 21, 2022
1 parent 2a8e3ba commit a0c78f2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions csml_interpreter/src/interpreter/variable_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,19 @@ pub fn get_var(
let path = resolve_path(path, dis_warnings, data, msg_data, sender)?;
get_literal_from_metadata(&path, dis_warnings, data, msg_data, sender)
}
None => Ok(PrimitiveObject::get_literal(
&data.context.metadata,
interval.to_owned(),
)),
None => {
let mut metadata = data.context.metadata.clone();
let context_values = get_flow_context(data, interval.to_owned());
let mut context = HashMap::new();
context.insert(
"_context".to_owned(),
PrimitiveObject::get_literal(&context_values, interval.to_owned()),
);

metadata.extend(context);

Ok(PrimitiveObject::get_literal(&metadata, interval.to_owned()))
}
},
name if name == _MEMORY => {
let memory: HashMap<String, Literal> = data.get_all_memories();
Expand Down

0 comments on commit a0c78f2

Please sign in to comment.