Skip to content

Commit

Permalink
Smalltalk: Ensure all stubs are in the model
Browse files Browse the repository at this point in the history
Currently the parents of the stubs are not in the MooseModel which causes some inconsistances. Here is a fix.

Related to #552
  • Loading branch information
jecisc committed Jun 15, 2024
1 parent 5eddf95 commit 3ed418c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,17 @@ ImportStubMethodSpecialTest >> testStubMethodCreation [
self denyEmpty: (model allMethods select: #isStub).
self denyEmpty: model allModelMethods
]

{ #category : #tests }
ImportStubMethodSpecialTest >> testStubParentsAreInMooseModel [

| method class |
method := model entityNamed: #'Smalltalk::False.ifTrue:(Object)'.
self assert: method mooseModel isNotNil.
self assert: method isStub.

class := method parentType.
self assert: class name equals: 'False'.
self assert: class mooseModel isNotNil.
self assert: class isStub
]
9 changes: 5 additions & 4 deletions src/Moose-SmalltalkImporter/CandidateListOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ Class {
{ #category : #running }
CandidateListOperator >> allCandidatesFor: invocation [

^ Array withAll: (groups at: invocation signature ifAbsent: [
^ Array withAll: (groups at: invocation signature ifAbsent: [
| stubs |
stubs := self importer ensureSmalltalkStubMethodsFor:
invocation signature.
stubs := self importer ensureSmalltalkStubMethodsFor: invocation signature.
groups at: invocation signature put: stubs.
stubs do: [ :each | model add: each ].
stubs do: [ :each |
model add: each.
each allParents do: [ :parent | parent mooseModel = model ifFalse: [ model add: parent ] ] ].
stubs ])
]

Expand Down

0 comments on commit 3ed418c

Please sign in to comment.