| 469 | } |
| 470 | |
| 471 | void GraphFunction::retypeLocalVariable(boost::string_view name, DataType newType) { |
| 472 | // invalidate the cache |
| 473 | module().updateLastEditTime(); |
| 474 | |
| 475 | std::string qualifiedName = newType.qualifiedName(); |
| 476 | |
| 477 | for (auto& var : mLocalVariables) { |
| 478 | if (var.name == name) { |
| 479 | var.type = std::move(newType); |
| 480 | break; |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | // update existing nodes |
| 485 | auto setNodes = nodesWithType(module().fullName(), "_set_" + name.to_string()); |
| 486 | for (const auto& node : setNodes) { |
| 487 | // create a new node type |
| 488 | std::unique_ptr<NodeType> ty; |
| 489 | |
| 490 | auto res = module().nodeTypeFromName("_set_" + name.to_string(), qualifiedName, &ty); |
| 491 | assert(!!res); |
| 492 | |
| 493 | node->setType(std::move(ty)); |
| 494 | } |
| 495 | |
| 496 | auto getNodes = nodesWithType(module().fullName(), "_get_" + name.to_string()); |
| 497 | for (const auto& node : getNodes) { |
| 498 | // create a new node type |
| 499 | std::unique_ptr<NodeType> ty; |
| 500 | |
| 501 | auto res = module().nodeTypeFromName("_get_" + name.to_string(), qualifiedName, &ty); |
| 502 | assert(!!res); |
| 503 | |
| 504 | node->setType(std::move(ty)); |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | std::vector<NodeInstance*> GraphFunction::setName(boost::string_view newName, |
| 509 | bool updateReferences) { |
no test coverage detected