c-next 0.1.69 → 0.1.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/package.json +1 -1
  2. package/src/lib/__tests__/parseCHeader.mocked.test.ts +69 -54
  3. package/src/lib/parseCHeader.ts +56 -23
  4. package/src/lib/parseWithSymbols.ts +195 -53
  5. package/src/transpiler/Transpiler.ts +173 -60
  6. package/src/transpiler/logic/analysis/FunctionCallAnalyzer.ts +240 -205
  7. package/src/transpiler/logic/analysis/InitializationAnalyzer.ts +1 -2
  8. package/src/transpiler/logic/analysis/PassByValueAnalyzer.ts +742 -0
  9. package/src/transpiler/logic/analysis/__tests__/FunctionCallAnalyzer.test.ts +102 -15
  10. package/src/transpiler/logic/analysis/__tests__/InitializationAnalyzer.test.ts +9 -9
  11. package/src/transpiler/logic/analysis/__tests__/runAnalyzers.test.ts +5 -5
  12. package/src/transpiler/{output/codegen → logic/analysis}/helpers/AssignmentTargetExtractor.ts +1 -1
  13. package/src/transpiler/{output/codegen → logic/analysis}/helpers/ChildStatementCollector.ts +1 -1
  14. package/src/transpiler/{output/codegen → logic/analysis}/helpers/StatementExpressionCollector.ts +1 -1
  15. package/src/transpiler/{output/codegen → logic/analysis}/helpers/__tests__/AssignmentTargetExtractor.test.ts +2 -2
  16. package/src/transpiler/{output/codegen → logic/analysis}/helpers/__tests__/ChildStatementCollector.test.ts +2 -2
  17. package/src/transpiler/{output/codegen → logic/analysis}/helpers/__tests__/StatementExpressionCollector.test.ts +2 -2
  18. package/src/transpiler/logic/symbols/SymbolTable.ts +676 -258
  19. package/src/transpiler/logic/symbols/SymbolUtils.ts +2 -2
  20. package/src/transpiler/logic/symbols/__tests__/SymbolTable.test.ts +290 -782
  21. package/src/transpiler/logic/symbols/c/__tests__/CResolver.integration.test.ts +573 -0
  22. package/src/transpiler/logic/symbols/c/__tests__/testHelpers.ts +20 -0
  23. package/src/transpiler/logic/symbols/c/collectors/EnumCollector.ts +82 -0
  24. package/src/transpiler/logic/symbols/c/collectors/FunctionCollector.ts +106 -0
  25. package/src/transpiler/logic/symbols/c/collectors/StructCollector.ts +173 -0
  26. package/src/transpiler/logic/symbols/c/collectors/TypedefCollector.ts +35 -0
  27. package/src/transpiler/logic/symbols/c/collectors/VariableCollector.ts +80 -0
  28. package/src/transpiler/logic/symbols/c/index.ts +333 -0
  29. package/src/transpiler/logic/symbols/c/utils/DeclaratorUtils.ts +269 -0
  30. package/src/transpiler/logic/symbols/cnext/__tests__/BitmapCollector.test.ts +50 -11
  31. package/src/transpiler/logic/symbols/cnext/__tests__/CNextResolver.integration.test.ts +45 -34
  32. package/src/transpiler/logic/symbols/cnext/__tests__/EnumCollector.test.ts +30 -13
  33. package/src/transpiler/logic/symbols/cnext/__tests__/FunctionCollector.test.ts +279 -64
  34. package/src/transpiler/logic/symbols/cnext/__tests__/RegisterCollector.test.ts +60 -13
  35. package/src/transpiler/logic/symbols/cnext/__tests__/ScopeCollector.test.ts +40 -37
  36. package/src/transpiler/logic/symbols/cnext/__tests__/StructCollector.test.ts +131 -45
  37. package/src/transpiler/logic/symbols/cnext/__tests__/TSymbolInfoAdapter.test.ts +223 -139
  38. package/src/transpiler/logic/symbols/cnext/__tests__/VariableCollector.test.ts +79 -25
  39. package/src/transpiler/logic/symbols/cnext/__tests__/testUtils.ts +53 -0
  40. package/src/transpiler/logic/symbols/cnext/adapters/TSymbolInfoAdapter.ts +83 -43
  41. package/src/transpiler/logic/symbols/cnext/collectors/BitmapCollector.ts +14 -13
  42. package/src/transpiler/logic/symbols/cnext/collectors/EnumCollector.ts +11 -10
  43. package/src/transpiler/logic/symbols/cnext/collectors/FunctionCollector.ts +83 -34
  44. package/src/transpiler/logic/symbols/cnext/collectors/RegisterCollector.ts +22 -18
  45. package/src/transpiler/logic/symbols/cnext/collectors/ScopeCollector.ts +53 -35
  46. package/src/transpiler/logic/symbols/cnext/collectors/StructCollector.ts +30 -23
  47. package/src/transpiler/logic/symbols/cnext/collectors/VariableCollector.ts +18 -19
  48. package/src/transpiler/logic/symbols/cnext/index.ts +36 -14
  49. package/src/transpiler/logic/symbols/cnext/types/IScopeCollectorResult.ts +2 -2
  50. package/src/transpiler/logic/symbols/cnext/utils/SymbolNameUtils.ts +27 -0
  51. package/src/transpiler/logic/symbols/cpp/__tests__/CppResolver.integration.test.ts +270 -0
  52. package/src/transpiler/logic/symbols/cpp/__tests__/testHelpers.ts +20 -0
  53. package/src/transpiler/logic/symbols/cpp/collectors/ClassCollector.ts +317 -0
  54. package/src/transpiler/logic/symbols/cpp/collectors/EnumCollector.ts +71 -0
  55. package/src/transpiler/logic/symbols/cpp/collectors/FunctionCollector.ts +155 -0
  56. package/src/transpiler/logic/symbols/cpp/collectors/NamespaceCollector.ts +65 -0
  57. package/src/transpiler/logic/symbols/cpp/collectors/TypeAliasCollector.ts +46 -0
  58. package/src/transpiler/logic/symbols/cpp/collectors/VariableCollector.ts +54 -0
  59. package/src/transpiler/logic/symbols/cpp/index.ts +366 -0
  60. package/src/transpiler/logic/symbols/cpp/utils/DeclaratorUtils.ts +248 -0
  61. package/src/transpiler/logic/symbols/shared/IExtractedParameter.ts +18 -0
  62. package/src/transpiler/logic/symbols/shared/ParameterExtractorUtils.ts +73 -0
  63. package/src/transpiler/output/codegen/CodeGenerator.ts +310 -2288
  64. package/src/transpiler/output/codegen/TypeRegistrationUtils.ts +4 -6
  65. package/src/transpiler/output/codegen/TypeResolver.ts +2 -2
  66. package/src/transpiler/output/codegen/TypeValidator.ts +5 -5
  67. package/src/transpiler/output/codegen/__tests__/CodeGenerator.test.ts +7 -1
  68. package/src/transpiler/output/codegen/__tests__/TypeRegistrationUtils.test.ts +36 -51
  69. package/src/transpiler/output/codegen/__tests__/TypeResolver.test.ts +20 -17
  70. package/src/transpiler/output/codegen/__tests__/TypeValidator.resolution.test.ts +3 -3
  71. package/src/transpiler/output/codegen/__tests__/TypeValidator.test.ts +1 -1
  72. package/src/transpiler/output/codegen/analysis/MemberChainAnalyzer.ts +1 -1
  73. package/src/transpiler/output/codegen/analysis/StringLengthCounter.ts +1 -1
  74. package/src/transpiler/output/codegen/analysis/__tests__/MemberChainAnalyzer.test.ts +9 -9
  75. package/src/transpiler/output/codegen/analysis/__tests__/StringLengthCounter.test.ts +12 -12
  76. package/src/transpiler/output/codegen/assignment/AssignmentClassifier.ts +13 -12
  77. package/src/transpiler/output/codegen/assignment/__tests__/AssignmentClassifier.test.ts +23 -17
  78. package/src/transpiler/output/codegen/assignment/handlers/ArrayHandlers.ts +2 -2
  79. package/src/transpiler/output/codegen/assignment/handlers/AssignmentHandlerUtils.ts +7 -1
  80. package/src/transpiler/output/codegen/assignment/handlers/BitAccessHandlers.ts +3 -3
  81. package/src/transpiler/output/codegen/assignment/handlers/BitmapHandlers.ts +9 -5
  82. package/src/transpiler/output/codegen/assignment/handlers/RegisterHandlers.ts +2 -1
  83. package/src/transpiler/output/codegen/assignment/handlers/SpecialHandlers.ts +4 -4
  84. package/src/transpiler/output/codegen/assignment/handlers/StringHandlers.ts +5 -5
  85. package/src/transpiler/output/codegen/assignment/handlers/__tests__/ArrayHandlers.test.ts +23 -25
  86. package/src/transpiler/output/codegen/assignment/handlers/__tests__/BitAccessHandlers.test.ts +20 -36
  87. package/src/transpiler/output/codegen/assignment/handlers/__tests__/BitmapHandlers.test.ts +18 -18
  88. package/src/transpiler/output/codegen/assignment/handlers/__tests__/SpecialHandlers.test.ts +42 -32
  89. package/src/transpiler/output/codegen/assignment/handlers/__tests__/handlerTestUtils.ts +5 -4
  90. package/src/transpiler/output/codegen/generators/declarationGenerators/ScopeGenerator.ts +21 -8
  91. package/src/transpiler/output/codegen/generators/declarationGenerators/ScopedRegisterGenerator.ts +3 -2
  92. package/src/transpiler/output/codegen/generators/expressions/CallExprGenerator.ts +14 -6
  93. package/src/transpiler/output/codegen/generators/expressions/CallExprUtils.ts +9 -3
  94. package/src/transpiler/output/codegen/generators/expressions/PostfixExpressionGenerator.ts +19 -16
  95. package/src/transpiler/output/codegen/generators/expressions/__tests__/CallExprGenerator.test.ts +24 -8
  96. package/src/transpiler/output/codegen/generators/expressions/__tests__/CallExprUtils.test.ts +4 -8
  97. package/src/transpiler/output/codegen/generators/expressions/__tests__/PostfixExpressionGenerator.test.ts +15 -2
  98. package/src/transpiler/output/codegen/helpers/ArgumentGenerator.ts +236 -0
  99. package/src/transpiler/output/codegen/helpers/ArrayInitHelper.ts +2 -1
  100. package/src/transpiler/output/codegen/helpers/AssignmentExpectedTypeResolver.ts +2 -2
  101. package/src/transpiler/output/codegen/helpers/AssignmentValidator.ts +3 -3
  102. package/src/transpiler/output/codegen/helpers/CppConstructorHelper.ts +3 -3
  103. package/src/transpiler/output/codegen/helpers/EnumAssignmentValidator.ts +1 -1
  104. package/src/transpiler/output/codegen/helpers/FunctionContextManager.ts +435 -0
  105. package/src/transpiler/output/codegen/helpers/StringDeclHelper.ts +2 -2
  106. package/src/transpiler/output/codegen/helpers/StringOperationsHelper.ts +203 -0
  107. package/src/transpiler/output/codegen/helpers/SymbolLookupHelper.ts +8 -12
  108. package/src/transpiler/output/codegen/helpers/TypeRegistrationEngine.ts +520 -0
  109. package/src/transpiler/output/codegen/helpers/VariableDeclHelper.ts +735 -0
  110. package/src/transpiler/output/codegen/helpers/VariableDeclarationFormatter.ts +1 -1
  111. package/src/transpiler/output/codegen/helpers/__tests__/ArgumentGenerator.test.ts +521 -0
  112. package/src/transpiler/output/codegen/helpers/__tests__/ArrayInitHelper.test.ts +1 -1
  113. package/src/transpiler/output/codegen/helpers/__tests__/AssignmentExpectedTypeResolver.test.ts +7 -7
  114. package/src/transpiler/output/codegen/helpers/__tests__/AssignmentValidator.test.ts +7 -7
  115. package/src/transpiler/output/codegen/helpers/__tests__/CppConstructorHelper.test.ts +4 -5
  116. package/src/transpiler/output/codegen/helpers/__tests__/EnumAssignmentValidator.test.ts +2 -2
  117. package/src/transpiler/output/codegen/helpers/__tests__/FunctionContextManager.test.ts +983 -0
  118. package/src/transpiler/output/codegen/helpers/__tests__/StringDeclHelper.test.ts +4 -4
  119. package/src/transpiler/output/codegen/helpers/__tests__/StringOperationsHelper.test.ts +269 -0
  120. package/src/transpiler/output/codegen/helpers/__tests__/SymbolLookupHelper.test.ts +31 -32
  121. package/src/transpiler/output/codegen/helpers/__tests__/TypeRegistrationEngine.test.ts +186 -0
  122. package/src/transpiler/output/codegen/helpers/__tests__/VariableDeclHelper.test.ts +460 -0
  123. package/src/transpiler/output/codegen/helpers/types/IArgumentGeneratorCallbacks.ts +32 -0
  124. package/src/transpiler/output/codegen/resolution/EnumTypeResolver.ts +7 -3
  125. package/src/transpiler/output/codegen/resolution/__tests__/EnumTypeResolver.test.ts +5 -5
  126. package/src/transpiler/output/codegen/types/IFunctionContextCallbacks.ts +12 -0
  127. package/src/transpiler/output/codegen/types/IVariableFormatInput.ts +1 -1
  128. package/src/transpiler/output/codegen/utils/QualifiedNameGenerator.ts +114 -0
  129. package/src/transpiler/output/codegen/utils/__tests__/QualifiedNameGenerator.test.ts +183 -0
  130. package/src/transpiler/output/headers/BaseHeaderGenerator.ts +4 -4
  131. package/src/transpiler/output/headers/ExternalTypeHeaderBuilder.ts +7 -7
  132. package/src/transpiler/output/headers/HeaderGenerator.ts +9 -7
  133. package/src/transpiler/output/headers/HeaderGeneratorUtils.ts +19 -20
  134. package/src/transpiler/output/headers/__tests__/BaseHeaderGenerator.test.ts +15 -18
  135. package/src/transpiler/output/headers/__tests__/CHeaderGenerator.test.ts +63 -64
  136. package/src/transpiler/output/headers/__tests__/CppHeaderGenerator.test.ts +36 -32
  137. package/src/transpiler/output/headers/__tests__/ExternalTypeHeaderBuilder.test.ts +26 -26
  138. package/src/transpiler/output/headers/__tests__/HeaderGenerator.test.ts +87 -59
  139. package/src/transpiler/output/headers/__tests__/HeaderGeneratorUtils.test.ts +57 -58
  140. package/src/transpiler/output/headers/adapters/HeaderSymbolAdapter.ts +222 -0
  141. package/src/transpiler/output/headers/adapters/__tests__/HeaderSymbolAdapter.test.ts +538 -0
  142. package/src/transpiler/output/headers/types/IGroupedSymbols.ts +8 -8
  143. package/src/transpiler/output/headers/types/IHeaderSymbol.ts +62 -0
  144. package/src/transpiler/state/CodeGenState.ts +109 -4
  145. package/src/transpiler/state/SymbolRegistry.ts +181 -0
  146. package/src/transpiler/{types → state}/TranspilerState.ts +1 -1
  147. package/src/transpiler/state/__tests__/CodeGenState.test.ts +277 -1
  148. package/src/transpiler/state/__tests__/SymbolRegistry.test.ts +249 -0
  149. package/src/transpiler/{types → state}/__tests__/TranspilerState.test.ts +1 -1
  150. package/src/transpiler/types/ICachedFileEntry.ts +1 -1
  151. package/src/transpiler/types/IConflict.ts +14 -0
  152. package/src/transpiler/types/ISerializedSymbol.ts +11 -0
  153. package/src/transpiler/types/TPrimitiveKind.ts +20 -0
  154. package/src/transpiler/types/TType.ts +103 -0
  155. package/src/transpiler/types/TVisibility.ts +6 -0
  156. package/src/transpiler/types/symbol-kinds/TSymbolKind.ts +10 -0
  157. package/src/transpiler/types/symbol-kinds/TSymbolKindC.ts +12 -0
  158. package/src/transpiler/types/symbol-kinds/TSymbolKindCNext.ts +16 -0
  159. package/src/transpiler/types/symbol-kinds/TSymbolKindCpp.ts +14 -0
  160. package/src/transpiler/types/symbols/IBaseSymbol.ts +31 -0
  161. package/src/transpiler/{logic/symbols/types → types/symbols}/IBitmapFieldInfo.ts +2 -2
  162. package/src/transpiler/types/symbols/IBitmapSymbol.ts +21 -0
  163. package/src/transpiler/{logic/symbols/types → types/symbols}/IEnumSymbol.ts +5 -6
  164. package/src/transpiler/types/symbols/IFieldInfo.ts +26 -0
  165. package/src/transpiler/types/symbols/IFunctionSymbol.ts +30 -0
  166. package/src/transpiler/types/symbols/IParameterInfo.ts +26 -0
  167. package/src/transpiler/{logic/symbols/types → types/symbols}/IRegisterMemberInfo.ts +4 -4
  168. package/src/transpiler/types/symbols/IRegisterSymbol.ts +18 -0
  169. package/src/transpiler/types/symbols/IScopeSymbol.ts +32 -0
  170. package/src/transpiler/{logic/symbols/types → types/symbols}/IStructFieldInfo.ts +2 -1
  171. package/src/transpiler/types/symbols/IStructSymbol.ts +15 -0
  172. package/src/transpiler/types/symbols/IVariableSymbol.ts +30 -0
  173. package/src/transpiler/types/symbols/SymbolGuards.ts +43 -0
  174. package/src/transpiler/types/symbols/TAnySymbol.ts +22 -0
  175. package/src/transpiler/types/symbols/TSymbol.ts +32 -0
  176. package/src/transpiler/types/symbols/__tests__/IBaseSymbol.test.ts +56 -0
  177. package/src/transpiler/types/symbols/__tests__/SymbolGuards.test.ts +57 -0
  178. package/src/transpiler/types/symbols/c/ICBaseSymbol.ts +28 -0
  179. package/src/transpiler/types/symbols/c/ICEnumMemberSymbol.ts +17 -0
  180. package/src/transpiler/types/symbols/c/ICEnumSymbol.ts +17 -0
  181. package/src/transpiler/types/symbols/c/ICFieldInfo.ts +16 -0
  182. package/src/transpiler/types/symbols/c/ICFunctionSymbol.ts +21 -0
  183. package/src/transpiler/types/symbols/c/ICParameterInfo.ts +19 -0
  184. package/src/transpiler/types/symbols/c/ICStructSymbol.ts +21 -0
  185. package/src/transpiler/types/symbols/c/ICTypedefSymbol.ts +14 -0
  186. package/src/transpiler/types/symbols/c/ICVariableSymbol.ts +26 -0
  187. package/src/transpiler/types/symbols/c/TCSymbol.ts +26 -0
  188. package/src/transpiler/types/symbols/cpp/ICppBaseSymbol.ts +31 -0
  189. package/src/transpiler/types/symbols/cpp/ICppClassSymbol.ts +15 -0
  190. package/src/transpiler/types/symbols/cpp/ICppEnumMemberSymbol.ts +14 -0
  191. package/src/transpiler/types/symbols/cpp/ICppEnumSymbol.ts +14 -0
  192. package/src/transpiler/types/symbols/cpp/ICppFieldInfo.ts +16 -0
  193. package/src/transpiler/types/symbols/cpp/ICppFunctionSymbol.ts +21 -0
  194. package/src/transpiler/types/symbols/cpp/ICppNamespaceSymbol.ts +11 -0
  195. package/src/transpiler/types/symbols/cpp/ICppParameterInfo.ts +19 -0
  196. package/src/transpiler/types/symbols/cpp/ICppStructSymbol.ts +16 -0
  197. package/src/transpiler/types/symbols/cpp/ICppTypeAliasSymbol.ts +14 -0
  198. package/src/transpiler/types/symbols/cpp/ICppVariableSymbol.ts +23 -0
  199. package/src/transpiler/types/symbols/cpp/TCppSymbol.ts +30 -0
  200. package/src/utils/CppNamespaceUtils.ts +3 -4
  201. package/src/utils/FunctionUtils.ts +92 -0
  202. package/src/utils/ParameterUtils.ts +55 -0
  203. package/src/utils/PrimitiveKindUtils.ts +33 -0
  204. package/src/utils/ScopeUtils.ts +105 -0
  205. package/src/utils/TTypeUtils.ts +159 -0
  206. package/src/utils/TypeResolver.ts +132 -0
  207. package/src/utils/__tests__/CppNamespaceUtils.test.ts +92 -99
  208. package/src/utils/__tests__/FunctionUtils.test.ts +284 -0
  209. package/src/utils/__tests__/ParameterUtils.test.ts +174 -0
  210. package/src/utils/__tests__/PrimitiveKindUtils.test.ts +59 -0
  211. package/src/utils/__tests__/ScopeUtils.test.ts +53 -0
  212. package/src/utils/__tests__/TTypeUtils.test.ts +245 -0
  213. package/src/utils/__tests__/TypeResolver.test.ts +332 -0
  214. package/src/utils/cache/CacheManager.ts +91 -50
  215. package/src/utils/cache/__tests__/CacheManager.test.ts +180 -114
  216. package/src/transpiler/logic/symbols/AutoConstUpdater.ts +0 -93
  217. package/src/transpiler/logic/symbols/CSymbolCollector.ts +0 -648
  218. package/src/transpiler/logic/symbols/CppSymbolCollector.ts +0 -874
  219. package/src/transpiler/logic/symbols/SymbolCollectorContext.ts +0 -68
  220. package/src/transpiler/logic/symbols/__tests__/AutoConstUpdater.test.ts +0 -418
  221. package/src/transpiler/logic/symbols/__tests__/CSymbolCollector.test.ts +0 -685
  222. package/src/transpiler/logic/symbols/__tests__/CppSymbolCollector.test.ts +0 -1146
  223. package/src/transpiler/logic/symbols/__tests__/SymbolCollectorContext.test.ts +0 -290
  224. package/src/transpiler/logic/symbols/__tests__/cTestHelpers.ts +0 -43
  225. package/src/transpiler/logic/symbols/__tests__/cppTestHelpers.ts +0 -40
  226. package/src/transpiler/logic/symbols/cnext/__tests__/TSymbolAdapter.test.ts +0 -595
  227. package/src/transpiler/logic/symbols/cnext/adapters/TSymbolAdapter.ts +0 -345
  228. package/src/transpiler/logic/symbols/types/IBaseSymbol.ts +0 -27
  229. package/src/transpiler/logic/symbols/types/IBitmapSymbol.ts +0 -23
  230. package/src/transpiler/logic/symbols/types/ICollectorContext.ts +0 -19
  231. package/src/transpiler/logic/symbols/types/IConflict.ts +0 -20
  232. package/src/transpiler/logic/symbols/types/IFieldInfo.ts +0 -18
  233. package/src/transpiler/logic/symbols/types/IFunctionSymbol.ts +0 -25
  234. package/src/transpiler/logic/symbols/types/IParameterInfo.ts +0 -24
  235. package/src/transpiler/logic/symbols/types/IRegisterSymbol.ts +0 -20
  236. package/src/transpiler/logic/symbols/types/IScopeSymbol.ts +0 -19
  237. package/src/transpiler/logic/symbols/types/IStructSymbol.ts +0 -16
  238. package/src/transpiler/logic/symbols/types/IVariableSymbol.ts +0 -30
  239. package/src/transpiler/logic/symbols/types/TSymbol.ts +0 -36
  240. package/src/transpiler/logic/symbols/types/__tests__/SymbolGuards.test.ts +0 -244
  241. package/src/transpiler/logic/symbols/types/typeGuards.ts +0 -44
  242. package/src/utils/types/ESymbolKind.ts +0 -19
  243. package/src/utils/types/ISymbol.ts +0 -64
  244. /package/src/transpiler/{types → constants}/BITMAP_BACKING_TYPE.ts +0 -0
  245. /package/src/transpiler/{types → constants}/BITMAP_SIZE.ts +0 -0
  246. /package/src/transpiler/{output/codegen → logic/analysis}/helpers/TransitiveModificationPropagator.ts +0 -0
  247. /package/src/transpiler/{output/codegen → logic/analysis}/helpers/__tests__/TransitiveModificationPropagator.test.ts +0 -0
