Marcel Taeumel uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-mt.76.mcz ==================== Summary ==================== Name: ShoutCore-mt.76 Author: mt Time: 21 November 2019, 3:51:18.231156 pm UUID: c0aa1566-69f3-1845-8993-0f5f67fcdb96 Ancestors: ShoutCore-eem.75 Fixes a bug with syntax highlighting for dead context's in the debugger. =============== Diff against ShoutCore-eem.75 =============== Item was changed: ----- Method: SHParserST80>>initializeInstanceVariables (in category 'parse support') ----- initializeInstanceVariables instanceVariables := classOrMetaClass ifNil: [ #() ] ifNotNil: [ classOrMetaClass allInstVarNames asArray ]. allowUnderscoreAssignments := Scanner allowUnderscoreAsAssignment. allowUnderscoreSelectors := Scanner prefAllowUnderscoreSelectors. allowBlockArgumentAssignment := Scanner allowBlockArgumentAssignment. sourcePosition := 1. arguments ifNil: [ arguments := OrderedCollection with: nil ] ifNotNil: [ arguments reset; addLast: nil ]. temporaries ifNil: [ temporaries := OrderedCollection with: nil ] ifNotNil: [ temporaries reset; addLast: nil ]. + (context notNil and: [ context isDead not ]) + ifTrue: [ self initializeVariablesFromContext ]. - context ifNotNil: [ self initializeVariablesFromContext ]. bracketDepth := 0. ranges ifNil: [ ranges := OrderedCollection new: 40 "Covers over 80% of all methods." ] ifNotNil: [ ranges reset ]! Item was changed: ----- Method: SHParserST80>>initializeVariablesFromContext (in category 'parse support') ----- initializeVariablesFromContext | contextSourcePcIndex contextSourceParser | contextSourcePcIndex := (context debuggerMap rangeForPC: context pc in: context method + contextIsActiveContext: true "... to really use the context's pc.") - contextIsActiveContext: true "little white lie to work in every situation") start. contextSourceParser := self class new classOrMetaClass: context method methodClass; environment: self environment; source: (context method getSource first: contextSourcePcIndex); yourself. contextSourceParser parse. arguments := contextSourceParser activeArguments. temporaries := contextSourceParser activeTemporaries.! |
Hi Marcel,
Did you see ShoutCore-ct.76? I think my solution could also work for dead contexts, instead of just refusing to style :-)
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Donnerstag, 21. November 2019 15:51:18 An: [hidden email]; [hidden email] Betreff: [squeak-dev] The Trunk: ShoutCore-mt.76.mcz Marcel Taeumel uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-mt.76.mcz ==================== Summary ==================== Name: ShoutCore-mt.76 Author: mt Time: 21 November 2019, 3:51:18.231156 pm UUID: c0aa1566-69f3-1845-8993-0f5f67fcdb96 Ancestors: ShoutCore-eem.75 Fixes a bug with syntax highlighting for dead context's in the debugger. =============== Diff against ShoutCore-eem.75 =============== Item was changed: ----- Method: SHParserST80>>initializeInstanceVariables (in category 'parse support') ----- initializeInstanceVariables instanceVariables := classOrMetaClass ifNil: [ #() ] ifNotNil: [ classOrMetaClass allInstVarNames asArray ]. allowUnderscoreAssignments := Scanner allowUnderscoreAsAssignment. allowUnderscoreSelectors := Scanner prefAllowUnderscoreSelectors. allowBlockArgumentAssignment := Scanner allowBlockArgumentAssignment. sourcePosition := 1. arguments ifNil: [ arguments := OrderedCollection with: nil ] ifNotNil: [ arguments reset; addLast: nil ]. temporaries ifNil: [ temporaries := OrderedCollection with: nil ] ifNotNil: [ temporaries reset; addLast: nil ]. + (context notNil and: [ context isDead not ]) + ifTrue: [ self initializeVariablesFromContext ]. - context ifNotNil: [ self initializeVariablesFromContext ]. bracketDepth := 0. ranges ifNil: [ ranges := OrderedCollection new: 40 "Covers over 80% of all methods." ] ifNotNil: [ ranges reset ]! Item was changed: ----- Method: SHParserST80>>initializeVariablesFromContext (in category 'parse support') ----- initializeVariablesFromContext | contextSourcePcIndex contextSourceParser | contextSourcePcIndex := (context debuggerMap rangeForPC: context pc in: context method + contextIsActiveContext: true "... to really use the context's pc.") - contextIsActiveContext: true "little white lie to work in every situation") start. contextSourceParser := self class new classOrMetaClass: context method methodClass; environment: self environment; source: (context method getSource first: contextSourcePcIndex); yourself. contextSourceParser parse. arguments := contextSourceParser activeArguments. temporaries := contextSourceParser activeTemporaries.!
Carpe Squeak!
|
Hi Christoph, sounds good. Maybe a small comment on your comment from a previous contribution: "little white lie to work in every situation" That's a bad comment. :-) Instead of explaining "true" with "to make it always work", you should try elaborate on the meaining of "true" in this situation. I know that the interface #rangeForPC... is not perfect. However, a comment could state the relationship to the PC argument as specified above. This is what I tried to achieve with: "to really use the context's pc" Maybe this helps for writing comments in the future. :-) Best, Marcel
|
Hi Marcel,
yes, I read your comment and liked your explanation :) Thanks for your tips! I actually implemented this by trial & error, so I was not aware of the actual reason how it works before.
Same question as a few minutes ago: Would you like me to commit again or would this be unnecessary noise? :)
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Sonntag, 8. Dezember 2019 16:31:13 An: John Pfersich via Squeak-dev Betreff: Re: [squeak-dev] The Trunk: ShoutCore-mt.76.mcz
Hi Christoph,
sounds good. Maybe a small comment on your comment from a previous contribution:
"little white lie to work in every situation"
That's a bad comment. :-) Instead of explaining "true" with "to make it always work", you should try elaborate on the meaining of "true" in this situation. I know that the interface #rangeForPC... is not perfect. However,
a comment could state the relationship to the PC argument as specified above. This is what I tried to achieve with:
"to really use the context's pc"
Maybe this helps for writing comments in the future. :-)
Best,
Marcel
Carpe Squeak!
|
Hi Christoph, I don't know. What would be the benefit of moving the #isDead-check to #initializeVariablesFromContext? There are no useful information left for the styler or are there? Best, Marcel
|
Hi Marcel,
With ShoutCore-mt.76, we don't call #initializeVariablesFromContext at all if the context is dead. This means that any temporary variable or argument will be styled as an invalid identifier. With ShoutCore-ct.76, in the same case, we call #initializeVariablesFromContext indeed and parse the whole method source. This allows us to style tempvars and args that are visible in the whole method correctly.
Maybe this visualization helps:
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 9. Dezember 2019 10:15:00 An: John Pfersich via Squeak-dev Betreff: Re: [squeak-dev] The Trunk: ShoutCore-mt.76.mcz
Hi Christoph,
I don't know. What would be the benefit of moving the #isDead-check to #initializeVariablesFromContext?
There are no useful information left for the styler or are there?
Best,
Marcel
Carpe Squeak!
|
Free forum by Nabble | Edit this page |