Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | /**
* Read-only symbol collections for code generation.
* Provides generators with access to type declarations without mutation.
*
* This interface mirrors the readonly accessors of SymbolCollector,
* enabling dependency injection and testing.
*/
interface ICodeGenSymbols {
// === Known Type Names ===
/** Set of known scope names (ADR-016) */
readonly knownScopes: ReadonlySet<string>;
/** Set of known struct type names */
readonly knownStructs: ReadonlySet<string>;
/** Set of known register names (ADR-004) */
readonly knownRegisters: ReadonlySet<string>;
/** Set of known enum type names (ADR-017) */
readonly knownEnums: ReadonlySet<string>;
/** Set of known bitmap type names (ADR-034) */
readonly knownBitmaps: ReadonlySet<string>;
// === Scope Information ===
/** Members of each scope: scopeName -> Set of member names */
readonly scopeMembers: ReadonlyMap<string, ReadonlySet<string>>;
/** Visibility of scope members: scopeName -> (memberName -> visibility) */
readonly scopeMemberVisibility: ReadonlyMap<
string,
ReadonlyMap<string, "public" | "private">
>;
// === Struct Information ===
/** Struct field types: structName -> (fieldName -> typeName) */
readonly structFields: ReadonlyMap<string, ReadonlyMap<string, string>>;
/** Fields that are arrays: structName -> Set of array field names */
readonly structFieldArrays: ReadonlyMap<string, ReadonlySet<string>>;
/** Array dimensions for struct fields: structName -> (fieldName -> dimensions) */
readonly structFieldDimensions: ReadonlyMap<
string,
ReadonlyMap<string, readonly number[]>
>;
// === Enum Information (ADR-017) ===
/** Enum members and values: enumName -> (memberName -> value) */
readonly enumMembers: ReadonlyMap<string, ReadonlyMap<string, number>>;
// === Bitmap Information (ADR-034) ===
/** Bitmap field info: bitmapName -> (fieldName -> {offset, width}) */
readonly bitmapFields: ReadonlyMap<
string,
ReadonlyMap<string, { readonly offset: number; readonly width: number }>
>;
/** Backing type for each bitmap: bitmapName -> typeName (e.g., "uint8_t") */
readonly bitmapBackingType: ReadonlyMap<string, string>;
/** Bit width for each bitmap: bitmapName -> bitWidth (e.g., 8, 16, 24, 32) */
readonly bitmapBitWidth: ReadonlyMap<string, number>;
// === Register Information (ADR-004) ===
/** Scoped registers: "scopeName.registerName" -> address expression */
readonly scopedRegisters: ReadonlyMap<string, string>;
/** Register member access patterns: "scope.reg.field" -> access code */
readonly registerMemberAccess: ReadonlyMap<string, string>;
/** Register member types: "scope.reg.field" -> typeName */
readonly registerMemberTypes: ReadonlyMap<string, string>;
// Issue #187: Register address info for width-appropriate memory access
/** Register base addresses: registerName -> base address expression */
readonly registerBaseAddresses: ReadonlyMap<string, string>;
/** Register member offsets: "reg_member" -> offset expression */
readonly registerMemberOffsets: ReadonlyMap<string, string>;
/** Register member C types: "reg_member" -> C type (e.g., "uint32_t") */
readonly registerMemberCTypes: ReadonlyMap<string, string>;
// === Issue #232: Scope Variable Usage Analysis ===
/**
* Scope variable usage: "Scope_varName" -> Set of function names that use it.
* Used to determine if a variable is single-function (can be local).
*/
readonly scopeVariableUsage: ReadonlyMap<string, ReadonlySet<string>>;
// === Issue #282: Scope Private Const Inlining ===
/**
* Private const values for inlining: "Scope_constName" -> literal value string.
* Used to inline private const values at usage sites.
*/
readonly scopePrivateConstValues: ReadonlyMap<string, string>;
// === Function Return Types ===
/**
* Function return types: "functionName" -> return type string.
* Used to determine enum types for function call expressions.
* Keys are full function names (e.g., "Motor_getMode" for scope methods, "getState" for globals).
*/
readonly functionReturnTypes: ReadonlyMap<string, string>;
/**
* Check if a scope variable is used in only one function.
* Returns the function name if single-function, null otherwise.
*/
getSingleFunctionForVariable(
scopeName: string,
varName: string,
): string | null;
/**
* Check if any scope members are public (exported).
* Used to determine if a self-include header is needed for extern "C" linkage.
*/
hasPublicSymbols(): boolean;
}
export default ICodeGenSymbols;
|