Sprints 46-58 implement the cross-language porting foundation: language-to-IR adapters, equivalence checking, gate validation, legacy ingestion, managed/dynamic families, low-level/logic-actor semantics, debug workflow tooling, AST-native family tools, Rust/CPP raising tools, system-level orchestration, query family, and porting gates. Sprint 59 adds the governance layer (policy packs, review boards, waiver packets, ambiguity triage, decision ledger) with the whetstone_review_porting_decision MCP tool. Also includes: sprint plans 46-130, MCP taskitem pipeline scripts, CLAUDE.md, docs, and full test matrix (steps 689-828). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
#pragma once
|
|
// Step 712: generics/template raising policy.
|
|
|
|
#include <algorithm>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include "SemanticCoreIR.h"
|
|
|
|
struct CppTemplateDecision {
|
|
std::string nodeId;
|
|
std::string templateForm; // class_template, fn_template, concrete
|
|
bool conceptConstrained = false;
|
|
};
|
|
|
|
class CppTemplateRaisingPolicy {
|
|
public:
|
|
static std::vector<CppTemplateDecision> raise(const SemanticCoreIR& ir,
|
|
const std::string& profile = "safe-first") {
|
|
std::vector<CppTemplateDecision> out;
|
|
for (const auto& n : ir.nodes) {
|
|
if (!n.metadata.contains("genericParams")) continue;
|
|
CppTemplateDecision d;
|
|
d.nodeId = n.id;
|
|
d.templateForm = (n.kind == IRNodeKind::Type) ? "class_template" : "fn_template";
|
|
d.conceptConstrained = profile != "interop-first";
|
|
out.push_back(std::move(d));
|
|
}
|
|
std::sort(out.begin(), out.end(), [](const auto& a, const auto& b){ return a.nodeId < b.nodeId; });
|
|
return out;
|
|
}
|
|
|
|
static nlohmann::json toJson(const std::vector<CppTemplateDecision>& v) {
|
|
nlohmann::json j = nlohmann::json::array();
|
|
for (const auto& d : v) {
|
|
j.push_back({{"nodeId", d.nodeId}, {"templateForm", d.templateForm}, {"conceptConstrained", d.conceptConstrained}});
|
|
}
|
|
return j;
|
|
}
|
|
};
|