Skip to content

Commit 680c02e

Browse files
committed
don't emit function result if secret()
1 parent 38c237b commit 680c02e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

dsc_lib/src/parser/expressions.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ impl Expression {
113113
/// This function will return an error if the expression fails to execute.
114114
pub fn invoke(&self, function_dispatcher: &FunctionDispatcher, context: &Context) -> Result<Value, DscError> {
115115
let result = self.function.invoke(function_dispatcher, context)?;
116-
// TODO: check if `secret()` function and don't emit result
117-
let result_json = serde_json::to_string(&result)?;
118-
trace!("{}", t!("parser.expression.functionResult", results = result_json));
116+
// skip trace if function is 'secret()'
117+
if self.function.name() != "secret" {
118+
let result_json = serde_json::to_string(&result)?;
119+
trace!("{}", t!("parser.expression.functionResult", results = result_json));
120+
}
119121
if self.accessors.is_empty() {
120122
Ok(result)
121123
}

dsc_lib/src/parser/functions.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ impl Function {
8686

8787
function_dispatcher.invoke(&self.name, &resolved_args, context)
8888
}
89+
90+
/// Get the name of the function.
91+
pub fn name(&self) -> &str {
92+
&self.name
93+
}
8994
}
9095

9196
fn convert_args_node(statement_bytes: &[u8], args: Option<&Node>) -> Result<Option<Vec<FunctionArg>>, DscError> {

0 commit comments

Comments
 (0)