@@ -1,12 +1,20 @@
1
1
  /**
2
2
  * Unit tests for SymbolTable
3
3
  * Issue #221: Function parameters should not cause conflicts
4
+ * ADR-055 Phase 7: Fully typed symbol storage using TSymbol, TCSymbol, TCppSymbol
4
5
  */
5
6
  import { describe, it, expect, beforeEach } from "vitest";
6
7
  import SymbolTable from "../SymbolTable";
7
- import ESymbolKind from "../../../../utils/types/ESymbolKind";
8
8
  import ESourceLanguage from "../../../../utils/types/ESourceLanguage";
9
- import ISymbol from "../../../../utils/types/ISymbol";
9
+ import TSymbol from "../../../types/symbols/TSymbol";
10
+ import IVariableSymbol from "../../../types/symbols/IVariableSymbol";
11
+ import IFunctionSymbol from "../../../types/symbols/IFunctionSymbol";
12
+ import IStructSymbol from "../../../types/symbols/IStructSymbol";
13
+ import IEnumSymbol from "../../../types/symbols/IEnumSymbol";
14
+ import TestScopeUtils from "../cnext/__tests__/testUtils";
15
+ import TTypeUtils from "../../../../utils/TTypeUtils";
16
+ import TCSymbol from "../../../types/symbols/c/TCSymbol";
17
+ import TCppSymbol from "../../../types/symbols/cpp/TCppSymbol";
10
18
 
11
19
  describe("SymbolTable", () => {
12
20
  let symbolTable: SymbolTable;
@@ -16,966 +24,466 @@ describe("SymbolTable", () => {
16
24
  });
17
25
 
18
26
  // ========================================================================
19
- // Basic Symbol Operations
27
+ // TSymbol (C-Next) Operations
20
28
  // ========================================================================
21
29
 
22
- describe("addSymbol and getSymbol", () => {
23
- it("should add and retrieve a symbol by name", () => {
24
- const symbol: ISymbol = {
30
+ describe("addTSymbol and getTSymbol", () => {
31
+ it("should add and retrieve a TSymbol by name", () => {
32
+ const symbol: IVariableSymbol = {
33
+ kind: "variable",
25
34
  name: "myVar",
26
- kind: ESymbolKind.Variable,
27
35
  sourceFile: "test.cnx",
28
36
  sourceLine: 1,
29
37
  sourceLanguage: ESourceLanguage.CNext,
30
38
  isExported: true,
39
+ type: TTypeUtils.createPrimitive("u32"),
40
+ isArray: false,
41
+ isConst: false,
42
+ isAtomic: false,
43
+ scope: TestScopeUtils.createMockGlobalScope(),
31
44
  };
32
45
 
33
- symbolTable.addSymbol(symbol);
34
- const retrieved = symbolTable.getSymbol("myVar");
46
+ symbolTable.addTSymbol(symbol);
47
+ const retrieved = symbolTable.getTSymbol("myVar");
35
48
 
36
49
  expect(retrieved).toBeDefined();
37
50
  expect(retrieved?.name).toBe("myVar");
38
- expect(retrieved?.kind).toBe(ESymbolKind.Variable);
51
+ expect(retrieved?.kind).toBe("variable");
39
52
  });
40
53
 
41
54
  it("should return undefined for non-existent symbol", () => {
42
- const retrieved = symbolTable.getSymbol("nonExistent");
55
+ const retrieved = symbolTable.getTSymbol("nonExistent");
43
56
  expect(retrieved).toBeUndefined();
44
57
  });
45
58
 
46
59
  it("should return first symbol when multiple exist with same name", () => {
47
- symbolTable.addSymbol({
60
+ symbolTable.addTSymbol({
61
+ kind: "variable",
48
62
  name: "duplicate",
49
- kind: ESymbolKind.Variable,
50
63
  sourceFile: "first.cnx",
51
64
  sourceLine: 1,
52
65
  sourceLanguage: ESourceLanguage.CNext,
53
66
  isExported: true,
67
+ type: TTypeUtils.createPrimitive("u32"),
68
+ isArray: false,
69
+ isConst: false,
70
+ isAtomic: false,
71
+ scope: TestScopeUtils.createMockGlobalScope(),
54
72
  });
55
73
 
56
- symbolTable.addSymbol({
74
+ symbolTable.addTSymbol({
75
+ kind: "variable",
57
76
  name: "duplicate",
58
- kind: ESymbolKind.Variable,
59
77
  sourceFile: "second.cnx",
60
78
  sourceLine: 5,
61
79
  sourceLanguage: ESourceLanguage.CNext,
62
80
  isExported: true,
81
+ type: TTypeUtils.createPrimitive("u32"),
82
+ isArray: false,
83
+ isConst: false,
84
+ isAtomic: false,
85
+ scope: TestScopeUtils.createMockGlobalScope(),
63
86
  });
64
87
 
65
- const retrieved = symbolTable.getSymbol("duplicate");
88
+ const retrieved = symbolTable.getTSymbol("duplicate");
66
89
  expect(retrieved?.sourceFile).toBe("first.cnx");
67
90
  });
68
91
  });
69
92
 
70
- describe("addSymbols", () => {
71
- it("should add multiple symbols at once", () => {
72
- const symbols: ISymbol[] = [
93
+ describe("addTSymbols", () => {
94
+ it("should add multiple TSymbols at once", () => {
95
+ const symbols: TSymbol[] = [
73
96
  {
97
+ kind: "variable",
74
98
  name: "var1",
75
- kind: ESymbolKind.Variable,
76
99
  sourceFile: "test.cnx",
77
100
  sourceLine: 1,
78
101
  sourceLanguage: ESourceLanguage.CNext,
79
102
  isExported: true,
103
+ type: TTypeUtils.createPrimitive("u32"),
104
+ isArray: false,
105
+ isConst: false,
106
+ isAtomic: false,
107
+ scope: TestScopeUtils.createMockGlobalScope(),
80
108
  },
81
109
  {
110
+ kind: "variable",
82
111
  name: "var2",
83
- kind: ESymbolKind.Variable,
84
112
  sourceFile: "test.cnx",
85
113
  sourceLine: 2,
86
114
  sourceLanguage: ESourceLanguage.CNext,
87
115
  isExported: true,
88
- },
89
- {
90
- name: "func1",
91
- kind: ESymbolKind.Function,
92
- sourceFile: "test.cnx",
93
- sourceLine: 3,
94
- sourceLanguage: ESourceLanguage.CNext,
95
- isExported: true,
116
+ type: TTypeUtils.createPrimitive("i32"),
117
+ isArray: false,
118
+ isConst: false,
119
+ isAtomic: false,
120
+ scope: TestScopeUtils.createMockGlobalScope(),
96
121
  },
97
122
  ];
98
123
 
99
- symbolTable.addSymbols(symbols);
124
+ symbolTable.addTSymbols(symbols);
100
125
 
101
- expect(symbolTable.getSymbol("var1")).toBeDefined();
102
- expect(symbolTable.getSymbol("var2")).toBeDefined();
103
- expect(symbolTable.getSymbol("func1")).toBeDefined();
104
- expect(symbolTable.size).toBe(3);
126
+ expect(symbolTable.getTSymbol("var1")).toBeDefined();
127
+ expect(symbolTable.getTSymbol("var2")).toBeDefined();
105
128
  });
106
129
  });
107
130
 
108
- describe("hasSymbol", () => {
109
- it("should return true for existing symbol", () => {
110
- symbolTable.addSymbol({
111
- name: "exists",
112
- kind: ESymbolKind.Variable,
113
- sourceFile: "test.cnx",
114
- sourceLine: 1,
115
- sourceLanguage: ESourceLanguage.CNext,
116
- isExported: true,
117
- });
118
-
119
- expect(symbolTable.hasSymbol("exists")).toBe(true);
120
- });
121
-
122
- it("should return false for non-existent symbol", () => {
123
- expect(symbolTable.hasSymbol("notHere")).toBe(false);
124
- });
125
- });
126
-
127
- describe("getOverloads", () => {
128
- it("should return all symbols with same name", () => {
129
- symbolTable.addSymbol({
130
- name: "overloaded",
131
- kind: ESymbolKind.Function,
132
- signature: "int(int)",
133
- sourceFile: "test.cpp",
134
- sourceLine: 1,
135
- sourceLanguage: ESourceLanguage.Cpp,
136
- isExported: true,
137
- });
138
-
139
- symbolTable.addSymbol({
140
- name: "overloaded",
141
- kind: ESymbolKind.Function,
142
- signature: "int(int, int)",
143
- sourceFile: "test.cpp",
144
- sourceLine: 5,
145
- sourceLanguage: ESourceLanguage.Cpp,
146
- isExported: true,
147
- });
148
-
149
- const overloads = symbolTable.getOverloads("overloaded");
150
- expect(overloads.length).toBe(2);
151
- expect(overloads[0].signature).toBe("int(int)");
152
- expect(overloads[1].signature).toBe("int(int, int)");
153
- });
154
-
155
- it("should return empty array for non-existent symbol", () => {
156
- const overloads = symbolTable.getOverloads("noSuchFunction");
157
- expect(overloads).toEqual([]);
158
- });
159
- });
160
-
161
- describe("getAllSymbols", () => {
162
- it("should return all symbols in the table", () => {
163
- symbolTable.addSymbol({
164
- name: "a",
165
- kind: ESymbolKind.Variable,
166
- sourceFile: "test.cnx",
167
- sourceLine: 1,
168
- sourceLanguage: ESourceLanguage.CNext,
169
- isExported: true,
170
- });
131
+ // ========================================================================
132
+ // TCSymbol (C) Operations
133
+ // ========================================================================
171
134
 
172
- symbolTable.addSymbol({
173
- name: "b",
174
- kind: ESymbolKind.Function,
175
- sourceFile: "test.cnx",
176
- sourceLine: 2,
177
- sourceLanguage: ESourceLanguage.CNext,
135
+ describe("addCSymbol and getCSymbol", () => {
136
+ it("should add and retrieve a C symbol", () => {
137
+ const symbol: TCSymbol = {
138
+ kind: "function",
139
+ name: "c_function",
140
+ sourceFile: "test.h",
141
+ sourceLine: 10,
142
+ sourceLanguage: ESourceLanguage.C,
178
143
  isExported: true,
179
- });
144
+ type: "int",
145
+ parameters: [
146
+ { name: "x", type: "int", isConst: false, isArray: false },
147
+ ],
148
+ };
180
149
 
181
- const all = symbolTable.getAllSymbols();
182
- expect(all.length).toBe(2);
183
- expect(all.map((s) => s.name).sort()).toEqual(["a", "b"]);
184
- });
150
+ symbolTable.addCSymbol(symbol);
151
+ const retrieved = symbolTable.getCSymbol("c_function");
185
152
 
186
- it("should return empty array for empty table", () => {
187
- expect(symbolTable.getAllSymbols()).toEqual([]);
153
+ expect(retrieved).toBeDefined();
154
+ expect(retrieved?.name).toBe("c_function");
155
+ expect(retrieved?.kind).toBe("function");
156
+ expect(retrieved?.sourceLanguage).toBe(ESourceLanguage.C);
188
157
  });
189
158
  });
190
159
 
191
- describe("size", () => {
192
- it("should return 0 for empty table", () => {
193
- expect(symbolTable.size).toBe(0);
194
- });
195
-
196
- it("should return correct count including duplicates", () => {
197
- symbolTable.addSymbol({
198
- name: "sym1",
199
- kind: ESymbolKind.Variable,
200
- sourceFile: "test.cnx",
201
- sourceLine: 1,
202
- sourceLanguage: ESourceLanguage.CNext,
203
- isExported: true,
204
- });
205
-
206
- symbolTable.addSymbol({
207
- name: "sym1",
208
- kind: ESymbolKind.Variable,
209
- sourceFile: "test2.cnx",
210
- sourceLine: 1,
211
- sourceLanguage: ESourceLanguage.CNext,
212
- isExported: true,
213
- });
160
+ // ========================================================================
161
+ // TCppSymbol (C++) Operations
162
+ // ========================================================================
214
163
 
215
- symbolTable.addSymbol({
216
- name: "sym2",
217
- kind: ESymbolKind.Function,
218
- sourceFile: "test.cnx",
164
+ describe("addCppSymbol and getCppSymbol", () => {
165
+ it("should add and retrieve a C++ symbol", () => {
166
+ const symbol: TCppSymbol = {
167
+ kind: "class",
168
+ name: "MyClass",
169
+ sourceFile: "test.hpp",
219
170
  sourceLine: 5,
220
- sourceLanguage: ESourceLanguage.CNext,
221
- isExported: true,
222
- });
223
-
224
- expect(symbolTable.size).toBe(3);
225
- });
226
- });
227
-
228
- describe("clear", () => {
229
- it("should remove all symbols", () => {
230
- symbolTable.addSymbol({
231
- name: "toBeCleared",
232
- kind: ESymbolKind.Variable,
233
- sourceFile: "test.cnx",
234
- sourceLine: 1,
235
- sourceLanguage: ESourceLanguage.CNext,
171
+ sourceLanguage: ESourceLanguage.Cpp,
236
172
  isExported: true,
237
- });
238
-
239
- symbolTable.addStructField("MyStruct", "field1", "uint32_t");
240
- symbolTable.markNeedsStructKeyword("CStruct");
241
- symbolTable.addEnumBitWidth("MyEnum", 8);
173
+ };
242
174
 
243
- symbolTable.clear();
175
+ symbolTable.addCppSymbol(symbol);
176
+ const retrieved = symbolTable.getCppSymbol("MyClass");
244
177
 
245
- expect(symbolTable.size).toBe(0);
246
- expect(symbolTable.getSymbol("toBeCleared")).toBeUndefined();
247
- expect(
248
- symbolTable.getStructFieldType("MyStruct", "field1"),
249
- ).toBeUndefined();
250
- expect(symbolTable.checkNeedsStructKeyword("CStruct")).toBe(false);
251
- expect(symbolTable.getEnumBitWidth("MyEnum")).toBeUndefined();
178
+ expect(retrieved).toBeDefined();
179
+ expect(retrieved?.name).toBe("MyClass");
180
+ expect(retrieved?.kind).toBe("class");
181
+ expect(retrieved?.sourceLanguage).toBe(ESourceLanguage.Cpp);
252
182
  });
253
183
  });
254
184
 
255
185
  // ========================================================================
256
- // File-based and Language-based Queries
186
+ // Cross-Language Operations
257
187
  // ========================================================================
258
188
 
259
- describe("getSymbolsByFile", () => {
260
- it("should return symbols from a specific file", () => {
261
- symbolTable.addSymbol({
262
- name: "inFile1",
263
- kind: ESymbolKind.Variable,
264
- sourceFile: "file1.cnx",
265
- sourceLine: 1,
266
- sourceLanguage: ESourceLanguage.CNext,
267
- isExported: true,
268
- });
269
-
270
- symbolTable.addSymbol({
271
- name: "alsoInFile1",
272
- kind: ESymbolKind.Function,
273
- sourceFile: "file1.cnx",
274
- sourceLine: 5,
275
- sourceLanguage: ESourceLanguage.CNext,
276
- isExported: true,
277
- });
278
-
279
- symbolTable.addSymbol({
280
- name: "inFile2",
281
- kind: ESymbolKind.Variable,
282
- sourceFile: "file2.cnx",
283
- sourceLine: 1,
284
- sourceLanguage: ESourceLanguage.CNext,
285
- isExported: true,
286
- });
287
-
288
- const file1Symbols = symbolTable.getSymbolsByFile("file1.cnx");
289
- expect(file1Symbols.length).toBe(2);
290
- expect(file1Symbols.map((s) => s.name).sort()).toEqual([
291
- "alsoInFile1",
292
- "inFile1",
293
- ]);
294
- });
295
-
296
- it("should return empty array for unknown file", () => {
297
- expect(symbolTable.getSymbolsByFile("unknown.cnx")).toEqual([]);
298
- });
299
- });
300
-
301
- describe("getSymbolsByLanguage", () => {
302
- it("should return symbols from a specific language", () => {
303
- symbolTable.addSymbol({
189
+ describe("getAllSymbols", () => {
190
+ it("should return symbols from all languages", () => {
191
+ symbolTable.addTSymbol({
192
+ kind: "variable",
304
193
  name: "cnextVar",
305
- kind: ESymbolKind.Variable,
306
194
  sourceFile: "test.cnx",
307
195
  sourceLine: 1,
308
196
  sourceLanguage: ESourceLanguage.CNext,
309
197
  isExported: true,
198
+ type: TTypeUtils.createPrimitive("u32"),
199
+ isArray: false,
200
+ isConst: false,
201
+ isAtomic: false,
202
+ scope: TestScopeUtils.createMockGlobalScope(),
310
203
  });
311
204
 
312
- symbolTable.addSymbol({
205
+ symbolTable.addCSymbol({
206
+ kind: "variable",
313
207
  name: "cVar",
314
- kind: ESymbolKind.Variable,
315
- sourceFile: "test.c",
208
+ sourceFile: "test.h",
316
209
  sourceLine: 1,
317
210
  sourceLanguage: ESourceLanguage.C,
318
211
  isExported: true,
212
+ type: "int",
319
213
  });
320
214
 
321
- symbolTable.addSymbol({
215
+ symbolTable.addCppSymbol({
216
+ kind: "variable",
322
217
  name: "cppVar",
323
- kind: ESymbolKind.Variable,
324
- sourceFile: "test.cpp",
218
+ sourceFile: "test.hpp",
325
219
  sourceLine: 1,
326
220
  sourceLanguage: ESourceLanguage.Cpp,
327
221
  isExported: true,
222
+ type: "int",
328
223
  });
329
224
 
330
- const cnextSymbols = symbolTable.getSymbolsByLanguage(
331
- ESourceLanguage.CNext,
332
- );
333
- expect(cnextSymbols.length).toBe(1);
334
- expect(cnextSymbols[0].name).toBe("cnextVar");
335
-
336
- const cSymbols = symbolTable.getSymbolsByLanguage(ESourceLanguage.C);
337
- expect(cSymbols.length).toBe(1);
338
- expect(cSymbols[0].name).toBe("cVar");
225
+ const all = symbolTable.getAllSymbols();
226
+ expect(all.length).toBe(3);
339
227
  });
228
+ });
340
229
 
341
- it("should return empty array when no symbols match language", () => {
342
- symbolTable.addSymbol({
343
- name: "cnextOnly",
344
- kind: ESymbolKind.Variable,
230
+ describe("getOverloads", () => {
231
+ it("should return overloads from all languages", () => {
232
+ symbolTable.addTSymbol({
233
+ kind: "function",
234
+ name: "process",
345
235
  sourceFile: "test.cnx",
346
236
  sourceLine: 1,
347
237
  sourceLanguage: ESourceLanguage.CNext,
348
238
  isExported: true,
349
- });
350
-
351
- expect(symbolTable.getSymbolsByLanguage(ESourceLanguage.C)).toEqual([]);
352
- });
353
- });
354
-
355
- // ========================================================================
356
- // Struct Field Operations
357
- // ========================================================================
358
-
359
- describe("struct field operations", () => {
360
- it("should add and retrieve struct field type", () => {
361
- symbolTable.addStructField("Point", "x", "int32_t");
362
- symbolTable.addStructField("Point", "y", "int32_t");
363
-
364
- expect(symbolTable.getStructFieldType("Point", "x")).toBe("int32_t");
365
- expect(symbolTable.getStructFieldType("Point", "y")).toBe("int32_t");
366
- });
367
-
368
- it("should return undefined for unknown struct or field", () => {
369
- symbolTable.addStructField("Point", "x", "int32_t");
370
-
371
- expect(symbolTable.getStructFieldType("Unknown", "x")).toBeUndefined();
372
- expect(symbolTable.getStructFieldType("Point", "z")).toBeUndefined();
373
- });
374
-
375
- it("should add struct field with array dimensions", () => {
376
- symbolTable.addStructField("Buffer", "data", "uint8_t", [256]);
377
- symbolTable.addStructField("Matrix", "values", "float", [4, 4]);
378
-
379
- const bufferField = symbolTable.getStructFieldInfo("Buffer", "data");
380
- expect(bufferField?.type).toBe("uint8_t");
381
- expect(bufferField?.arrayDimensions).toEqual([256]);
382
-
383
- const matrixField = symbolTable.getStructFieldInfo("Matrix", "values");
384
- expect(matrixField?.type).toBe("float");
385
- expect(matrixField?.arrayDimensions).toEqual([4, 4]);
386
- });
387
-
388
- it("should get all fields for a struct", () => {
389
- symbolTable.addStructField("Person", "name", "char*");
390
- symbolTable.addStructField("Person", "age", "uint8_t");
391
- symbolTable.addStructField("Person", "id", "uint32_t");
392
-
393
- const fields = symbolTable.getStructFields("Person");
394
- expect(fields).toBeDefined();
395
- expect(fields?.size).toBe(3);
396
- expect(fields?.get("name")?.type).toBe("char*");
397
- expect(fields?.get("age")?.type).toBe("uint8_t");
398
- });
239
+ returnType: TTypeUtils.createPrimitive("void"),
240
+ parameters: [],
241
+ scope: TestScopeUtils.createMockGlobalScope(),
242
+ visibility: "public",
243
+ body: null,
244
+ } as IFunctionSymbol);
399
245
 
400
- it("should return undefined for unknown struct in getStructFields", () => {
401
- expect(symbolTable.getStructFields("Unknown")).toBeUndefined();
402
- });
403
-
404
- it("should get all struct fields for serialization", () => {
405
- symbolTable.addStructField("A", "x", "int");
406
- symbolTable.addStructField("B", "y", "float");
407
-
408
- const allFields = symbolTable.getAllStructFields();
409
- expect(allFields.size).toBe(2);
410
- expect(allFields.has("A")).toBe(true);
411
- expect(allFields.has("B")).toBe(true);
412
- });
413
-
414
- it("should restore struct fields from cache", () => {
415
- const cached = new Map<
416
- string,
417
- Map<string, { type: string; arrayDimensions?: number[] }>
418
- >();
419
- const pointFields = new Map();
420
- pointFields.set("x", { type: "int32_t" });
421
- pointFields.set("y", { type: "int32_t" });
422
- cached.set("Point", pointFields);
423
-
424
- symbolTable.restoreStructFields(cached);
425
-
426
- expect(symbolTable.getStructFieldType("Point", "x")).toBe("int32_t");
427
- expect(symbolTable.getStructFieldType("Point", "y")).toBe("int32_t");
428
- });
429
-
430
- it("should merge restored struct fields with existing", () => {
431
- symbolTable.addStructField("Point", "x", "int32_t");
432
-
433
- const cached = new Map<
434
- string,
435
- Map<string, { type: string; arrayDimensions?: number[] }>
436
- >();
437
- const pointFields = new Map();
438
- pointFields.set("z", { type: "int32_t" });
439
- cached.set("Point", pointFields);
440
-
441
- symbolTable.restoreStructFields(cached);
442
-
443
- expect(symbolTable.getStructFieldType("Point", "x")).toBe("int32_t");
444
- expect(symbolTable.getStructFieldType("Point", "z")).toBe("int32_t");
445
- });
446
- });
447
-
448
- describe("getStructNamesByFile", () => {
449
- it("should return struct names defined in a file", () => {
450
- // Add a symbol for the struct
451
- symbolTable.addSymbol({
452
- name: "Point",
453
- kind: ESymbolKind.Struct,
454
- sourceFile: "geometry.h",
455
- sourceLine: 1,
456
- sourceLanguage: ESourceLanguage.C,
457
- isExported: true,
458
- });
459
-
460
- // Register struct fields (which marks it as having struct data)
461
- symbolTable.addStructField("Point", "x", "int");
462
- symbolTable.addStructField("Point", "y", "int");
463
-
464
- const structNames = symbolTable.getStructNamesByFile("geometry.h");
465
- expect(structNames).toContain("Point");
466
- });
467
-
468
- it("should return empty array for file with no structs", () => {
469
- symbolTable.addSymbol({
470
- name: "someVar",
471
- kind: ESymbolKind.Variable,
472
- sourceFile: "vars.cnx",
246
+ symbolTable.addCppSymbol({
247
+ kind: "function",
248
+ name: "process",
249
+ sourceFile: "test.hpp",
473
250
  sourceLine: 1,
474
- sourceLanguage: ESourceLanguage.CNext,
251
+ sourceLanguage: ESourceLanguage.Cpp,
475
252
  isExported: true,
253
+ type: "void",
254
+ parameters: [
255
+ { name: "x", type: "int", isConst: false, isArray: false },
256
+ ],
476
257
  });
477
258
 
478
- expect(symbolTable.getStructNamesByFile("vars.cnx")).toEqual([]);
479
- });
480
-
481
- it("should return empty array for unknown file", () => {
482
- expect(symbolTable.getStructNamesByFile("nonexistent.cnx")).toEqual([]);
483
- });
484
- });
485
-
486
- // ========================================================================
487
- // Struct Keyword Tracking (Issue #196)
488
- // ========================================================================
489
-
490
- describe("struct keyword tracking", () => {
491
- it("should mark and check if struct needs keyword", () => {
492
- symbolTable.markNeedsStructKeyword("NamedPoint");
493
-
494
- expect(symbolTable.checkNeedsStructKeyword("NamedPoint")).toBe(true);
495
- expect(symbolTable.checkNeedsStructKeyword("OtherStruct")).toBe(false);
496
- });
497
-
498
- it("should get all structs needing keyword", () => {
499
- symbolTable.markNeedsStructKeyword("Struct1");
500
- symbolTable.markNeedsStructKeyword("Struct2");
501
- symbolTable.markNeedsStructKeyword("Struct3");
502
-
503
- const all = symbolTable.getAllNeedsStructKeyword();
504
- expect(all.length).toBe(3);
505
- expect(all.sort()).toEqual(["Struct1", "Struct2", "Struct3"]);
506
- });
507
-
508
- it("should restore struct keyword set from cache", () => {
509
- symbolTable.restoreNeedsStructKeyword(["CachedStruct1", "CachedStruct2"]);
510
-
511
- expect(symbolTable.checkNeedsStructKeyword("CachedStruct1")).toBe(true);
512
- expect(symbolTable.checkNeedsStructKeyword("CachedStruct2")).toBe(true);
513
- expect(symbolTable.checkNeedsStructKeyword("NotCached")).toBe(false);
514
- });
515
- });
516
-
517
- // ========================================================================
518
- // Enum Bit Width Tracking (Issue #208)
519
- // ========================================================================
520
-
521
- describe("enum bit width tracking", () => {
522
- it("should add and get enum bit width", () => {
523
- symbolTable.addEnumBitWidth("EPressureType", 8);
524
- symbolTable.addEnumBitWidth("ELargeEnum", 32);
525
-
526
- expect(symbolTable.getEnumBitWidth("EPressureType")).toBe(8);
527
- expect(symbolTable.getEnumBitWidth("ELargeEnum")).toBe(32);
528
- });
529
-
530
- it("should return undefined for unknown enum", () => {
531
- expect(symbolTable.getEnumBitWidth("UnknownEnum")).toBeUndefined();
532
- });
533
-
534
- it("should get all enum bit widths for serialization", () => {
535
- symbolTable.addEnumBitWidth("Enum8", 8);
536
- symbolTable.addEnumBitWidth("Enum16", 16);
537
-
538
- const allWidths = symbolTable.getAllEnumBitWidths();
539
- expect(allWidths.size).toBe(2);
540
- expect(allWidths.get("Enum8")).toBe(8);
541
- expect(allWidths.get("Enum16")).toBe(16);
542
- });
543
-
544
- it("should restore enum bit widths from cache", () => {
545
- const cached = new Map<string, number>();
546
- cached.set("CachedEnum1", 8);
547
- cached.set("CachedEnum2", 16);
548
-
549
- symbolTable.restoreEnumBitWidths(cached);
550
-
551
- expect(symbolTable.getEnumBitWidth("CachedEnum1")).toBe(8);
552
- expect(symbolTable.getEnumBitWidth("CachedEnum2")).toBe(16);
259
+ const overloads = symbolTable.getOverloads("process");
260
+ expect(overloads.length).toBe(2);
553
261
  });
554
262
  });
555
263
 
556
264
  // ========================================================================
557
- // hasConflict Method
265
+ // Conflict Detection
558
266
  // ========================================================================
559
267
 
560
268
  describe("hasConflict", () => {
561
- it("should return true when symbol has conflicts", () => {
562
- symbolTable.addSymbol({
563
- name: "conflicted",
564
- kind: ESymbolKind.Variable,
565
- sourceFile: "file1.cnx",
269
+ it("should detect cross-language conflicts between C-Next and C", () => {
270
+ symbolTable.addTSymbol({
271
+ kind: "function",
272
+ name: "conflictFunc",
273
+ sourceFile: "test.cnx",
566
274
  sourceLine: 1,
567
275
  sourceLanguage: ESourceLanguage.CNext,
568
276
  isExported: true,
569
- });
277
+ returnType: TTypeUtils.createPrimitive("void"),
278
+ parameters: [],
279
+ scope: TestScopeUtils.createMockGlobalScope(),
280
+ visibility: "public",
281
+ body: null,
282
+ } as IFunctionSymbol);
570
283
 
571
- symbolTable.addSymbol({
572
- name: "conflicted",
573
- kind: ESymbolKind.Variable,
574
- sourceFile: "file2.cnx",
284
+ symbolTable.addCSymbol({
285
+ kind: "function",
286
+ name: "conflictFunc",
287
+ sourceFile: "test.h",
575
288
  sourceLine: 1,
576
- sourceLanguage: ESourceLanguage.CNext,
289
+ sourceLanguage: ESourceLanguage.C,
577
290
  isExported: true,
291
+ type: "void",
292
+ parameters: [],
578
293
  });
579
294
 
580
- expect(symbolTable.hasConflict("conflicted")).toBe(true);
295
+ expect(symbolTable.hasConflict("conflictFunc")).toBe(true);
581
296
  });
582
297
 
583
- it("should return false when symbol has no conflicts", () => {
584
- symbolTable.addSymbol({
585
- name: "unique",
586
- kind: ESymbolKind.Variable,
587
- sourceFile: "file1.cnx",
298
+ it("should not detect conflict for C++ function overloads with different signatures", () => {
299
+ symbolTable.addCppSymbol({
300
+ kind: "function",
301
+ name: "overloaded",
302
+ sourceFile: "test.hpp",
588
303
  sourceLine: 1,
589
- sourceLanguage: ESourceLanguage.CNext,
304
+ sourceLanguage: ESourceLanguage.Cpp,
590
305
  isExported: true,
306
+ type: "void",
307
+ parameters: [],
591
308
  });
592
309
 
593
- expect(symbolTable.hasConflict("unique")).toBe(false);
594
- });
310
+ symbolTable.addCppSymbol({
311
+ kind: "function",
312
+ name: "overloaded",
313
+ sourceFile: "test.hpp",
314
+ sourceLine: 5,
315
+ sourceLanguage: ESourceLanguage.Cpp,
316
+ isExported: true,
317
+ type: "void",
318
+ parameters: [
319
+ { name: "x", type: "int", isConst: false, isArray: false },
320
+ ],
321
+ });
595
322
 
596
- it("should return false for non-existent symbol", () => {
597
- expect(symbolTable.hasConflict("doesNotExist")).toBe(false);
323
+ expect(symbolTable.hasConflict("overloaded")).toBe(false);
598
324
  });
599
325
  });
600
326
 
601
327
  // ========================================================================
602
- // Conflict Detection (existing tests)
328
+ // Type-Safe Symbol Queries
603
329
  // ========================================================================
604
330
 
605
- describe("conflict detection", () => {
606
- it("should detect conflicts between two global variables with same name", () => {
607
- // Two global variables with same name = conflict
608
- symbolTable.addSymbol({
609
- name: "counter",
610
- kind: ESymbolKind.Variable,
611
- sourceFile: "file1.cnx",
331
+ describe("type-safe queries", () => {
332
+ it("getStructSymbols should return only struct symbols", () => {
333
+ symbolTable.addTSymbol({
334
+ kind: "struct",
335
+ name: "MyStruct",
336
+ sourceFile: "test.cnx",
612
337
  sourceLine: 1,
613
338
  sourceLanguage: ESourceLanguage.CNext,
614
339
  isExported: true,
615
- });
340
+ fields: new Map(),
341
+ scope: TestScopeUtils.createMockGlobalScope(),
342
+ } as IStructSymbol);
616
343
 
617
- symbolTable.addSymbol({
618
- name: "counter",
619
- kind: ESymbolKind.Variable,
620
- sourceFile: "file2.cnx",
621
- sourceLine: 5,
344
+ symbolTable.addTSymbol({
345
+ kind: "variable",
346
+ name: "myVar",
347
+ sourceFile: "test.cnx",
348
+ sourceLine: 2,
622
349
  sourceLanguage: ESourceLanguage.CNext,
623
350
  isExported: true,
351
+ type: TTypeUtils.createPrimitive("u32"),
352
+ isArray: false,
353
+ isConst: false,
354
+ isAtomic: false,
355
+ scope: TestScopeUtils.createMockGlobalScope(),
624
356
  });
625
357
 
626
- const conflicts = symbolTable.getConflicts();
627
- expect(conflicts.length).toBe(1);
628
- expect(conflicts[0].symbolName).toBe("counter");
358
+ const structs = symbolTable.getStructSymbols();
359
+ expect(structs.length).toBe(1);
360
+ expect(structs[0].name).toBe("MyStruct");
629
361
  });
630
362
 
631
- it("should NOT detect conflicts between function parameters with same name (Issue #221)", () => {
632
- // This is the bug: parameters 'x' in different functions should NOT conflict
633
-
634
- // Add function Math_add
635
- symbolTable.addSymbol({
636
- name: "Math_add",
637
- kind: ESymbolKind.Function,
638
- type: "f32",
639
- sourceFile: "math.cnx",
640
- sourceLine: 1,
641
- sourceLanguage: ESourceLanguage.CNext,
642
- isExported: true,
643
- parent: "Math",
644
- });
645
-
646
- // Add parameter 'x' for Math_add
647
- symbolTable.addSymbol({
648
- name: "x",
649
- kind: ESymbolKind.Variable,
650
- type: "f32",
651
- sourceFile: "math.cnx",
652
- sourceLine: 1,
653
- sourceLanguage: ESourceLanguage.CNext,
654
- parent: "Math_add", // Parent is the function
655
- isExported: false,
656
- });
657
-
658
- // Add parameter 'y' for Math_add
659
- symbolTable.addSymbol({
660
- name: "y",
661
- kind: ESymbolKind.Variable,
662
- type: "f32",
663
- sourceFile: "math.cnx",
363
+ it("getEnumSymbols should return only enum symbols", () => {
364
+ symbolTable.addTSymbol({
365
+ kind: "enum",
366
+ name: "MyEnum",
367
+ sourceFile: "test.cnx",
664
368
  sourceLine: 1,
665
369
  sourceLanguage: ESourceLanguage.CNext,
666
- parent: "Math_add",
667
- isExported: false,
668
- });
669
-
670
- // Add function Math_multiply
671
- symbolTable.addSymbol({
672
- name: "Math_multiply",
673
- kind: ESymbolKind.Function,
674
- type: "f32",
675
- sourceFile: "math.cnx",
676
- sourceLine: 5,
677
- sourceLanguage: ESourceLanguage.CNext,
678
370
  isExported: true,
679
- parent: "Math",
680
- });
681
-
682
- // Add parameter 'x' for Math_multiply - same name as Math_add's x
683
- symbolTable.addSymbol({
684
- name: "x",
685
- kind: ESymbolKind.Variable,
686
- type: "f32",
687
- sourceFile: "math.cnx",
688
- sourceLine: 5,
689
- sourceLanguage: ESourceLanguage.CNext,
690
- parent: "Math_multiply", // Different parent function
691
- isExported: false,
692
- });
693
-
694
- // Add parameter 'y' for Math_multiply
695
- symbolTable.addSymbol({
696
- name: "y",
697
- kind: ESymbolKind.Variable,
698
- type: "f32",
699
- sourceFile: "math.cnx",
700
- sourceLine: 5,
701
- sourceLanguage: ESourceLanguage.CNext,
702
- parent: "Math_multiply",
703
- isExported: false,
704
- });
371
+ members: new Map([["VALUE1", 0]]),
372
+ scope: TestScopeUtils.createMockGlobalScope(),
373
+ } as IEnumSymbol);
705
374
 
706
- // There should be NO conflicts - parameters are scoped to their functions
707
- const conflicts = symbolTable.getConflicts();
708
- expect(conflicts.length).toBe(0);
375
+ const enums = symbolTable.getEnumSymbols();
376
+ expect(enums.length).toBe(1);
377
+ expect(enums[0].name).toBe("MyEnum");
709
378
  });
710
379
 
711
- it("should still detect conflicts for scope-level variables with same qualified name", () => {
712
- // Two scope-level variables with same qualified name = conflict
713
- symbolTable.addSymbol({
714
- name: "Math_counter",
715
- kind: ESymbolKind.Variable,
716
- sourceFile: "file1.cnx",
380
+ it("getFunctionSymbols should return only function symbols", () => {
381
+ symbolTable.addTSymbol({
382
+ kind: "function",
383
+ name: "myFunc",
384
+ sourceFile: "test.cnx",
717
385
  sourceLine: 1,
718
386
  sourceLanguage: ESourceLanguage.CNext,
719
387
  isExported: true,
720
- parent: "Math",
721
- });
722
-
723
- symbolTable.addSymbol({
724
- name: "Math_counter",
725
- kind: ESymbolKind.Variable,
726
- sourceFile: "file2.cnx",
727
- sourceLine: 5,
728
- sourceLanguage: ESourceLanguage.CNext,
729
- isExported: true,
730
- parent: "Math",
731
- });
388
+ returnType: TTypeUtils.createPrimitive("void"),
389
+ parameters: [],
390
+ scope: TestScopeUtils.createMockGlobalScope(),
391
+ visibility: "public",
392
+ body: null,
393
+ } as IFunctionSymbol);
732
394
 
733
- const conflicts = symbolTable.getConflicts();
734
- expect(conflicts.length).toBe(1);
735
- expect(conflicts[0].symbolName).toBe("Math_counter");
395
+ const functions = symbolTable.getFunctionSymbols();
396
+ expect(functions.length).toBe(1);
397
+ expect(functions[0].name).toBe("myFunc");
736
398
  });
399
+ });
737
400
 
738
- it("should not conflict when a global function and scope function have same parameter names", () => {
739
- // Global function 'divide' with parameter 'x'
740
- symbolTable.addSymbol({
741
- name: "divide",
742
- kind: ESymbolKind.Function,
743
- type: "f32",
744
- sourceFile: "math.cnx",
745
- sourceLine: 10,
746
- sourceLanguage: ESourceLanguage.CNext,
747
- isExported: true,
748
- });
749
-
750
- symbolTable.addSymbol({
751
- name: "x",
752
- kind: ESymbolKind.Variable,
753
- type: "f32",
754
- sourceFile: "math.cnx",
755
- sourceLine: 10,
756
- sourceLanguage: ESourceLanguage.CNext,
757
- parent: "divide",
758
- isExported: false,
759
- });
760
-
761
- // Scope function 'Math_add' with parameter 'x'
762
- symbolTable.addSymbol({
763
- name: "Math_add",
764
- kind: ESymbolKind.Function,
765
- type: "f32",
766
- sourceFile: "math.cnx",
767
- sourceLine: 1,
768
- sourceLanguage: ESourceLanguage.CNext,
769
- isExported: true,
770
- parent: "Math",
771
- });
401
+ // ========================================================================
402
+ // Struct Field Information
403
+ // ========================================================================
772
404
 
773
- symbolTable.addSymbol({
774
- name: "x",
775
- kind: ESymbolKind.Variable,
776
- type: "f32",
777
- sourceFile: "math.cnx",
778
- sourceLine: 1,
779
- sourceLanguage: ESourceLanguage.CNext,
780
- parent: "Math_add",
781
- isExported: false,
782
- });
405
+ describe("struct fields", () => {
406
+ it("should add and retrieve struct field information", () => {
407
+ symbolTable.addStructField("Point", "x", "int");
408
+ symbolTable.addStructField("Point", "y", "int");
783
409
 
784
- // No conflicts - both 'x' are function parameters with different parents
785
- const conflicts = symbolTable.getConflicts();
786
- expect(conflicts.length).toBe(0);
410
+ expect(symbolTable.getStructFieldType("Point", "x")).toBe("int");
411
+ expect(symbolTable.getStructFieldType("Point", "y")).toBe("int");
787
412
  });
788
413
 
789
- it("should detect cross-language conflict between C-Next and C", () => {
790
- // Same symbol in C-Next and C = ERROR
791
- symbolTable.addSymbol({
792
- name: "sharedVar",
793
- kind: ESymbolKind.Variable,
794
- sourceFile: "module.cnx",
795
- sourceLine: 1,
796
- sourceLanguage: ESourceLanguage.CNext,
797
- isExported: true,
798
- });
799
-
800
- symbolTable.addSymbol({
801
- name: "sharedVar",
802
- kind: ESymbolKind.Variable,
803
- sourceFile: "legacy.c",
804
- sourceLine: 10,
805
- sourceLanguage: ESourceLanguage.C,
806
- isExported: true,
807
- });
808
-
809
- const conflicts = symbolTable.getConflicts();
810
- expect(conflicts.length).toBe(1);
811
- expect(conflicts[0].symbolName).toBe("sharedVar");
812
- expect(conflicts[0].severity).toBe("error");
813
- expect(conflicts[0].message).toContain("defined in multiple languages");
414
+ it("should return undefined for non-existent struct or field", () => {
415
+ expect(
416
+ symbolTable.getStructFieldType("NonExistent", "x"),
417
+ ).toBeUndefined();
814
418
  });
815
419
 
816
- it("should detect cross-language conflict between C-Next and C++", () => {
817
- // Same symbol in C-Next and C++ = ERROR
818
- symbolTable.addSymbol({
819
- name: "sharedFunc",
820
- kind: ESymbolKind.Function,
821
- sourceFile: "module.cnx",
822
- sourceLine: 1,
823
- sourceLanguage: ESourceLanguage.CNext,
824
- isExported: true,
825
- });
826
-
827
- symbolTable.addSymbol({
828
- name: "sharedFunc",
829
- kind: ESymbolKind.Function,
830
- sourceFile: "driver.cpp",
831
- sourceLine: 20,
832
- sourceLanguage: ESourceLanguage.Cpp,
833
- isExported: true,
834
- });
420
+ it("should get all fields for a struct", () => {
421
+ symbolTable.addStructField("Point", "x", "int");
422
+ symbolTable.addStructField("Point", "y", "int");
835
423
 
836
- const conflicts = symbolTable.getConflicts();
837
- expect(conflicts.length).toBe(1);
838
- expect(conflicts[0].symbolName).toBe("sharedFunc");
839
- expect(conflicts[0].severity).toBe("error");
424
+ const fields = symbolTable.getStructFields("Point");
425
+ expect(fields?.size).toBe(2);
840
426
  });
427
+ });
841
428
 
842
- it("should allow same symbol in C and C++ (common pattern)", () => {
843
- // Same symbol in C and C++ is typically OK (e.g., header included by both)
844
- symbolTable.addSymbol({
845
- name: "commonSymbol",
846
- kind: ESymbolKind.Variable,
847
- sourceFile: "shared.c",
848
- sourceLine: 1,
849
- sourceLanguage: ESourceLanguage.C,
850
- isExported: true,
851
- });
429
+ // ========================================================================
430
+ // Needs Struct Keyword Tracking
431
+ // ========================================================================
852
432
 
853
- symbolTable.addSymbol({
854
- name: "commonSymbol",
855
- kind: ESymbolKind.Variable,
856
- sourceFile: "wrapper.cpp",
857
- sourceLine: 5,
858
- sourceLanguage: ESourceLanguage.Cpp,
859
- isExported: true,
860
- });
433
+ describe("needsStructKeyword", () => {
434
+ it("should track structs requiring struct keyword", () => {
435
+ symbolTable.markNeedsStructKeyword("RawStruct");
861
436
 
862
- const conflicts = symbolTable.getConflicts();
863
- expect(conflicts.length).toBe(0);
437
+ expect(symbolTable.checkNeedsStructKeyword("RawStruct")).toBe(true);
438
+ expect(symbolTable.checkNeedsStructKeyword("OtherStruct")).toBe(false);
864
439
  });
440
+ });
865
441
 
866
- it("should allow C++ function overloads with different signatures", () => {
867
- symbolTable.addSymbol({
868
- name: "process",
869
- kind: ESymbolKind.Function,
870
- signature: "void(int)",
871
- sourceFile: "utils.cpp",
872
- sourceLine: 1,
873
- sourceLanguage: ESourceLanguage.Cpp,
874
- isExported: true,
875
- });
876
-
877
- symbolTable.addSymbol({
878
- name: "process",
879
- kind: ESymbolKind.Function,
880
- signature: "void(int, int)",
881
- sourceFile: "utils.cpp",
882
- sourceLine: 10,
883
- sourceLanguage: ESourceLanguage.Cpp,
884
- isExported: true,
885
- });
442
+ // ========================================================================
443
+ // Enum Bit Width Tracking
444
+ // ========================================================================
886
445
 
887
- symbolTable.addSymbol({
888
- name: "process",
889
- kind: ESymbolKind.Function,
890
- signature: "void(float)",
891
- sourceFile: "utils.cpp",
892
- sourceLine: 20,
893
- sourceLanguage: ESourceLanguage.Cpp,
894
- isExported: true,
895
- });
446
+ describe("enumBitWidth", () => {
447
+ it("should track enum bit widths", () => {
448
+ symbolTable.addEnumBitWidth("SmallEnum", 8);
449
+ symbolTable.addEnumBitWidth("LargeEnum", 32);
896
450
 
897
- const conflicts = symbolTable.getConflicts();
898
- expect(conflicts.length).toBe(0);
451
+ expect(symbolTable.getEnumBitWidth("SmallEnum")).toBe(8);
452
+ expect(symbolTable.getEnumBitWidth("LargeEnum")).toBe(32);
453
+ expect(symbolTable.getEnumBitWidth("UnknownEnum")).toBeUndefined();
899
454
  });
455
+ });
900
456
 
901
- it("should not count extern declarations as conflicts", () => {
902
- // extern declarations are not definitions
903
- symbolTable.addSymbol({
904
- name: "externVar",
905
- kind: ESymbolKind.Variable,
906
- sourceFile: "header.h",
907
- sourceLine: 1,
908
- sourceLanguage: ESourceLanguage.C,
909
- isExported: true,
910
- isDeclaration: true, // extern declaration
911
- });
912
-
913
- symbolTable.addSymbol({
914
- name: "externVar",
915
- kind: ESymbolKind.Variable,
916
- sourceFile: "impl.c",
917
- sourceLine: 10,
918
- sourceLanguage: ESourceLanguage.C,
919
- isExported: true,
920
- isDeclaration: false, // actual definition
921
- });
922
-
923
- const conflicts = symbolTable.getConflicts();
924
- expect(conflicts.length).toBe(0);
925
- });
457
+ // ========================================================================
458
+ // Clear
459
+ // ========================================================================
926
460
 
927
- it("should detect conflicts for scope functions with same qualified name", () => {
928
- // Two scope functions (non-variable with parent) with same name = conflict
929
- symbolTable.addSymbol({
930
- name: "Math_calculate",
931
- kind: ESymbolKind.Function,
932
- type: "i32",
933
- sourceFile: "math1.cnx",
461
+ describe("clear", () => {
462
+ it("should clear all symbols", () => {
463
+ symbolTable.addTSymbol({
464
+ kind: "variable",
465
+ name: "test",
466
+ sourceFile: "test.cnx",
934
467
  sourceLine: 1,
935
468
  sourceLanguage: ESourceLanguage.CNext,
936
469
  isExported: true,
937
- parent: "Math",
470
+ type: TTypeUtils.createPrimitive("u32"),
471
+ isArray: false,
472
+ isConst: false,
473
+ isAtomic: false,
474
+ scope: TestScopeUtils.createMockGlobalScope(),
938
475
  });
939
476
 
940
- symbolTable.addSymbol({
941
- name: "Math_calculate",
942
- kind: ESymbolKind.Function,
943
- type: "i32",
944
- sourceFile: "math2.cnx",
945
- sourceLine: 5,
946
- sourceLanguage: ESourceLanguage.CNext,
947
- isExported: true,
948
- parent: "Math",
949
- });
950
-
951
- const conflicts = symbolTable.getConflicts();
952
- expect(conflicts.length).toBe(1);
953
- expect(conflicts[0].symbolName).toBe("Math_calculate");
954
- });
955
-
956
- it("should allow multiple C definitions (fallback case)", () => {
957
- // Multiple C definitions - no conflict detection for C-only (handled by C compiler)
958
- symbolTable.addSymbol({
959
- name: "cOnlyVar",
960
- kind: ESymbolKind.Variable,
961
- sourceFile: "file1.c",
962
- sourceLine: 1,
963
- sourceLanguage: ESourceLanguage.C,
964
- isExported: true,
965
- });
477
+ symbolTable.addStructField("Point", "x", "int");
478
+ symbolTable.markNeedsStructKeyword("RawStruct");
479
+ symbolTable.addEnumBitWidth("SmallEnum", 8);
966
480
 
967
- symbolTable.addSymbol({
968
- name: "cOnlyVar",
969
- kind: ESymbolKind.Variable,
970
- sourceFile: "file2.c",
971
- sourceLine: 5,
972
- sourceLanguage: ESourceLanguage.C,
973
- isExported: true,
974
- });
481
+ symbolTable.clear();
975
482
 
976
- // C-only conflicts are left to the C compiler to detect
977
- const conflicts = symbolTable.getConflicts();
978
- expect(conflicts.length).toBe(0);
483
+ expect(symbolTable.getAllSymbols().length).toBe(0);
484
+ expect(symbolTable.getStructFieldType("Point", "x")).toBeUndefined();
485
+ expect(symbolTable.checkNeedsStructKeyword("RawStruct")).toBe(false);
486
+ expect(symbolTable.getEnumBitWidth("SmallEnum")).toBeUndefined();
979
487
  });
980
488
  });
981
489
  });