Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
ivojawer committed Jul 25, 2023
1 parent d22631c commit 01325a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
12 changes: 5 additions & 7 deletions smalltalksrc/Slang-Tests/SlangBasicTranslationTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1804,17 +1804,17 @@ methodWithoutReturn(void)
SlangBasicTranslationTest >> testMethodsWithConflictingName [
| translation1 translation2 tMethod1 tMethod2 |
tMethod1 := self getTMethodFrom: #methodWithRepeatedCFunctionName.
tMethod2 := generator methods at: #methodWithRepeatedCFunctionName:.
generator renameConflictingMethods.
translation1 := self translate: tMethod1.
translation2 := self translate: tMethod2.
self assert: (self functionIdentifier: translation1)
~= (self functionIdentifier: translation2)
self
deny: (self functionIdentifier: translation1)
equals: (self functionIdentifier: translation2)
]
{ #category : #'tests-case' }
Expand Down Expand Up @@ -6607,9 +6607,7 @@ SlangBasicTranslationTest >> testVariableWithConflictingNameShouldBeRenamed [
translation := self translate: method.
self
assert: (translation lineNumber: 5)
equals: ' char *l_methodWithoutReturn;'
self assert: (translation includesSubstring: 'char *l_methodWithoutReturn').
]
{ #category : #'tests-variables' }
Expand Down
21 changes: 7 additions & 14 deletions smalltalksrc/Slang/CCodeGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4445,7 +4445,7 @@ CCodeGenerator >> renameConflictingMethods [
| cFunctionNames toRename |
cFunctionNames := IdentityDictionary new.
methods do: [ :m |
methods reject: [ :m | m isStructAccessor ] thenDo: [ :m |
| functionName conflicts |
functionName := self cFunctionNameFor: m selector.
Expand All @@ -4455,22 +4455,15 @@ CCodeGenerator >> renameConflictingMethods [
toRename := cFunctionNames select: [ :conflicts | conflicts size > 1 ].
toRename keysDo: [ :key |
| conflictingMethods |
conflictingMethods := toRename at: key.
"api methods cannot be renamed"
(conflictingMethods select: [ :m | m isAPIMethod ]) size > 1
ifTrue: [
toRename keysAndValuesDo: [ :key :conflictingMethods |
conflictingMethods do: [ :method |
method isAPIMethod ifTrue: [ "api methods cannot be renamed"
TranslationError signal:
'Conflicting API methods would be translated to "' , key , '"' ].
(conflictingMethods reject: [ :m | m isAPIMethod ]) do: [ :method |
method isStructAccessor ifFalse: [
self
addSelectorTranslation: method selector
to: key , method args size asString ] ] ]
self
addSelectorTranslation: method selector
to: key , method args size asString ] ]
]
{ #category : #renaming }
Expand Down

0 comments on commit 01325a8

Please sign in to comment.