Skip to content

Importer creates multiple FamixTypeScriptAccess for same variable when variable used multiple times in a method #71

@fuhrmanator

Description

@fuhrmanator

In version 2.0.3, importing the project associated with this method:

https://github.com/gothinkster/angular-realworld-example-app/blob/2555e2f86dd85f6b9e3a34e720bb46689c8646f8/src/app/features/article/components/article-list.component.ts#L74-L98

results in multiple Access elements (e.g., one for each time the limit variable (Property) is accessed in the runQuery() method):

  {
    "FM3": "FamixTypeScript.Access",
    "id": 2724,
    "accessor": {
      "ref": 674
    },
    "variable": {
      "ref": 667
    }
  },
  {
    "FM3": "FamixTypeScript.Access",
    "id": 2725,
    "accessor": {
      "ref": 674
    },
    "variable": {
      "ref": 667
    }
  },
  {
    "FM3": "FamixTypeScript.Access",
    "id": 2726,
    "accessor": {
      "ref": 674
    },
    "variable": {
      "ref": 667
    }
  },
  {
    "FM3": "FamixTypeScript.Access",
    "id": 2727,
    "accessor": {
      "ref": 674
    },
    "variable": {
      "ref": 667
    }
  },

Opening the model in Moose results in a crash, with a SlotNotFound: Could not build slot named 'accesses' because the assignated slot was not found in the image. (which seems unrelated to the bug, but I traced it to the processing of a FamixTypeScript.Access element.

Looking at VerveineJ models, I only see that one Access is generated per method-variable pair, regardless of the number of times there's an access in the method.

It's easy to make a test for this in the ts2famix importer.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions