Skip to content

Commit

Permalink
Adds test and deletes comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeAtHPI committed Oct 7, 2023
1 parent 6a288f6 commit 2bc6f0a
Show file tree
Hide file tree
Showing 38 changed files with 137 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
initialize-release
removeFromMethod: aCompiledMethod

"Intended to delete annotations but not the enclosed expression from outside a browser"
"Intended to delete annotations from outside a browser"
aCompiledMethod bpAnnotations
detect: [:anAnnotation | anAnnotation id = self id ]
ifFound: [:theAnnotationToRemove | | text startOfTag expressionStart replacementStart replacementEnd |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"morphClass" : "jb 3/5/2022 12:54",
"otherInformation" : "pre 5/29/2019 10:59",
"otherInformation:" : "jb 12/7/2020 18:06",
"removeFromMethod:" : "joabe 10/5/2023 17:28",
"removeFromMethod:" : "joabe 10/6/2023 14:28",
"startTag" : "pre 5/10/2021 09:44",
"startTagSource" : "jb 12/7/2020 18:06",
"startTagSource:" : "pre 5/29/2019 10:59",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
actions
addProbe: aProbe

nameToProbesDict at: aProbe assignedClassName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
accessing
at: aClassName

^ nameToProbesDict at: aClassName
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
actions
removeProbe: aProbe

nameToProbesDict at: aProbe assignedClassName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ morphic
asMorph

| newMorph |
newMorph := BPInstanceVariableProbeMorph new
annotation: self;
yourself.
newMorph := BPInstanceVariableProbeMorph new annotation: self; yourself.
self updateTextAnchorPropertiesOf: newMorph.
^ newMorph
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
assignedClassName: aString

assignedClassName := aString
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
assignedClassName

^ assignedClassName
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ deleteLinkedProbes

| browser |
browser := BPBrowser open.

self linkedProbes do: [:aProbe |
browser browseReference: aProbe methodReference.
browser removeAnnotations: {aProbe}].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
serialization
instrumentationCallFor: actualEnclosedExpressionSource

"Currently not used as instance probes do not rewrite a class definition in which they exist"
^ '(self bpTraceVariable: [{1}] forProbe: {2} linked: \{{3}\} inContext: thisContext)'
format: {actualEnclosedExpressionSource .
self id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"class" : {
"annotationTag" : "joabe 9/25/2023 17:30" },
"instance" : {
"asMorph" : "joabe 9/21/2023 22:32",
"assignedClassName" : "joabe 9/28/2023 15:45",
"assignedClassName:" : "joabe 9/28/2023 15:46",
"asMorph" : "joabe 10/6/2023 14:43",
"assignedClassName" : "joabe 10/6/2023 14:40",
"assignedClassName:" : "joabe 10/6/2023 14:40",
"canBeAnnotatedTo" : "joabe 9/21/2023 21:08",
"deleteLinkedProbes" : "joabe 10/5/2023 17:34",
"deleteLinkedProbes" : "joabe 10/6/2023 14:40",
"initialize" : "joabe 10/4/2023 15:33",
"instrumentationCallFor:" : "joabe 10/4/2023 15:37",
"instrumentationCallFor:" : "joabe 10/7/2023 18:25",
"isInstanceVariableProbe" : "joabe 9/21/2023 21:18",
"linkedProbes" : "joabe 10/4/2023 15:33",
"probeTypeTag" : "joabe 9/25/2023 17:30",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
"bpTrace:through:forProbe:inContext:" : "jb 11/29/2020 22:12",
"bpTraceAssignmentOf:before:forProbe:inContext:" : "pre 7/6/2020 18:34",
"bpTraceExecutionResult:" : "jb 12/30/2021 21:20",
"bpTraceVariable:forProbe:inContext:" : "joabe 9/27/2023 13:36",
"isLiveSpecimenReference" : "pre 1/10/2023 16:16" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
as yet unclassified
testCorrectIntervalForInstanceVariable
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
testDeterminesCorrectIntervalForExistingVariableAndPerfectSelection

browser selectClassNamed: #BPTestExamplesClass.
self assert: (69 to: 71) equals: (browser determineIntervalToAnnotateFor: (BPInstanceVariableProbe new variableName: 'foo') in: (69 to: 71))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
testDeterminesCorrectIntervalForExistingVariableIgnoresSpaceInSelection

browser selectClassNamed: #BPTestExamplesClass.
self assert: (69 to: 71) equals: (browser determineIntervalToAnnotateFor: (BPInstanceVariableProbe new variableName: 'foo') in: (68 to: 71))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
testDeterminesNoIntervalForExistingVariableButWrongSelection

browser selectClassNamed: #BPTestExamplesClass.
self assert: nil equals: (browser determineIntervalToAnnotateFor: (BPInstanceVariableProbe new variableName: 'foo') in: (66 to: 71))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
as yet unclassified
testExtractsCorrectInstanceVariableProbeInterval
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
as yet unclassified
testHasCorrectInstanceVariableProbeInterval
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@
"setUp" : "jb 12/7/2020 19:05",
"tearDown" : "lu 1/23/2022 21:25",
"testClosesSidePane" : "joabe 5/9/2023 17:06",
"testCorrectIntervalForInstanceVariable" : "joabe 10/7/2023 18:44",
"testDeleteMethod" : "jb 12/6/2021 22:32",
"testDeterminesCorrectIntervalForExistingVariableAndPerfectSelection" : "joabe 10/7/2023 19:03",
"testDeterminesCorrectIntervalForExistingVariableIgnoresSpaceInSelection" : "joabe 10/7/2023 19:03",
"testDeterminesNoIntervalForExistingVariableButWrongSelection" : "joabe 10/7/2023 19:04",
"testExtractsCorrectInstanceVariableProbeInterval" : "joabe 10/7/2023 18:41",
"testHasCorrectInstanceVariableProbeInterval" : "joabe 10/7/2023 18:43",
"testOpensSidePane" : "joabe 5/9/2023 17:07" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests
testExtractVariableAssignmentIntervals

self assert: {76@83 . 139@146}
equals: ((BPTestExamplesClass >> #methodSettingInstanceVars) bpExtractVariableAssignmentRangesNamed: 'foo')
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tests
testRewritingLeftHandOfDoubleNestedAssignmentProbe

self
assertCompilerRewrites:
'method
| variable |
"<bpProbe id: 2>""<bpProbe id: 1>"variable := 2 raisedTo: 3"</bpProbe>""</bpProbe>".'
to:
'method
<layer: #bpInstrumented>
| variable |
(self bpTraceAssignmentOf: [(self bpTraceAssignmentOf: [variable := 2 raisedTo: 3] before: {''variable'' . variable} forProbe: 1 inContext: thisContext)] before: {} forProbe: 2 inContext: thisContext).'
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tests
testRewritingLeftHandOfTripleNestedAssignmentProbe

self
assertCompilerRewrites:
'method
| variable |
"<bpProbe id: 3>""<bpProbe id: 2>""<bpProbe id: 1>"variable := 2 raisedTo: 3"</bpProbe>""</bpProbe>""</bpProbe>".'
to:
'method
<layer: #bpInstrumented>
| variable |
(self bpTraceAssignmentOf: [(self bpTraceAssignmentOf: [(self bpTraceAssignmentOf: [variable := 2 raisedTo: 3] before: {''variable'' . variable} forProbe: 1 inContext: thisContext)] before: {} forProbe: 2 inContext: thisContext)] before: {} forProbe: 3 inContext: thisContext).'
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"setUp" : "jb 12/7/2020 19:06",
"testCompileSilentlyAddsAnnotationsProperly" : "pre 7/22/2022 22:02",
"testCompilerRecognizesMethodsThatRequireRecompilation" : "jb 12/7/2020 19:06",
"testExtractVariableAssignmentIntervals" : "joabe 10/7/2023 18:32",
"testFromFormattedSourceCodeToAnnotatedSourceCode" : "pre 2/22/2021 18:03",
"testRewritingBinaryMessageChainProbe" : "pre 2/22/2021 17:16",
"testRewritingDoesNotAddTwoLayerPragmas" : "pre 7/23/2022 15:51",
Expand All @@ -21,6 +22,8 @@
"testRewritingKeywordMessageUnaryReceiverProbe" : "jb 12/7/2020 19:06",
"testRewritingLeftHandOfAssignmentProbe" : "pre 7/23/2022 15:51",
"testRewritingLeftHandOfAssignmentProbeMultipleVariables" : "pre 7/23/2022 15:53",
"testRewritingLeftHandOfDoubleNestedAssignmentProbe" : "joabe 10/6/2023 14:27",
"testRewritingLeftHandOfTripleNestedAssignmentProbe" : "joabe 10/6/2023 14:27",
"testRewritingNestedBlockAndMethodSlider" : "pre 7/23/2022 15:52",
"testRewritingNestedBlockSlider" : "pre 7/23/2022 15:53",
"testRewritingNestedReplacements" : "jb 12/7/2020 19:07",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
tests
testNestedAnnotatedAssignments

startRule := #Statement.

self
shouldParse: '"<bpProbe id: 2>""<bpProbe id: 1>"variable := 2"</bpProbe>""</bpProbe>"';
shouldParse: 'variable := "<bpProbe id: 2>""<bpProbe id: 1>"2"</bpProbe>""</bpProbe>"'.

self
shouldParse: '"<bpProbe id: 2>""<bpProbe id: 1>"variable := 2"</bpProbe>""</bpProbe>"'
to: #(Statement
(AnnotatedStatement
(expressionAnnotationStart '"<bpProbe id: 2>"')
(Statement
(AnnotatedStatement '"<bpProbe id: 1>"variable := 2"</bpProbe>"'))
(expressionAnnotationEnd '"</bpProbe>"'))).
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"testGrammarParsesVariableNameCorrectly" : "jb 12/7/2020 19:09",
"testMessageSendPartsCanBeAnnotated" : "pre 8/6/2021 18:37",
"testMessageSendsCanBeAnnotated" : "jb 12/7/2020 19:09",
"testNestedAnnotatedAssignments" : "joabe 10/6/2023 14:22",
"testNormalExpressionsStillWork" : "pre 5/10/2019 11:27",
"testOtherCommentsAreStillComments" : "jb 12/7/2020 19:09",
"testRegressionAnnotationBlock01" : "pre 9/1/2022 20:39",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
foo: anObject
foo := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
foo
^ foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
foo2: anObject
foo2 := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
foo2
^ foo2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
example methods
methodSettingInstanceVars

'hello world'.
self foo;
foo2.
foo2 := 1.
foo := 2.
self foo2: 3.
self foo: 4.
[ |var|
var := 5.
foo := 6.
[ |foo foo2|
foo := 7.
foo2 := 8.]]

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
"+" : "pre 7/1/2019 14:23",
"addAndLog:" : "pre 5/3/2021 10:36",
"binarySearchIn:theElement:" : "pre 8/21/2023 11:38",
"foo" : "joabe 10/7/2023 18:19",
"foo2" : "joabe 10/7/2023 18:19",
"foo2:" : "joabe 10/7/2023 18:19",
"foo:" : "joabe 10/7/2023 18:19",
"methodOnlyWithExample" : "pre 11/18/2019 12:07",
"methodSettingInstanceVars" : "joabe 10/7/2023 18:21",
"methodWithExampleCallingOnlyProbedMethod" : "jb 7/2/2021 00:56",
"methodWithLiveSpecimen:" : "pre 9/30/2020 09:41",
"methodWithMultipleAssertions" : "pre 7/15/2022 11:11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
],
"commentStamp" : "",
"instvars" : [
],
"foo2",
"foo" ],
"name" : "BPTestExamplesClass",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
private
applyInstanceVariableIn: aPreformmattedText for: anInstanceProbe
applyInstanceProbeIn: aPreformattedText for: anInstanceProbe

| interval |
interval := (aPreformmattedText string
interval := (aPreformattedText string
allRangesOfRegexMatches: '(''| )', anInstanceProbe variableName, '(''| )') first.

aPreformmattedText
aPreformattedText
addAttribute: (BPTextDecoration new
anchoredMorph: (self annotationMorphFor: anInstanceProbe);
yourself)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ formatNonMethod: aText
BPClassNameToInstanceProbes value nameToProbesDict at: className
ifPresent: [:probesSet | probesSet do: [:anInstanceProbe |
self
applyInstanceVariableIn: formattedText
applyInstanceProbeIn: formattedText
for: anInstanceProbe]].
^ formattedText
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"annotationCanBePutInSidebar:" : "pre 12/16/2020 19:02",
"annotationMorphFor:" : "pre 1/6/2021 17:40",
"applyAnnotationsFrom:to:" : "pre 7/20/2022 16:03",
"applyInstanceVariableIn:for:" : "joabe 9/28/2023 15:19",
"applyInstanceProbeIn:for:" : "joabe 10/7/2023 19:09",
"expressionSourceFor:from:at:" : "pre 7/20/2022 16:58",
"extractIntervals" : "jb 12/3/2020 22:57",
"formatNonMethod:" : "joabe 9/28/2023 15:39",
"formatNonMethod:" : "joabe 10/7/2023 19:09",
"hasExamplesMorph:" : "pre 7/20/2022 09:31",
"ifNoSelectedMethod:" : "pre 3/19/2020 11:07",
"insertExamplesMorphInto:" : "pre 7/20/2022 10:45",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ determineIntervalOfVariableNameIn: anInterval having: aTopologicalCollectionOfAn
((self contents atAll: lowestKeywordMessageSegment children first interval) ~= 'instanceVariableNames:') ifTrue: [^ nil].

selectedText := (self contents atAll: anInterval) withBlanksTrimmed.
self flag: #todo. "wenn es sowas wie aha und aha2 gibt, dann wird das falsch sein, wenn ich aha markiere
und aha2 als erstes kommt"
"restliches todo: test schreiben"

^ self selectedClassOrMetaClass instVarNames
detect: [:aVariable | aVariable = selectedText]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"codePaneMenuBPTracingItems:" : "pre 9/2/2022 15:06",
"compiledMethod" : "ct 3/30/2022 16:48",
"determineIntervalOfReceiver:" : "pre 9/2/2022 14:29",
"determineIntervalOfVariableNameIn:having:" : "joabe 10/2/2023 13:21",
"determineIntervalOfVariableNameIn:having:" : "joabe 10/7/2023 19:17",
"determineIntervalToAnnotateFor:in:" : "joabe 9/26/2023 13:52",
"determineMessageSendNodeIn:" : "joabe 10/2/2023 13:26",
"determineSelectorOfMessageSend:" : "pre 9/2/2022 14:49",
Expand Down

0 comments on commit 2bc6f0a

Please sign in to comment.