Skip to content

Commit

Permalink
Finish basic implementation to know getters and setters
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Oct 21, 2024
1 parent 90ed144 commit 56a1cf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ FamixPythonProject1Test >> testFunctionInAPackage [
FamixPythonProject1Test >> testGetterAndSetter [

| class getter setter |
self skip. "For now I see that instance variables are not well managed so it make it impossible to maager getters and setters properly. Let's finish this later"
self denyEmpty: self model allMethods.

class := self classNamed: 'Person'.
Expand Down
8 changes: 8 additions & 0 deletions src/Famix-Python-Importer/FamixPythonImporterVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ FamixPythonImporterVisitor >> createMethod: aMethodNode [
foundAction: [ :entity :currentEntity | method beGetter ]
ifNone: [ "We do nothing" ] ].

(aMethodNode name beginsWith: 'set_') ifTrue: [
self
resolve: ((SRIdentifierWithNode identifier: (aMethodNode name withoutPrefix: 'set_'))
expectedKind: FamixPythonAttribute;
yourself)
foundAction: [ :entity :currentEntity | method beSetter ]
ifNone: [ "We do nothing" ] ].

^ self setSourceAnchor: method from: aMethodNode
]

Expand Down

0 comments on commit 56a1cf0

Please sign in to comment.