Skip to content

Conversation

mohbl
Copy link
Collaborator

@mohbl mohbl commented Apr 8, 2025

This pull request resolves critical parsing and FQN generation issues in the FamixTypeScriptImporter, enabling it to handle all variations of object literal types—including numeric, string, computed, symbol, and template literal key and ensuring unique fully qualified names (FQNs) for every entity. These changes transform the importer into a robust tool capable of processing any TypeScript project has object types .

1/Object Literal Key Parsing:

  • Bug: Importer skipped or crashed on object literals with varied keys (e.g., 1: { method() {} }, [key1]: { method() {} }).
  • Fix: Added buildStageMethodMap to map all key types to method positions; updated processStructuredType to process them fully.
  • Result: All object literal methods are now modeled correctly.

2/Unique FQN Generation:

  • Bug: Methods in object literals had duplicate or missing FQNs (e.g., {file}.method1 instead of {file}.object1.1.method1).
  • Fix: Enhanced getFQN to prepend property keys (e.g., 1, keyString, template7) from buildStageMethodMap, ensuring uniqueness.
  • Result: Every method gets a distinct FQN like {file}.object1.42.method9[MethodDeclaration]

@fuhrmanator

@mohbl mohbl changed the base branch from master to fuhrmanator/issue71 April 8, 2025 16:53
Copy link
Owner

@fuhrmanator fuhrmanator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution!

@mohbl mohbl closed this Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants