bool TypesystemStructHandler::startCommand(Variant::mapType &args) { scope().setFlag(ParserFlag::POST_HEAD, true); // Fetch the arguments used for creating this type const std::string &structName = args["name"].asString(); const std::string &parent = args["parent"].asString(); // Fetch the current typesystem and create the struct node Rooted<Typesystem> typesystem = scope().selectOrThrow<Typesystem>(); Rooted<StructType> structType = typesystem->createStructType(structName); structType->setLocation(location()); // Try to resolve the parent type and set it as parent structure if (!parent.empty()) { scope().resolve<StructType>( parent, structType, logger(), [](Handle<Node> parent, Handle<Node> structType, Logger &logger) { if (parent != nullptr) { structType.cast<StructType>()->setParentStructure( parent.cast<StructType>(), logger); } }); } scope().push(structType); return true; }