Skip to content

Commit

Permalink
Fixes #458 Category error after method compilation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Winger authored and Eric Winger committed Mar 7, 2019
1 parent a421204 commit 18a35c3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
18 changes: 18 additions & 0 deletions sources/JadeiteProjectBrowserTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,23 @@ test_extensionMethodSelection
[self cloneRowanSample1.
self ensureRowanSample1Loaded]!

test_failMethodCompile
| source |
self testsIssue: #issue458 withTitle: '(3.0.64) category error'.
self selectRowanSample1Test.
self projectsPresenter basicAddMethodCategory: 'newCategory'.

[source := 'failCompile aaaaa'.
self methodSourcePresenter value: source.
TestMessageBox enableJadeiteTestMessageBox.
TestMessageBox plannedResult: #ok.
self projectsPresenter editSaveMethod: self classListPresenter selection.
self selectCategoryNamed: 'tests'. "error happened here"
self assertIsNil: (self methodListPresenter list
detect: [:methodService | methodService selector = #failCompile]
ifNone: [])]
ensure: [self projectsPresenter basicRemoveMethodCategories]!

test_filtersUpdatedInHierarchyView
| selectedClass browserServiceCategories |
self testsIssue: #issue343 withTitle: 'Category/Variables tab not updating correctly'.
Expand Down Expand Up @@ -3691,6 +3708,7 @@ waitForPresenter: presenter
!JadeiteProjectBrowserTestCase categoriesFor: #test_expansion!public!test class hierarchy! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_extensionColoringInHierarchy!public!test class hierarchy! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_extensionMethodSelection!public!test class list! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_failMethodCompile!public!test class list!tests! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_filtersUpdatedInHierarchyView!public!test class hierarchy! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_findClass!public!test class list!tests! !
!JadeiteProjectBrowserTestCase categoriesFor: #test_findMethodChangesCategories!public!test categories! !
Expand Down
18 changes: 12 additions & 6 deletions sources/JadeiteProjectsBrowserPresenter.cls
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,20 @@ editSaveMethod
self redrawAllViews!

editSaveMethod: classService
self
editSaveMethod: classService
in: methodSourcePresenter
category: self targetCategory.
| compileResult |
compileResult := self
editSaveMethod: classService
in: methodSourcePresenter
category: self targetCategory.
compileResult == false
ifTrue: [self updateService: classService "If we got a compile error our methods need a refresh"].
classService selectedMethods
ifNotNil:
["there will be no method selected on a compiler error"
self selectMethodsFrom: classService]!
[:methodServices |
methodServices notEmpty
ifTrue:
["there will be no method selected on a compiler error"
self selectMethodsFrom: classService]]!

expandHierarchyAt: classService
Cursor wait showWhile:
Expand Down
6 changes: 4 additions & 2 deletions sources/Rowan UI Base.pax
Original file line number Diff line number Diff line change
Expand Up @@ -1748,13 +1748,15 @@ editSaveMethod: classService in: methodSourcePresenter category: category
command: #saveMethodSource:category:;
commandArgs: (Array with: methodSource1 with: category).
[self issueCommand: (Array with: classService)] on: GsCompileError
do: [:ex | ^self reportCompileError: ex list in: methodSourcePresenter].
do:
[:ex |
self reportCompileError: ex list in: methodSourcePresenter. ^false].
methodSourcePresenter view firstVisibleLine: firstVisibleLine.
methodSourcePresenter view goto: caretPosition.
methodSourcePresenter value: methodSource1.
self displayNoMods: methodSourcePresenter.
(self compilationWarningFrom: classService selectedMethods)
ifNotNil: [:warning | self statusBarText: warning].!
ifNotNil: [:warning | self statusBarText: warning]!

issueCommand: services
^self class issueCommand: services session: self gciSession.
Expand Down
6 changes: 3 additions & 3 deletions sources/RowanClassService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ addHierarchyService: service to: treeModel withParent: parentService
basicPrepareForReplication
"don't call anything potentially recursive here.
method & package services don't iterate over subcollections"
methods := nil.
hierarchyServices := nil.
selectedMethods := nil.
methods := Array new.
hierarchyServices := Array new.
selectedMethods := Array new.
methods ifNotNil: [methods do: [:methodService | methodService basicPrepareForReplication]].
selectedMethods
ifNotNil: [selectedMethods do: [:methodService | methodService basicPrepareForReplication]].
Expand Down

0 comments on commit 18a35c3

Please sign in to comment.