diff --git a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/backgroundCompileInstrumentedVersionOf.basedOn.noPattern..st b/packages/Babylonian-Compiler.package/BPCompiler.class/instance/backgroundCompileInstrumentedVersionOf.basedOn.noPattern..st deleted file mode 100644 index f043b700..00000000 --- a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/backgroundCompileInstrumentedVersionOf.basedOn.noPattern..st +++ /dev/null @@ -1,18 +0,0 @@ -private -backgroundCompileInstrumentedVersionOf: aCue basedOn: parseResult noPattern: aBoolean - - | instrumentedResult newCode | - self halt. - newCode := self rewriteToSource: parseResult. - SystemChangeNotifier uniqueInstance doSilently: [ - "Wann ist aCue getClass compile nicht mit BPCompiler?" - instrumentedResult := - aCue getClass newCompiler compileCue: (CompilationCue - source: newCode - class: aCue getClass - environment: aCue environment - requestor: nil) - noPattern: aBoolean - ifFail: [^nil] ]. - "instrumentedResult := aCue getClass compile: newCode]." - \ No newline at end of file diff --git a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileCue.noPattern.ifFail..st b/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileCue.noPattern.ifFail..st index 27c551bd..5c7fe145 100644 --- a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileCue.noPattern.ifFail..st +++ b/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileCue.noPattern.ifFail..st @@ -12,7 +12,7 @@ compileCue: aCueWithStyledSource noPattern: aBoolean ifFail: failBlock inside the morph to re-fullfill that premise again during compilation." | originalMethodNode bpUnstyledSource unstyledCue | bpUnstyledSource := aCueWithStyledSource sourceStream contents asString. - + unstyledCue := CompilationCue source: bpUnstyledSource readStream context: aCueWithStyledSource context diff --git a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileInstrumentedVersionOf..st b/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileInstrumentedVersionOf..st index 5a762a6c..0cf5268d 100644 --- a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileInstrumentedVersionOf..st +++ b/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileInstrumentedVersionOf..st @@ -11,15 +11,7 @@ compileInstrumentedVersionOf: aCue ifTrue: [ self backgroundCompileInstrumentedVersionOf: aCue basedOn: parseResult. ^ true] - ifFalse: [ - "das oben schlägt fehl, weil er keine methoddeclaration findet" - "hier ist die cue kaputt, weil er keine class zuweisen kann. doch nochmal - ne andere compile version, die speziell für editclass zurechtgeschnitten ist?" - parseResult := PEGParserBPSmalltalk new - match: originalCode - startingFrom: #KeywordMessageSend. - parseResult succeeded ifTrue: [self backgroundCompileInstrumentedVersionOf: aCue basedOn: parseResult. - ^ true] ifFalse: [^false]]. + ifFalse: [^ false]. diff --git a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileInstrumentedVersionOf.noPattern..st b/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileInstrumentedVersionOf.noPattern..st deleted file mode 100644 index 36d4d590..00000000 --- a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/compileInstrumentedVersionOf.noPattern..st +++ /dev/null @@ -1,27 +0,0 @@ -private -compileInstrumentedVersionOf: aCue noPattern: aBoolean - - | originalCode parseResult startingFrom | - "We do not serialize the examples into the instrumented method as - they only 'live' in the base method." - originalCode := aCue sourceStream contents asBPSourceWithoutExamples. - startingFrom := aBoolean - ifFalse: [#MethodDeclaration] - ifTrue: [#KeywordMessageSend]. - - parseResult := PEGParserBPSmalltalk new - match: originalCode - startingFrom: startingFrom. - - parseResult succeeded - ifTrue: [ - self - backgroundCompileInstrumentedVersionOf: aCue - basedOn: parseResult - noPattern: aBoolean. - ^ true] - ifFalse: [^false]. - - - - \ No newline at end of file diff --git a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/rewriteToSource..st b/packages/Babylonian-Compiler.package/BPCompiler.class/instance/rewriteToSource..st index d80af367..a76e3222 100644 --- a/packages/Babylonian-Compiler.package/BPCompiler.class/instance/rewriteToSource..st +++ b/packages/Babylonian-Compiler.package/BPCompiler.class/instance/rewriteToSource..st @@ -1,4 +1,4 @@ private rewriteToSource: parseResult - + ^ self rewriter value: parseResult \ No newline at end of file diff --git a/packages/Babylonian-Compiler.package/BPCompiler.class/methodProperties.json b/packages/Babylonian-Compiler.package/BPCompiler.class/methodProperties.json index c8f79d3c..0fd23097 100644 --- a/packages/Babylonian-Compiler.package/BPCompiler.class/methodProperties.json +++ b/packages/Babylonian-Compiler.package/BPCompiler.class/methodProperties.json @@ -6,12 +6,10 @@ "instance" : { "annotationKeywords" : "pre 11/8/2019 20:29", "backgroundCompileInstrumentedVersionOf:basedOn:" : "pre 10/12/2020 15:36", - "backgroundCompileInstrumentedVersionOf:basedOn:noPattern:" : "joabe 9/26/2023 16:07", - "compileCue:noPattern:ifFail:" : "joabe 9/27/2023 16:14", - "compileInstrumentedVersionOf:" : "joabe 9/22/2023 23:28", - "compileInstrumentedVersionOf:noPattern:" : "joabe 9/26/2023 15:54", + "compileCue:noPattern:ifFail:" : "joabe 10/2/2023 12:53", + "compileInstrumentedVersionOf:" : "jb 9/9/2021 17:31", "keywords" : "pre 11/30/2022 09:33", "methodSourceRequiresBPLayers:" : "pre 11/11/2019 15:49", "parse:" : "pre 5/3/2021 15:01", - "rewriteToSource:" : "pre 8/17/2020 08:54", + "rewriteToSource:" : "joabe 10/2/2023 12:48", "rewriter" : "jb 12/7/2020 18:03" } } diff --git a/packages/Babylonian-Compiler.package/BPSourceRewriter.class/instance/rewriteAssignmentNode.withTag..st b/packages/Babylonian-Compiler.package/BPSourceRewriter.class/instance/rewriteAssignmentNode.withTag..st index 58b206ff..d664a70c 100644 --- a/packages/Babylonian-Compiler.package/BPSourceRewriter.class/instance/rewriteAssignmentNode.withTag..st +++ b/packages/Babylonian-Compiler.package/BPSourceRewriter.class/instance/rewriteAssignmentNode.withTag..st @@ -7,9 +7,12 @@ rewriteAssignmentNode: aNode withTag: aTag ^ annotationInformation isProbe ifFalse: [self rewriteNode: aNode withTag: aTag] ifTrue: ["To handle assignment probes" - annotationInformation := annotationInformation asAssignmentProbe. - "The following is a hack to some degree, but a separate semantic would be overkill here" - variableNames := aNode children first "NormalStatement" children first "AssignmentOperation*" children collect: [:assignment | - assignment children first interval contents]. + annotationInformation := annotationInformation asAssignmentProbe. + variableNames := (aNode children first ruleName = #AnnotatedStatement) + ifTrue: [ "Nested assignments" #()] + ifFalse: ["The following is a hack to some degree, but a separate semantic would be overkill here" + aNode children first "NormalStatement" + children first "AssignmentOperation*" + children collect: [:assignment |assignment children first interval contents]] . annotationInformation variableNames: variableNames. annotationInformation instrumentationCallFor: (self value: aNode)] \ No newline at end of file diff --git a/packages/Babylonian-Compiler.package/BPSourceRewriter.class/methodProperties.json b/packages/Babylonian-Compiler.package/BPSourceRewriter.class/methodProperties.json index 76ed7905..e741bbcb 100644 --- a/packages/Babylonian-Compiler.package/BPSourceRewriter.class/methodProperties.json +++ b/packages/Babylonian-Compiler.package/BPSourceRewriter.class/methodProperties.json @@ -27,7 +27,7 @@ "nextBlockId" : "pre 1/27/2020 09:17", "nextProbeId" : "pre 5/10/2019 12:20", "rewriteArgumentNode:withTag:" : "pre 7/23/2022 15:41", - "rewriteAssignmentNode:withTag:" : "pre 7/6/2020 18:10", + "rewriteAssignmentNode:withTag:" : "joabe 10/4/2023 15:31", "rewriteCascadeNode:withTag:" : "pre 4/29/2020 17:05", "rewriteNode:withTag:" : "pre 9/25/2020 11:20", "value:" : "pre 9/25/2020 11:42", diff --git a/packages/Babylonian-Core.package/BPAnnotation.class/instance/removeFromMethod..st b/packages/Babylonian-Core.package/BPAnnotation.class/instance/removeFromMethod..st index b9d4b532..d81d818b 100644 --- a/packages/Babylonian-Core.package/BPAnnotation.class/instance/removeFromMethod..st +++ b/packages/Babylonian-Core.package/BPAnnotation.class/instance/removeFromMethod..st @@ -1,7 +1,7 @@ initialize-release removeFromMethod: aCompiledMethod - "Intended to delete annotations from outside a browser" + "Intended to delete annotations but not the enclosed expression from outside a browser" aCompiledMethod bpAnnotations detect: [:anAnnotation | anAnnotation id = self id ] ifFound: [:theAnnotationToRemove | | text startOfTag expressionStart replacementStart replacementEnd | diff --git a/packages/Babylonian-Core.package/BPAnnotation.class/methodProperties.json b/packages/Babylonian-Core.package/BPAnnotation.class/methodProperties.json index c8ae160c..b97893df 100644 --- a/packages/Babylonian-Core.package/BPAnnotation.class/methodProperties.json +++ b/packages/Babylonian-Core.package/BPAnnotation.class/methodProperties.json @@ -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:" : "jb 1/10/2022 19:20", + "removeFromMethod:" : "joabe 10/5/2023 17:28", "startTag" : "pre 5/10/2021 09:44", "startTagSource" : "jb 12/7/2020 18:06", "startTagSource:" : "pre 5/29/2019 10:59", diff --git a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/deleteLinkedProbes.st b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/deleteLinkedProbes.st new file mode 100644 index 00000000..0fa79817 --- /dev/null +++ b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/deleteLinkedProbes.st @@ -0,0 +1,10 @@ +initialize-release +deleteLinkedProbes + + | browser | + browser := BPBrowser open. + self linkedProbes do: [:aProbe | + browser browseReference: aProbe methodReference. + browser removeAnnotations: {aProbe}]. + + browser currentWindow delete. \ No newline at end of file diff --git a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/initialize.st b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/initialize.st new file mode 100644 index 00000000..2442703e --- /dev/null +++ b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/initialize.st @@ -0,0 +1,6 @@ +initialize-release +initialize + + super initialize. + + linkedProbes := OrderedCollection new. \ No newline at end of file diff --git a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/instrumentationCallFor..st b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/instrumentationCallFor..st index a4a182fd..95c019d7 100644 --- a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/instrumentationCallFor..st +++ b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/instrumentationCallFor..st @@ -1,5 +1,7 @@ -as yet unclassified +serialization instrumentationCallFor: actualEnclosedExpressionSource - ^ '(self bpTraceVariable: [{1}] forProbe: {2} inContext: thisContext)' - format: {actualEnclosedExpressionSource . self id} \ No newline at end of file + ^ '(self bpTraceVariable: [{1}] forProbe: {2} linked: \{{3}\} inContext: thisContext)' + format: {actualEnclosedExpressionSource . + self id. + ((self linkedProbes gather: [:probe | probe id]) joinSeparatedBy: ' . ')} \ No newline at end of file diff --git a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/linkedProbes.st b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/linkedProbes.st new file mode 100644 index 00000000..c4809403 --- /dev/null +++ b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/linkedProbes.st @@ -0,0 +1,4 @@ +accessing +linkedProbes + + ^ linkedProbes \ No newline at end of file diff --git a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/probeTypeTag.st b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/probeTypeTag.st index 148987e6..da5e9857 100644 --- a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/probeTypeTag.st +++ b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/probeTypeTag.st @@ -1,4 +1,4 @@ -as yet unclassified +serialization probeTypeTag ^ 'bpInstanceProbe' \ No newline at end of file diff --git a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/removeFromMethod..st b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/removeFromMethod..st index 40ad5f67..18baafbf 100644 --- a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/removeFromMethod..st +++ b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/instance/removeFromMethod..st @@ -1,4 +1,4 @@ -as yet unclassified +initialize-release removeFromMethod: aCompiledMethod "do nothing" \ No newline at end of file diff --git a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/methodProperties.json b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/methodProperties.json index 41ceb980..cd4f0cee 100644 --- a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/methodProperties.json +++ b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/methodProperties.json @@ -6,8 +6,11 @@ "assignedClassName" : "joabe 9/28/2023 15:45", "assignedClassName:" : "joabe 9/28/2023 15:46", "canBeAnnotatedTo" : "joabe 9/21/2023 21:08", - "instrumentationCallFor:" : "joabe 9/25/2023 18:43", + "deleteLinkedProbes" : "joabe 10/5/2023 17:34", + "initialize" : "joabe 10/4/2023 15:33", + "instrumentationCallFor:" : "joabe 10/4/2023 15:37", "isInstanceVariableProbe" : "joabe 9/21/2023 21:18", + "linkedProbes" : "joabe 10/4/2023 15:33", "probeTypeTag" : "joabe 9/25/2023 17:30", "removeFromMethod:" : "joabe 9/27/2023 16:43", "variableName" : "joabe 9/28/2023 14:47", diff --git a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/properties.json b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/properties.json index acf4ba73..f53092e1 100644 --- a/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/properties.json +++ b/packages/Babylonian-Core.package/BPInstanceVariableProbe.class/properties.json @@ -6,7 +6,8 @@ ], "commentStamp" : "", "instvars" : [ - "assignedClassName" ], + "assignedClassName", + "linkedProbes" ], "name" : "BPInstanceVariableProbe", "pools" : [ ], diff --git a/packages/Babylonian-Core.package/CompiledMethod.extension/instance/bpExtractVariableAssignmentRangesNamed..st b/packages/Babylonian-Core.package/CompiledMethod.extension/instance/bpExtractVariableAssignmentRangesNamed..st new file mode 100644 index 00000000..b841f234 --- /dev/null +++ b/packages/Babylonian-Core.package/CompiledMethod.extension/instance/bpExtractVariableAssignmentRangesNamed..st @@ -0,0 +1,6 @@ +*Babylonian-Core +bpExtractVariableAssignmentRangesNamed: aVariableName + + ^ (self extractAssignmentIntervalsFrom: self parseTree named: aVariableName) flatten + + \ No newline at end of file diff --git a/packages/Babylonian-Core.package/CompiledMethod.extension/instance/extractAssignmentIntervalsFrom.named..st b/packages/Babylonian-Core.package/CompiledMethod.extension/instance/extractAssignmentIntervalsFrom.named..st new file mode 100644 index 00000000..103f7753 --- /dev/null +++ b/packages/Babylonian-Core.package/CompiledMethod.extension/instance/extractAssignmentIntervalsFrom.named..st @@ -0,0 +1,19 @@ +*Babylonian-Core +extractAssignmentIntervalsFrom: aRBNodeWithBody named: aVariableName + + "Private" + | currentIntervals nestedIntervals | + "No shadowing" + ((aRBNodeWithBody body temporaries collect: [:aVariableNode | aVariableNode token value]) + includes: aVariableName) ifTrue: [^ #()]. + + nestedIntervals := aRBNodeWithBody body statements select: [:aRBNode | aRBNode isBlock] + thenCollect: [:aBlockNode | self extractAssignmentIntervalsFrom: aBlockNode named: aVariableName]. + currentIntervals := aRBNodeWithBody body statements select: [:aRBNode | + aRBNode isAssignment and: [aRBNode variable token value = aVariableName]] + thenCollect: [:anAssignmentNode | + anAssignmentNode startWithoutParentheses@anAssignmentNode stopWithoutParentheses]. + + ^ currentIntervals, nestedIntervals + + \ No newline at end of file diff --git a/packages/Babylonian-Core.package/CompiledMethod.extension/methodProperties.json b/packages/Babylonian-Core.package/CompiledMethod.extension/methodProperties.json index 7b1f9357..28eb6b82 100644 --- a/packages/Babylonian-Core.package/CompiledMethod.extension/methodProperties.json +++ b/packages/Babylonian-Core.package/CompiledMethod.extension/methodProperties.json @@ -5,10 +5,12 @@ "bpActiveExamples" : "pre 8/20/2020 15:51", "bpAnnotations" : "pre 6/24/2021 14:26", "bpExamples" : "pre 1/11/2023 15:01", + "bpExtractVariableAssignmentRangesNamed:" : "joabe 10/4/2023 14:47", "bpNewExampleFrom:" : "pre 5/10/2021 09:11", "bpRemoveExample:" : "pre 5/19/2021 21:35", "compiledMethod" : "pre 7/7/2020 15:39", "exampleInstanceName" : "pre 9/28/2021 16:22", + "extractAssignmentIntervalsFrom:named:" : "joabe 10/4/2023 14:21", "isBPInstalled" : "pre 1/11/2021 12:00", "isExampleInstanceMethod" : "pre 9/28/2021 16:00", "newExampleInstance" : "pre 9/28/2021 16:00" } } diff --git a/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/instance/removeButtonClicked.st b/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/instance/removeButtonClicked.st index 0a8e2a3b..f1a92ae9 100644 --- a/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/instance/removeButtonClicked.st +++ b/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/instance/removeButtonClicked.st @@ -1,9 +1,11 @@ as yet unclassified removeButtonClicked - "LSP violation here - but otherwise the removal of the morph won't happen... -jb" + self annotation deleteLinkedProbes. + BPClassNameToInstanceProbes value removeProbe: self annotation. - super removeButtonClicked. + + self containingBrowser removeAnnotations: {self annotation}. \ No newline at end of file diff --git a/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/instance/step.st b/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/instance/step.st index c43d077e..e7a3bab8 100644 --- a/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/instance/step.st +++ b/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/instance/step.st @@ -2,7 +2,7 @@ as yet unclassified step | newTraces tracesChanged | - self resetHeight. + "self resetHeight." "newTraces := self getTraces asIdentitySet. tracesChanged := newTraces ~= displayedTraces. diff --git a/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/methodProperties.json b/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/methodProperties.json index 697b024f..be26d723 100644 --- a/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/methodProperties.json +++ b/packages/Babylonian-UI.package/BPInstanceVariableProbeMorph.class/methodProperties.json @@ -2,5 +2,5 @@ "class" : { }, "instance" : { - "removeButtonClicked" : "joabe 9/28/2023 15:54", - "step" : "joabe 9/25/2023 18:34" } } + "removeButtonClicked" : "joabe 10/4/2023 16:22", + "step" : "joabe 10/4/2023 11:52" } } diff --git a/packages/Babylonian-UI.package/CodeHolder.extension/instance/determineIntervalOfVariableNameIn.having..st b/packages/Babylonian-UI.package/CodeHolder.extension/instance/determineIntervalOfVariableNameIn.having..st index 6dc34a4f..9cdd27bc 100644 --- a/packages/Babylonian-UI.package/CodeHolder.extension/instance/determineIntervalOfVariableNameIn.having..st +++ b/packages/Babylonian-UI.package/CodeHolder.extension/instance/determineIntervalOfVariableNameIn.having..st @@ -12,11 +12,13 @@ determineIntervalOfVariableNameIn: anInterval having: aTopologicalCollectionOfAn 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] - ifFound: [:matchingVariable | | start | - start := self contents findString: matchingVariable. - ^ Interval from: start to: start + matchingVariable size - 1] + ifFound: [:matchingVariable | | interval | + "in case we have variables like 'foo2' and 'foo' we have to consider spaces or '' too" + interval := (self contents allRangesOfRegexMatches: '(''| )', matchingVariable, '(''| )') first. + ^ Interval from: (interval start + 1) to: (interval stop - 1)] \ No newline at end of file diff --git a/packages/Babylonian-UI.package/CodeHolder.extension/instance/determineMessageSendNodeIn..st b/packages/Babylonian-UI.package/CodeHolder.extension/instance/determineMessageSendNodeIn..st index 19739da7..bf83c13b 100644 --- a/packages/Babylonian-UI.package/CodeHolder.extension/instance/determineMessageSendNodeIn..st +++ b/packages/Babylonian-UI.package/CodeHolder.extension/instance/determineMessageSendNodeIn..st @@ -3,7 +3,6 @@ determineMessageSendNodeIn: anInterval | nodes messageSendRuleNames lowestMessageSend | self bpEnsureContentsAndSelectedMessage. - self flag: #todo. "will break for instance probes jb" nodes := currentCompiledMethod bpSourceMap at: anInterval start. messageSendRuleNames := #(ExpressionOperandCascade ExpressionUnaryCascade ExpressionBinaryCascade UnaryMessageSend BinaryMessageSend KeywordMessageSend). ^ lowestMessageSend := nodes reversed diff --git a/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddAnnotation.in..st b/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddAnnotation.in..st index a19159cf..a7d846b3 100644 --- a/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddAnnotation.in..st +++ b/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddAnnotation.in..st @@ -6,5 +6,6 @@ doAddAnnotation: anAnnotation in: interval actualInterval ifNil: [self codeTextMorph textMorph flash. ^ self]. anAnnotation isInstanceVariableProbe - ifTrue: [self doAddInstanceProbeToRegistry: anAnnotation nameIn: actualInterval] + ifTrue: [self doAddInstanceProbeToRegistry: anAnnotation nameIn: actualInterval. + self doAddLinkedAnnotationsFor: anAnnotation] ifFalse: [self doAddAnnotationMorphToMethod: anAnnotation in: actualInterval]. \ No newline at end of file diff --git a/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddInstanceProbeToRegistry.nameIn..st b/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddInstanceProbeToRegistry.nameIn..st index 1aba3766..91449aa3 100644 --- a/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddInstanceProbeToRegistry.nameIn..st +++ b/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddInstanceProbeToRegistry.nameIn..st @@ -2,7 +2,7 @@ doAddInstanceProbeToRegistry: anInstanceVariableProbe nameIn: anInterval anInstanceVariableProbe - variableName: (self codeTextMorph text atAll: anInterval); + variableName: (self codeTextMorph text atAll: anInterval) asString; assignedClassName: (self selectedClass name). BPClassNameToInstanceProbes value addProbe: anInstanceVariableProbe \ No newline at end of file diff --git a/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddLinkedAnnotationsFor..st b/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddLinkedAnnotationsFor..st new file mode 100644 index 00000000..cfe49da8 --- /dev/null +++ b/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddLinkedAnnotationsFor..st @@ -0,0 +1,9 @@ +*Babylonian-UI-private +doAddLinkedAnnotationsFor: anInstanceVariableProbe + + | allSenderMethods | + allSenderMethods := (self systemNavigation + allAccessesTo: anInstanceVariableProbe variableName + from: (Smalltalk bindingOf: (anInstanceVariableProbe assignedClassName asSymbol)) value). + + allSenderMethods collect: [:aMethodReference | self doAddLinkedAnnotationsFor: anInstanceVariableProbe in: aMethodReference]. \ No newline at end of file diff --git a/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddLinkedAnnotationsFor.in..st b/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddLinkedAnnotationsFor.in..st new file mode 100644 index 00000000..0465ce44 --- /dev/null +++ b/packages/Babylonian-UI.package/CodeHolder.extension/instance/doAddLinkedAnnotationsFor.in..st @@ -0,0 +1,14 @@ +*Babylonian-UI-private +doAddLinkedAnnotationsFor: anInstanceVariableProbe in: aMethodReference + + | allRanges styledText | + allRanges := aMethodReference compiledMethod bpExtractVariableAssignmentRangesNamed: anInstanceVariableProbe variableName. + styledText := aMethodReference sourceCode. + + allRanges do: [:aRange | anInstanceVariableProbe linkedProbes add: + (self styleText: styledText in: aRange referencing: aMethodReference)]. + + allRanges ifNotEmpty: [SystemChangeNotifier uniqueInstance doSilently: + [aMethodReference actualClass + compile: (BPStyler new unstyledTextFrom: styledText) + classified: aMethodReference category]]. \ No newline at end of file diff --git a/packages/Babylonian-UI.package/CodeHolder.extension/instance/styleText.in.referencing..st b/packages/Babylonian-UI.package/CodeHolder.extension/instance/styleText.in.referencing..st new file mode 100644 index 00000000..b62f06a7 --- /dev/null +++ b/packages/Babylonian-UI.package/CodeHolder.extension/instance/styleText.in.referencing..st @@ -0,0 +1,13 @@ +*Babylonian-UI-private +styleText: aText in: aRange referencing: aMethodReference + + | linkedProbe | + self flag: #todo. "If assignment already has an annotation, re-use that one" + linkedProbe := BPProbe new methodReference: aMethodReference. + aText addAttribute: ( + BPTextDecoration new + anchoredMorph: linkedProbe asMorph; + yourself) + from: aRange x + to: aRange y. + ^ linkedProbe \ No newline at end of file diff --git a/packages/Babylonian-UI.package/CodeHolder.extension/methodProperties.json b/packages/Babylonian-UI.package/CodeHolder.extension/methodProperties.json index 8735dd17..f8fc798a 100644 --- a/packages/Babylonian-UI.package/CodeHolder.extension/methodProperties.json +++ b/packages/Babylonian-UI.package/CodeHolder.extension/methodProperties.json @@ -20,13 +20,15 @@ "codePaneMenuBPTracingItems:" : "pre 9/2/2022 15:06", "compiledMethod" : "ct 3/30/2022 16:48", "determineIntervalOfReceiver:" : "pre 9/2/2022 14:29", - "determineIntervalOfVariableNameIn:having:" : "joabe 9/26/2023 11:33", + "determineIntervalOfVariableNameIn:having:" : "joabe 10/2/2023 13:21", "determineIntervalToAnnotateFor:in:" : "joabe 9/26/2023 13:52", - "determineMessageSendNodeIn:" : "joabe 9/21/2023 21:31", + "determineMessageSendNodeIn:" : "joabe 10/2/2023 13:26", "determineSelectorOfMessageSend:" : "pre 9/2/2022 14:49", - "doAddAnnotation:in:" : "joabe 9/27/2023 17:22", + "doAddAnnotation:in:" : "joabe 10/4/2023 16:16", "doAddAnnotationMorphToMethod:in:" : "joabe 9/27/2023 16:21", - "doAddInstanceProbeToRegistry:nameIn:" : "joabe 9/28/2023 15:50", + "doAddInstanceProbeToRegistry:nameIn:" : "joabe 10/2/2023 16:07", + "doAddLinkedAnnotationsFor:" : "joabe 10/4/2023 16:18", + "doAddLinkedAnnotationsFor:in:" : "joabe 10/5/2023 12:25", "doBrowseActualImplementersFromProbe:andSelector:" : "pre 9/2/2022 15:54", "doItReceiver" : "ct 3/30/2022 16:48", "exampleForEvaluation" : "ct 8/18/2021 23:15", @@ -41,4 +43,5 @@ "removeSelectedAnnotationsSatisfying:" : "pre 9/2/2022 14:42", "removeTypeProbeFromSelection" : "pre 11/30/2022 09:40", "saveMethodWithExamples" : "joabe 9/22/2023 22:57", - "saveMethodWithExamplesWith:" : "pre 8/6/2019 13:57" } } + "saveMethodWithExamplesWith:" : "pre 8/6/2019 13:57", + "styleText:in:referencing:" : "joabe 10/5/2023 12:24" } }