Files
whetstone_DSL/editor/src/cpp_ir/CppAsyncMappingStrategy.h
Bill 1696b92bb8 Add Sprints 46-59: governance, porting foundation, and language graduation prep (Steps 689-828)
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>
2026-02-22 13:18:10 -07:00

39 lines
1.3 KiB
C++

#pragma once
// Step 714: async mapping strategy.
#include <algorithm>
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
#include "SemanticCoreIR.h"
struct CppAsyncDecision {
std::string nodeId;
std::string runtimeProfile; // coroutine_std, task_runtime
};
class CppAsyncMappingStrategy {
public:
static std::vector<CppAsyncDecision> map(const SemanticCoreIR& ir,
const std::string& profile = "safe-first") {
std::vector<CppAsyncDecision> out;
for (const auto& n : ir.nodes) {
if (n.kind != IRNodeKind::ConcurrencyRegion && n.kind != IRNodeKind::Function) continue;
bool hasAsync = false;
for (const auto& t : n.intentTags) if (t == "async") hasAsync = true;
if (!hasAsync) continue;
out.push_back({n.id, profile == "interop-first" ? "task_runtime" : "coroutine_std"});
}
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<CppAsyncDecision>& d) {
nlohmann::json j = nlohmann::json::array();
for (const auto& x : d) j.push_back({{"nodeId", x.nodeId}, {"runtimeProfile", x.runtimeProfile}});
return j;
}
};