mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-07 09:55:20 +00:00
tcl: Unset both result.json and result.string only before calling pass
This commit is contained in:
parent
0f7b8b8d23
commit
a43356cb04
|
@ -773,6 +773,7 @@ static int tcl_yosys_cmd(ClientData, Tcl_Interp *interp, int argc, const char *a
|
||||||
}
|
}
|
||||||
|
|
||||||
yosys_get_design()->scratchpad_unset("result.json");
|
yosys_get_design()->scratchpad_unset("result.json");
|
||||||
|
yosys_get_design()->scratchpad_unset("result.string");
|
||||||
|
|
||||||
bool in_repl = yosys_tcl_repl_active;
|
bool in_repl = yosys_tcl_repl_active;
|
||||||
bool restore_log_cmd_error_throw = log_cmd_error_throw;
|
bool restore_log_cmd_error_throw = log_cmd_error_throw;
|
||||||
|
@ -811,12 +812,10 @@ static int tcl_yosys_cmd(ClientData, Tcl_Interp *interp, int argc, const char *a
|
||||||
auto json = json11::Json::parse(result->second, err);
|
auto json = json11::Json::parse(result->second, err);
|
||||||
if (err.empty()) {
|
if (err.empty()) {
|
||||||
Tcl_SetObjResult(interp, json_to_tcl(interp, json));
|
Tcl_SetObjResult(interp, json_to_tcl(interp, json));
|
||||||
scratchpad.erase(result);
|
|
||||||
} else
|
} else
|
||||||
log_warning("Ignoring result.json scratchpad value due to parse error: %s\n", err.c_str());
|
log_warning("Ignoring result.json scratchpad value due to parse error: %s\n", err.c_str());
|
||||||
} else if ((result = scratchpad.find("result.string")) != scratchpad.end()) {
|
} else if ((result = scratchpad.find("result.string")) != scratchpad.end()) {
|
||||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(result->second.data(), result->second.size()));
|
Tcl_SetObjResult(interp, Tcl_NewStringObj(result->second.data(), result->second.size()));
|
||||||
scratchpad.erase(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
|
|
Loading…
Reference in a new issue