Skip to content

Commit

Permalink
Fix resolution of accesses when there are spaces in imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Dec 13, 2024
1 parent 4adb844 commit 3b21225
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2274,6 +2274,25 @@ FamixPythonProject1Test >> testReadAccessFromImportedGlobalWithNamespaceSourceAn
self assert: access sourceText equals: 'root2.rootPackage2Variable'
]

{ #category : 'tests - accesses' }
FamixPythonProject1Test >> testReadAccessFromImportedGlobalWithNamespaceWithImportWithSpaces [

| global module access |
global := self globalVariableNamed: 'subSubPackage1Variable'.
module := self moduleNamed: 'moduleWithSpacedImports'.

access := global incomingAccesses detect: [ :anAccess | anAccess accessor = module ].

self assert: access class equals: FamixPythonAccess.
self assert: access source equals: module.
self assert: access accessor equals: module.
self assert: access target equals: global.
self assert: access variable equals: global.
self deny: access isWrite.
self assert: access isRead.
self assert: (module accesses anySatisfy: [ :anAccess | anAccess variable = global ])
]

{ #category : 'tests - accesses' }
FamixPythonProject1Test >> testReadAccessFromLambda [

Expand Down
6 changes: 3 additions & 3 deletions src/Famix-Python-Importer/FamixPythonImporterVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ FamixPythonImporterVisitor >> createImport: anImport ofName: aName from: fromNam

self currentEntity addOutgoingImport: import.

importPaths at: import put: (fromName
ifNil: [ aName ]
ifNotNil: [ fromName ]).
importPaths at: import put: ((fromName
ifNil: [ aName ]
ifNotNil: [ fromName ]) copyWithout: Character space).

self solver
resolve: (fromName
Expand Down

0 comments on commit 3b21225

Please sign in to comment.