@holoscript/core 2.0.1 → 2.0.2

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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chunk-3N67RLQP.cjs +1298 -0
  3. package/dist/chunk-3N67RLQP.cjs.map +1 -0
  4. package/dist/chunk-3X2EGU7Z.cjs +52 -0
  5. package/dist/chunk-3X2EGU7Z.cjs.map +1 -0
  6. package/dist/chunk-4CV4JOE5.js +24 -0
  7. package/dist/chunk-4CV4JOE5.js.map +1 -0
  8. package/dist/chunk-4OHVW4XR.cjs +1027 -0
  9. package/dist/chunk-4OHVW4XR.cjs.map +1 -0
  10. package/dist/chunk-CZLDE2OZ.cjs +28 -0
  11. package/dist/chunk-CZLDE2OZ.cjs.map +1 -0
  12. package/{src/HoloScriptRuntime.ts → dist/chunk-EU6CZMGJ.js} +437 -794
  13. package/dist/chunk-EU6CZMGJ.js.map +1 -0
  14. package/dist/chunk-KWYIVRIH.js +344 -0
  15. package/dist/chunk-KWYIVRIH.js.map +1 -0
  16. package/dist/chunk-MCP6D4LT.js +1025 -0
  17. package/dist/chunk-MCP6D4LT.js.map +1 -0
  18. package/dist/chunk-SATNCODL.js +45 -0
  19. package/dist/chunk-SATNCODL.js.map +1 -0
  20. package/dist/chunk-VMZN4EVR.cjs +347 -0
  21. package/dist/chunk-VMZN4EVR.cjs.map +1 -0
  22. package/{src/HoloScriptDebugger.ts → dist/chunk-VYIDLUCV.js} +118 -257
  23. package/dist/chunk-VYIDLUCV.js.map +1 -0
  24. package/dist/chunk-WFI4T3XB.cjs +424 -0
  25. package/dist/chunk-WFI4T3XB.cjs.map +1 -0
  26. package/dist/debugger.cjs +20 -0
  27. package/dist/debugger.cjs.map +1 -0
  28. package/dist/debugger.d.cts +171 -0
  29. package/dist/debugger.d.ts +171 -0
  30. package/dist/debugger.js +7 -0
  31. package/dist/debugger.js.map +1 -0
  32. package/dist/index.cjs +6006 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.cts +2482 -0
  35. package/dist/index.d.ts +2482 -0
  36. package/dist/index.js +5926 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/parser.cjs +14 -0
  39. package/dist/parser.cjs.map +1 -0
  40. package/dist/parser.d.cts +139 -0
  41. package/dist/parser.d.ts +139 -0
  42. package/dist/parser.js +5 -0
  43. package/dist/parser.js.map +1 -0
  44. package/dist/runtime.cjs +14 -0
  45. package/dist/runtime.cjs.map +1 -0
  46. package/dist/runtime.d.cts +180 -0
  47. package/dist/runtime.d.ts +180 -0
  48. package/dist/runtime.js +5 -0
  49. package/dist/runtime.js.map +1 -0
  50. package/dist/type-checker.cjs +17 -0
  51. package/dist/type-checker.cjs.map +1 -0
  52. package/dist/type-checker.d.cts +105 -0
  53. package/dist/type-checker.d.ts +105 -0
  54. package/dist/type-checker.js +4 -0
  55. package/dist/type-checker.js.map +1 -0
  56. package/dist/types-D6g4ACjP.d.cts +262 -0
  57. package/dist/types-D6g4ACjP.d.ts +262 -0
  58. package/package.json +11 -8
  59. package/src/HoloScript2DParser.js +0 -227
  60. package/src/HoloScript2DParser.ts +0 -261
  61. package/src/HoloScriptCodeParser.js +0 -1102
  62. package/src/HoloScriptCodeParser.ts +0 -1188
  63. package/src/HoloScriptDebugger.js +0 -458
  64. package/src/HoloScriptParser.js +0 -338
  65. package/src/HoloScriptParser.ts +0 -397
  66. package/src/HoloScriptPlusParser.js +0 -371
  67. package/src/HoloScriptPlusParser.ts +0 -543
  68. package/src/HoloScriptRuntime.js +0 -1399
  69. package/src/HoloScriptRuntime.test.js +0 -351
  70. package/src/HoloScriptRuntime.test.ts +0 -436
  71. package/src/HoloScriptTypeChecker.js +0 -356
  72. package/src/HoloScriptTypeChecker.ts +0 -475
  73. package/src/__tests__/GraphicsServices.test.js +0 -357
  74. package/src/__tests__/GraphicsServices.test.ts +0 -427
  75. package/src/__tests__/HoloScriptPlusParser.test.js +0 -317
  76. package/src/__tests__/HoloScriptPlusParser.test.ts +0 -392
  77. package/src/__tests__/integration.test.js +0 -336
  78. package/src/__tests__/integration.test.ts +0 -416
  79. package/src/__tests__/performance.bench.js +0 -218
  80. package/src/__tests__/performance.bench.ts +0 -262
  81. package/src/__tests__/type-checker.test.js +0 -60
  82. package/src/__tests__/type-checker.test.ts +0 -73
  83. package/src/index.js +0 -217
  84. package/src/index.ts +0 -426
  85. package/src/interop/Interoperability.js +0 -413
  86. package/src/interop/Interoperability.ts +0 -494
  87. package/src/logger.js +0 -42
  88. package/src/logger.ts +0 -57
  89. package/src/parser/EnhancedParser.js +0 -205
  90. package/src/parser/EnhancedParser.ts +0 -251
  91. package/src/parser/HoloScriptPlusParser.js +0 -928
  92. package/src/parser/HoloScriptPlusParser.ts +0 -1089
  93. package/src/runtime/HoloScriptPlusRuntime.js +0 -674
  94. package/src/runtime/HoloScriptPlusRuntime.ts +0 -861
  95. package/src/runtime/PerformanceTelemetry.js +0 -323
  96. package/src/runtime/PerformanceTelemetry.ts +0 -467
  97. package/src/runtime/RuntimeOptimization.js +0 -361
  98. package/src/runtime/RuntimeOptimization.ts +0 -416
  99. package/src/services/HololandGraphicsPipelineService.js +0 -506
  100. package/src/services/HololandGraphicsPipelineService.ts +0 -662
  101. package/src/services/PlatformPerformanceOptimizer.js +0 -356
  102. package/src/services/PlatformPerformanceOptimizer.ts +0 -503
  103. package/src/state/ReactiveState.js +0 -427
  104. package/src/state/ReactiveState.ts +0 -572
  105. package/src/tools/DeveloperExperience.js +0 -376
  106. package/src/tools/DeveloperExperience.ts +0 -438
  107. package/src/traits/AIDriverTrait.js +0 -322
  108. package/src/traits/AIDriverTrait.test.js +0 -329
  109. package/src/traits/AIDriverTrait.test.ts +0 -357
  110. package/src/traits/AIDriverTrait.ts +0 -474
  111. package/src/traits/LightingTrait.js +0 -313
  112. package/src/traits/LightingTrait.test.js +0 -410
  113. package/src/traits/LightingTrait.test.ts +0 -462
  114. package/src/traits/LightingTrait.ts +0 -505
  115. package/src/traits/MaterialTrait.js +0 -194
  116. package/src/traits/MaterialTrait.test.js +0 -286
  117. package/src/traits/MaterialTrait.test.ts +0 -329
  118. package/src/traits/MaterialTrait.ts +0 -324
  119. package/src/traits/RenderingTrait.js +0 -356
  120. package/src/traits/RenderingTrait.test.js +0 -363
  121. package/src/traits/RenderingTrait.test.ts +0 -427
  122. package/src/traits/RenderingTrait.ts +0 -555
  123. package/src/traits/VRTraitSystem.js +0 -740
  124. package/src/traits/VRTraitSystem.ts +0 -1040
  125. package/src/traits/VoiceInputTrait.js +0 -284
  126. package/src/traits/VoiceInputTrait.test.js +0 -226
  127. package/src/traits/VoiceInputTrait.test.ts +0 -252
  128. package/src/traits/VoiceInputTrait.ts +0 -401
  129. package/src/types/AdvancedTypeSystem.js +0 -226
  130. package/src/types/AdvancedTypeSystem.ts +0 -494
  131. package/src/types/HoloScriptPlus.d.ts +0 -853
  132. package/src/types.js +0 -6
  133. package/src/types.ts +0 -369
  134. package/tsconfig.json +0 -23
  135. package/tsup.config.d.ts +0 -2
  136. package/tsup.config.js +0 -18
  137. package/tsup.config.ts +0 -19
@@ -1,475 +0,0 @@
1
- /**
2
- * HoloScript Type Checker
3
- *
4
- * Static type analysis for HoloScript code.
5
- * Validates types, detects errors, and provides type information.
6
- */
7
-
8
- import type {
9
- ASTNode,
10
- OrbNode,
11
- MethodNode,
12
- ConnectionNode,
13
- GateNode,
14
- StreamNode,
15
- VariableDeclarationNode,
16
- ForLoopNode,
17
- WhileLoopNode,
18
- ForEachLoopNode,
19
- ImportNode,
20
- ExportNode,
21
- } from './types';
22
-
23
- // Type system types
24
- export type HoloScriptType =
25
- | 'number'
26
- | 'string'
27
- | 'boolean'
28
- | 'array'
29
- | 'object'
30
- | 'function'
31
- | 'void'
32
- | 'any'
33
- | 'unknown'
34
- | 'never'
35
- | 'orb'
36
- | 'stream'
37
- | 'connection'
38
- | 'gate';
39
-
40
- export interface TypeInfo {
41
- type: HoloScriptType;
42
- elementType?: HoloScriptType; // For arrays
43
- properties?: Map<string, TypeInfo>; // For objects/orbs
44
- parameters?: ParameterType[]; // For functions
45
- returnType?: HoloScriptType; // For functions
46
- nullable?: boolean;
47
- }
48
-
49
- export interface ParameterType {
50
- name: string;
51
- type: HoloScriptType;
52
- optional?: boolean;
53
- defaultValue?: unknown;
54
- }
55
-
56
- export interface TypeDiagnostic {
57
- severity: 'error' | 'warning' | 'info';
58
- message: string;
59
- line: number;
60
- column: number;
61
- code: string;
62
- suggestions?: string[];
63
- }
64
-
65
- export interface TypeCheckResult {
66
- valid: boolean;
67
- diagnostics: TypeDiagnostic[];
68
- typeMap: Map<string, TypeInfo>;
69
- }
70
-
71
- // Built-in type definitions
72
- const BUILTIN_FUNCTIONS: Map<string, TypeInfo> = new Map([
73
- ['add', { type: 'function', parameters: [{ name: 'a', type: 'number' }, { name: 'b', type: 'number' }], returnType: 'number' }],
74
- ['subtract', { type: 'function', parameters: [{ name: 'a', type: 'number' }, { name: 'b', type: 'number' }], returnType: 'number' }],
75
- ['multiply', { type: 'function', parameters: [{ name: 'a', type: 'number' }, { name: 'b', type: 'number' }], returnType: 'number' }],
76
- ['divide', { type: 'function', parameters: [{ name: 'a', type: 'number' }, { name: 'b', type: 'number' }], returnType: 'number' }],
77
- ['concat', { type: 'function', parameters: [{ name: 'a', type: 'string' }, { name: 'b', type: 'string' }], returnType: 'string' }],
78
- ['length', { type: 'function', parameters: [{ name: 'value', type: 'any' }], returnType: 'number' }],
79
- ['push', { type: 'function', parameters: [{ name: 'arr', type: 'array' }, { name: 'item', type: 'any' }], returnType: 'array' }],
80
- ['pop', { type: 'function', parameters: [{ name: 'arr', type: 'array' }], returnType: 'any' }],
81
- ['log', { type: 'function', parameters: [{ name: 'message', type: 'any' }], returnType: 'void' }],
82
- ['print', { type: 'function', parameters: [{ name: 'message', type: 'any' }], returnType: 'void' }],
83
- ['show', { type: 'function', parameters: [{ name: 'target', type: 'orb' }], returnType: 'void' }],
84
- ['hide', { type: 'function', parameters: [{ name: 'target', type: 'orb' }], returnType: 'void' }],
85
- ['pulse', { type: 'function', parameters: [{ name: 'target', type: 'orb' }], returnType: 'void' }],
86
- ['animate', { type: 'function', parameters: [{ name: 'target', type: 'orb' }, { name: 'config', type: 'object' }], returnType: 'void' }],
87
- ['spawn', { type: 'function', parameters: [{ name: 'type', type: 'string' }, { name: 'position', type: 'object' }], returnType: 'orb' }],
88
- ['isNumber', { type: 'function', parameters: [{ name: 'value', type: 'any' }], returnType: 'boolean' }],
89
- ['isString', { type: 'function', parameters: [{ name: 'value', type: 'any' }], returnType: 'boolean' }],
90
- ['isArray', { type: 'function', parameters: [{ name: 'value', type: 'any' }], returnType: 'boolean' }],
91
- ]);
92
-
93
- export class HoloScriptTypeChecker {
94
- private typeMap: Map<string, TypeInfo> = new Map();
95
- private diagnostics: TypeDiagnostic[] = [];
96
- private currentLine: number = 0;
97
- private currentColumn: number = 0;
98
-
99
- constructor() {
100
- // Initialize with built-in functions
101
- BUILTIN_FUNCTIONS.forEach((type, name) => {
102
- this.typeMap.set(name, type);
103
- });
104
- }
105
-
106
- /**
107
- * Type check an AST
108
- */
109
- check(ast: ASTNode[]): TypeCheckResult {
110
- this.diagnostics = [];
111
-
112
- // First pass: collect declarations
113
- for (const node of ast) {
114
- this.collectDeclaration(node);
115
- }
116
-
117
- // Second pass: validate types
118
- for (const node of ast) {
119
- this.checkNode(node);
120
- }
121
-
122
- return {
123
- valid: this.diagnostics.filter(d => d.severity === 'error').length === 0,
124
- diagnostics: this.diagnostics,
125
- typeMap: new Map(this.typeMap),
126
- };
127
- }
128
-
129
- /**
130
- * Collect type declarations
131
- */
132
- private collectDeclaration(node: ASTNode): void {
133
- switch (node.type) {
134
- case 'orb':
135
- this.collectOrbDeclaration(node as OrbNode);
136
- break;
137
- case 'method':
138
- this.collectMethodDeclaration(node as MethodNode);
139
- break;
140
- case 'variable-declaration':
141
- this.collectVariableDeclaration(node as VariableDeclarationNode);
142
- break;
143
- case 'stream':
144
- this.collectStreamDeclaration(node as StreamNode);
145
- break;
146
- }
147
- }
148
-
149
- private collectOrbDeclaration(node: OrbNode): void {
150
- const properties = new Map<string, TypeInfo>();
151
-
152
- // Add default orb properties
153
- properties.set('position', { type: 'object', properties: new Map([
154
- ['x', { type: 'number' }],
155
- ['y', { type: 'number' }],
156
- ['z', { type: 'number' }],
157
- ])});
158
- properties.set('color', { type: 'string' });
159
- properties.set('glow', { type: 'boolean' });
160
- properties.set('interactive', { type: 'boolean' });
161
- properties.set('visible', { type: 'boolean' });
162
-
163
- // Add user-defined properties
164
- for (const [key, value] of Object.entries(node.properties)) {
165
- properties.set(key, this.inferType(value));
166
- }
167
-
168
- this.typeMap.set(node.name, {
169
- type: 'orb',
170
- properties,
171
- });
172
- }
173
-
174
- private collectMethodDeclaration(node: MethodNode): void {
175
- const parameters: ParameterType[] = node.parameters.map(p => ({
176
- name: p.name,
177
- type: this.parseTypeString(p.dataType),
178
- optional: p.defaultValue !== undefined,
179
- defaultValue: p.defaultValue,
180
- }));
181
-
182
- this.typeMap.set(node.name, {
183
- type: 'function',
184
- parameters,
185
- returnType: node.returnType ? this.parseTypeString(node.returnType) : 'void',
186
- });
187
- }
188
-
189
- private collectVariableDeclaration(node: VariableDeclarationNode): void {
190
- let type: HoloScriptType = 'any';
191
-
192
- if (node.dataType) {
193
- type = this.parseTypeString(node.dataType);
194
- } else if (node.value !== undefined) {
195
- type = this.inferType(node.value).type;
196
- }
197
-
198
- this.typeMap.set(node.name, { type });
199
- }
200
-
201
- private collectStreamDeclaration(node: StreamNode): void {
202
- this.typeMap.set(node.name, {
203
- type: 'stream',
204
- properties: new Map([
205
- ['source', { type: 'string' }],
206
- ['result', { type: 'any' }],
207
- ]),
208
- });
209
- }
210
-
211
- /**
212
- * Check a node for type errors
213
- */
214
- private checkNode(node: ASTNode): void {
215
- this.currentLine = node.position?.x ?? 0;
216
- this.currentColumn = node.position?.y ?? 0;
217
-
218
- switch (node.type) {
219
- case 'connection':
220
- this.checkConnection(node as ConnectionNode);
221
- break;
222
- case 'gate':
223
- this.checkGate(node as GateNode);
224
- break;
225
- case 'for-loop':
226
- this.checkForLoop(node as ForLoopNode);
227
- break;
228
- case 'while-loop':
229
- this.checkWhileLoop(node as WhileLoopNode);
230
- break;
231
- case 'foreach-loop':
232
- this.checkForEachLoop(node as ForEachLoopNode);
233
- break;
234
- case 'import':
235
- this.checkImport(node as ImportNode);
236
- break;
237
- case 'export':
238
- this.checkExport(node as ExportNode);
239
- break;
240
- }
241
- }
242
-
243
- private checkConnection(node: ConnectionNode): void {
244
- const fromType = this.typeMap.get(node.from);
245
- const toType = this.typeMap.get(node.to);
246
-
247
- if (!fromType) {
248
- this.addDiagnostic('error', `Unknown source '${node.from}' in connection`, 'E001');
249
- }
250
-
251
- if (!toType) {
252
- this.addDiagnostic('error', `Unknown target '${node.to}' in connection`, 'E002');
253
- }
254
-
255
- // Check if types are compatible
256
- if (fromType && toType && node.dataType !== 'any') {
257
- // Warn if connecting incompatible types
258
- if (fromType.type !== toType.type && fromType.type !== 'any' && toType.type !== 'any') {
259
- this.addDiagnostic('warning',
260
- `Connection from '${node.from}' (${fromType.type}) to '${node.to}' (${toType.type}) may be incompatible`,
261
- 'W001',
262
- [`Consider using 'as "any"' to bypass type checking`]
263
- );
264
- }
265
- }
266
- }
267
-
268
- private checkGate(node: GateNode): void {
269
- // Validate condition references valid variables
270
- const conditionVars = this.extractVariables(node.condition);
271
- for (const varName of conditionVars) {
272
- if (!this.typeMap.has(varName) && !this.isLiteral(varName)) {
273
- this.addDiagnostic('error', `Unknown variable '${varName}' in gate condition`, 'E003');
274
- }
275
- }
276
- }
277
-
278
- private checkForLoop(node: ForLoopNode): void {
279
- // Check init references
280
- const initVars = this.extractVariables(node.init);
281
- // For loops can declare new variables in init, so we add them
282
- for (const varName of initVars) {
283
- if (!this.typeMap.has(varName)) {
284
- this.typeMap.set(varName, { type: 'number' }); // Loop vars are typically numbers
285
- }
286
- }
287
-
288
- // Check condition
289
- const condVars = this.extractVariables(node.condition);
290
- for (const varName of condVars) {
291
- if (!this.typeMap.has(varName) && !this.isLiteral(varName)) {
292
- this.addDiagnostic('error', `Unknown variable '${varName}' in for loop condition`, 'E004');
293
- }
294
- }
295
- }
296
-
297
- private checkWhileLoop(node: WhileLoopNode): void {
298
- const condVars = this.extractVariables(node.condition);
299
- for (const varName of condVars) {
300
- if (!this.typeMap.has(varName) && !this.isLiteral(varName)) {
301
- this.addDiagnostic('error', `Unknown variable '${varName}' in while loop condition`, 'E005');
302
- }
303
- }
304
- }
305
-
306
- private checkForEachLoop(node: ForEachLoopNode): void {
307
- // Check collection exists
308
- if (!this.typeMap.has(node.collection)) {
309
- this.addDiagnostic('error', `Unknown collection '${node.collection}' in forEach loop`, 'E006');
310
- } else {
311
- const collectionType = this.typeMap.get(node.collection);
312
- if (collectionType && collectionType.type !== 'array' && collectionType.type !== 'any') {
313
- this.addDiagnostic('error', `'${node.collection}' is not iterable (type: ${collectionType.type})`, 'E007');
314
- }
315
- }
316
-
317
- // Add loop variable to scope
318
- this.typeMap.set(node.variable, { type: 'any' });
319
- }
320
-
321
- private checkImport(node: ImportNode): void {
322
- if (!node.modulePath) {
323
- this.addDiagnostic('error', 'Import statement missing module path', 'E008');
324
- }
325
-
326
- // Register imported names as 'any' type (can't resolve external modules)
327
- for (const name of node.imports) {
328
- this.typeMap.set(name, { type: 'any' });
329
- }
330
-
331
- if (node.defaultImport) {
332
- this.typeMap.set(node.defaultImport, { type: 'any' });
333
- }
334
- }
335
-
336
- private checkExport(node: ExportNode): void {
337
- if (node.exports) {
338
- for (const name of node.exports) {
339
- if (!this.typeMap.has(name)) {
340
- this.addDiagnostic('error', `Cannot export unknown identifier '${name}'`, 'E009');
341
- }
342
- }
343
- }
344
- }
345
-
346
- /**
347
- * Infer type from a value
348
- */
349
- private inferType(value: unknown): TypeInfo {
350
- if (value === null || value === undefined) {
351
- return { type: 'any', nullable: true };
352
- }
353
-
354
- if (typeof value === 'number') {
355
- return { type: 'number' };
356
- }
357
-
358
- if (typeof value === 'string') {
359
- return { type: 'string' };
360
- }
361
-
362
- if (typeof value === 'boolean') {
363
- return { type: 'boolean' };
364
- }
365
-
366
- if (Array.isArray(value)) {
367
- const elementType = value.length > 0 ? this.inferType(value[0]).type : 'any';
368
- return { type: 'array', elementType };
369
- }
370
-
371
- if (typeof value === 'object') {
372
- const properties = new Map<string, TypeInfo>();
373
- for (const [key, val] of Object.entries(value)) {
374
- properties.set(key, this.inferType(val));
375
- }
376
- return { type: 'object', properties };
377
- }
378
-
379
- return { type: 'any' };
380
- }
381
-
382
- /**
383
- * Parse type string to HoloScriptType
384
- */
385
- private parseTypeString(typeStr: string): HoloScriptType {
386
- const normalized = typeStr.toLowerCase().trim();
387
- const validTypes: HoloScriptType[] = [
388
- 'number', 'string', 'boolean', 'array', 'object',
389
- 'function', 'void', 'any', 'unknown', 'never',
390
- 'orb', 'stream', 'connection', 'gate'
391
- ];
392
-
393
- if (validTypes.includes(normalized as HoloScriptType)) {
394
- return normalized as HoloScriptType;
395
- }
396
-
397
- return 'any';
398
- }
399
-
400
- /**
401
- * Extract variable names from an expression string
402
- */
403
- private extractVariables(expr: string): string[] {
404
- const varPattern = /\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g;
405
- const matches = expr.match(varPattern) || [];
406
- const keywords = ['true', 'false', 'null', 'undefined', 'if', 'else', 'for', 'while', 'return'];
407
- return matches.filter(m => !keywords.includes(m));
408
- }
409
-
410
- /**
411
- * Check if string is a literal
412
- */
413
- private isLiteral(str: string): boolean {
414
- // Number literal
415
- if (/^-?\d+(\.\d+)?$/.test(str)) return true;
416
- // Boolean
417
- if (str === 'true' || str === 'false') return true;
418
- // String literal
419
- if (/^["'].*["']$/.test(str)) return true;
420
- return false;
421
- }
422
-
423
- /**
424
- * Add a diagnostic
425
- */
426
- private addDiagnostic(
427
- severity: 'error' | 'warning' | 'info',
428
- message: string,
429
- code: string,
430
- suggestions?: string[]
431
- ): void {
432
- this.diagnostics.push({
433
- severity,
434
- message,
435
- line: this.currentLine,
436
- column: this.currentColumn,
437
- code,
438
- suggestions,
439
- });
440
- }
441
-
442
- /**
443
- * Get type info for a name
444
- */
445
- getType(name: string): TypeInfo | undefined {
446
- return this.typeMap.get(name);
447
- }
448
-
449
- /**
450
- * Get all registered types
451
- */
452
- getAllTypes(): Map<string, TypeInfo> {
453
- return new Map(this.typeMap);
454
- }
455
-
456
- /**
457
- * Reset the type checker
458
- */
459
- reset(): void {
460
- this.typeMap.clear();
461
- this.diagnostics = [];
462
-
463
- // Re-add built-ins
464
- BUILTIN_FUNCTIONS.forEach((type, name) => {
465
- this.typeMap.set(name, type);
466
- });
467
- }
468
- }
469
-
470
- /**
471
- * Create a type checker instance
472
- */
473
- export function createTypeChecker(): HoloScriptTypeChecker {
474
- return new HoloScriptTypeChecker();
475
- }