Steps 290-294: Phase 11a — Semanno format, annotation codegen, visitor dispatch (60/60 tests)
Semanno comment format standard (@semanno:type(key=value)) with emitter/parser covering all 67+ annotation types. SemannoAnnotationImpl CRTP mixin provides default visitor implementations for all 56 extended annotation methods across 7 language generators. Virtual inheritance resolves diamond ambiguity between ProjectionGenerator and SemannoAnnotationImpl. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "ast/Type.h"
|
||||
#include "ast/Import.h"
|
||||
#include "ast/Annotation.h"
|
||||
#include "ast/Serialization.h"
|
||||
|
||||
class CrossLanguageProjector {
|
||||
public:
|
||||
@@ -192,6 +193,16 @@ private:
|
||||
return a;
|
||||
}
|
||||
|
||||
// Generic clone: use Serialization roundtrip for all other annotation types
|
||||
if (ct.find("Annotation") != std::string::npos ||
|
||||
ct == "CapabilityRequirement" || ct == "HostCall" ||
|
||||
ct == "ScheduleTask" || ct == "ModuleLoad") {
|
||||
json nodeJson = toJson(anno);
|
||||
nodeJson["id"] = anno->id + "_proj";
|
||||
ASTNode* cloned = fromJson(nodeJson);
|
||||
return cloned;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -535,7 +546,8 @@ private:
|
||||
if (targetLanguage == "rust" || targetLanguage == "cpp" ||
|
||||
targetLanguage == "java" || targetLanguage == "javascript" ||
|
||||
targetLanguage == "typescript" || targetLanguage == "python" ||
|
||||
targetLanguage == "elisp") {
|
||||
targetLanguage == "elisp" || targetLanguage == "kotlin" ||
|
||||
targetLanguage == "csharp") {
|
||||
return "Tracing";
|
||||
}
|
||||
return strategy;
|
||||
@@ -555,10 +567,9 @@ private:
|
||||
|
||||
// If this is an annotation node, record its type
|
||||
const auto& ct = node->conceptType;
|
||||
if (ct == "ReclaimAnnotation" || ct == "DeallocateAnnotation" ||
|
||||
ct == "LifetimeAnnotation" || ct == "OwnerAnnotation" ||
|
||||
ct == "AllocateAnnotation" || ct == "DerefStrategy" ||
|
||||
ct == "OptimizationLock" || ct == "LangSpecific") {
|
||||
if (ct.find("Annotation") != std::string::npos ||
|
||||
ct == "DerefStrategy" || ct == "OptimizationLock" ||
|
||||
ct == "LangSpecific" || ct == "CapabilityRequirement") {
|
||||
types.push_back(ct);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user