From e480d37fd605b0ce75ae587be53b9f8190d2d77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Fri, 5 Jun 2020 15:36:19 +0200 Subject: [PATCH] JSON output: when writing the model after computing pass, use TEF terms for (not derived) external functions (cherry picked from commit 7b9495bb2fb547c04075bdb3d502903a6f8d0af0) --- src/ExprNode.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ExprNode.cc b/src/ExprNode.cc index 89e0117f..4d6db015 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -7646,9 +7646,18 @@ ExternalFunctionNode::writeJsonOutput(ostream &output, return; } - output << datatree.symbol_table.getName(symb_id) << "("; - writeJsonExternalFunctionArguments(output, temporary_terms, tef_terms, isdynamic); - output << ")"; + try + { + int tef_idx = getIndxInTefTerms(symb_id, tef_terms); + output << "TEF_" << tef_idx; + } + catch (UnknownFunctionNameAndArgs &) + { + // When writing the JSON output at parsing pass, we don’t use TEF terms + output << datatree.symbol_table.getName(symb_id) << "("; + writeJsonExternalFunctionArguments(output, temporary_terms, tef_terms, isdynamic); + output << ")"; + } } void -- GitLab