Steps 297-302: Phase 11b complete + Phase 11c step 302 (68/68 tests)

Phase 11b — Validation & Conflict Completion:
- Step 297: Subject 2-4 validation rules E0600-E0805 (12/12)
- Step 298: Subject 5-8 validation rules E0900-E1202 (12/12)
- Step 299: Cross-type conflict detection, 6 conflict pairs (12/12)
- Step 300: TransformEngineExtended — float folding, dead var, annotation-aware (12/12)
- Step 301: Phase 11b integration tests (8/8)

Phase 11c — Parser Deepening (start):
- Step 302: New AST nodes — ClassDeclaration, InterfaceDeclaration,
  MethodDeclaration, GenericType, TypeParameter with JSON roundtrip (12/12)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bill
2026-02-14 16:53:23 +00:00
parent 023809ef4b
commit 87615a7187
14 changed files with 2677 additions and 1 deletions

View File

@@ -0,0 +1,53 @@
#pragma once
#include "ASTNode.h"
#include "Function.h"
#include <string>
#include <vector>
// ClassDeclaration — represents a class/struct definition
class ClassDeclaration : public ASTNode {
public:
std::string name;
std::string superClass; // base class name, empty if none
bool isAbstract = false;
ClassDeclaration() { conceptType = "ClassDeclaration"; }
ClassDeclaration(const std::string& id_, const std::string& name_)
: name(name_) {
this->id = id_;
this->conceptType = "ClassDeclaration";
}
// Children roles: "interfaces" (list of CustomType), "fields" (list of Variable),
// "methods" (list of MethodDeclaration), "annotations"
};
// InterfaceDeclaration — represents an interface/trait/protocol
class InterfaceDeclaration : public ASTNode {
public:
std::string name;
InterfaceDeclaration() { conceptType = "InterfaceDeclaration"; }
InterfaceDeclaration(const std::string& id_, const std::string& name_)
: name(name_) {
this->id = id_;
this->conceptType = "InterfaceDeclaration";
}
// Children roles: "methods" (list of MethodDeclaration), "annotations"
};
// MethodDeclaration — extends Function with class-specific fields
class MethodDeclaration : public Function {
public:
std::string className;
bool isStatic = false;
std::string visibility = "public"; // "public", "private", "protected"
bool isOverride = false;
bool isVirtual = false;
MethodDeclaration() { conceptType = "MethodDeclaration"; }
MethodDeclaration(const std::string& id_, const std::string& name_)
: Function(id_, name_) {
this->conceptType = "MethodDeclaration";
}
// Inherits children: "parameters", "body", "returnType", "annotations"
};

View File

@@ -0,0 +1,31 @@
#pragma once
#include "ASTNode.h"
#include <string>
// GenericType — a parameterized type like List<T> or Map<K, V>
class GenericType : public ASTNode {
public:
std::string baseName; // e.g. "List", "Map", "Optional"
GenericType() { conceptType = "GenericType"; }
GenericType(const std::string& id_, const std::string& base)
: baseName(base) {
this->id = id_;
this->conceptType = "GenericType";
}
// Children roles: "typeParameters" (list of TypeParameter or PrimitiveType)
};
// TypeParameter — a type variable like T, K, V with optional constraint
class TypeParameter : public ASTNode {
public:
std::string name; // e.g. "T", "K"
std::string constraint; // e.g. "Comparable", empty if unconstrained
TypeParameter() { conceptType = "TypeParameter"; }
TypeParameter(const std::string& id_, const std::string& name_)
: name(name_) {
this->id = id_;
this->conceptType = "TypeParameter";
}
};