| 307 | } |
| 308 | |
| 309 | void PythonGenerator::makeConstTemplateData() |
| 310 | { |
| 311 | Log::info("Constant globals:\n"); |
| 312 | data_list consts; |
| 313 | for (auto it : m_globals->getSymbolsOfType(Symbol::symbol_type_t::kConstSymbol)) |
| 314 | { |
| 315 | ConstType *constVar = dynamic_cast<ConstType *>(it); |
| 316 | assert(constVar); |
| 317 | data_map constInfo; |
| 318 | if (!findAnnotation(constVar, EXTERNAL_ANNOTATION)) |
| 319 | { |
| 320 | constInfo["name"] = getOutputName(constVar); |
| 321 | |
| 322 | // throw nullptr exception |
| 323 | if (NULL == constVar->getValue()) |
| 324 | { |
| 325 | Log::info("const pointing to null Value object\n"); |
| 326 | } |
| 327 | if (kStringValue == constVar->getValue()->getType()) |
| 328 | { |
| 329 | constInfo["value"] = "\"" + constVar->getValue()->toString() + "\""; |
| 330 | } |
| 331 | else |
| 332 | { |
| 333 | constInfo["value"] = constVar->getValue()->toString(); |
| 334 | } |
| 335 | setTemplateComments(constVar, constInfo); |
| 336 | Log::info("Name=%s\tType=%s\tValue=%s\n", constVar->getName().c_str(), |
| 337 | constVar->getDataType()->getName().c_str(), constVar->getValue()->toString().c_str()); |
| 338 | consts.push_back(constInfo); |
| 339 | } |
| 340 | } |
| 341 | m_templateData["consts"] = consts; |
| 342 | } |
| 343 | |
| 344 | void PythonGenerator::makeEnumsTemplateData() |
| 345 | { |
nothing calls this directly
no test coverage detected