command: Use new frontend experimentally

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2019-11-15 17:59:42 +00:00
parent eb14cf09f4
commit 9e6770af90

View File

@ -35,7 +35,7 @@
#include <iostream> #include <iostream>
#include "command.h" #include "command.h"
#include "design_utils.h" #include "design_utils.h"
#include "frontend_base.h" #include "json_frontend.h"
#include "jsonparse.h" #include "jsonparse.h"
#include "jsonwrite.h" #include "jsonwrite.h"
#include "log.h" #include "log.h"
@ -266,9 +266,13 @@ int CommandHandler::executeMain(std::unique_ptr<Context> ctx)
if (vm.count("json")) { if (vm.count("json")) {
std::string filename = vm["json"].as<std::string>(); std::string filename = vm["json"].as<std::string>();
std::ifstream f(filename); std::ifstream f(filename);
#ifdef LEGACY_FRONTEND
if (!parse_json_file(f, filename, w.getContext())) if (!parse_json_file(f, filename, w.getContext()))
log_error("Loading design failed.\n"); log_error("Loading design failed.\n");
#else
if (!parse_json(f, filename, w.getContext()))
log_error("Loading design failed.\n");
#endif
customAfterLoad(w.getContext()); customAfterLoad(w.getContext());
w.notifyChangeContext(); w.notifyChangeContext();
w.updateActions(); w.updateActions();
@ -285,8 +289,13 @@ int CommandHandler::executeMain(std::unique_ptr<Context> ctx)
if (vm.count("json")) { if (vm.count("json")) {
std::string filename = vm["json"].as<std::string>(); std::string filename = vm["json"].as<std::string>();
std::ifstream f(filename); std::ifstream f(filename);
#ifdef LEGACY_FRONTEND
if (!parse_json_file(f, filename, ctx.get())) if (!parse_json_file(f, filename, ctx.get()))
log_error("Loading design failed.\n"); log_error("Loading design failed.\n");
#else
if (!parse_json(f, filename, ctx.get()))
log_error("Loading design failed.\n");
#endif
customAfterLoad(ctx.get()); customAfterLoad(ctx.get());
} }