diff --git a/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/fieldHashEntries.st b/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/fieldHashEntries.st new file mode 100644 index 000000000..7908b1c4f --- /dev/null +++ b/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/fieldHashEntries.st @@ -0,0 +1,7 @@ +fields +fieldHashEntries + + ^ (self newFieldForType: #misc key: #hashes) + name: 'hash entries'; emphasizeName; + valueGetter: [ :o | self hashEntriesOf: o ]; printValueAsIs; + yourself \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/hashEntriesOf..st b/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/hashEntriesOf..st new file mode 100644 index 000000000..a6327f80e --- /dev/null +++ b/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/hashEntriesOf..st @@ -0,0 +1,19 @@ +helpers +hashEntriesOf: anObject + | size | + ^ (size := (Interop getHashSize: anObject)) < 100 ifTrue: [ | iterator | + iterator := Interop getHashEntriesIterator: anObject. + Text streamContents: [ :aStream | + [ Interop hasIteratorNextElement: iterator ] whileTrue: [ | next key value | + next := Interop getIteratorNextElement: iterator. + key := next at: 1. + value := next at: 2. + aStream + withAttributes: { PluggableTextAttribute evalBlock: [ key inspect ]. TextColor color: Color gray } + do: [ aStream nextPutAll: key printString ]; + nextPutAll: ' -> '; + withAttributes: { PluggableTextAttribute evalBlock: [ value inspect ]. TextEmphasis italic } + do: [ aStream nextPutAll: '', value printString ]; + cr; cr + ] ]] + ifFalse: [ 'Hash size: ', size, ' (too many entries to display)' ] diff --git a/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/streamOptionalFieldsOn..st b/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/streamOptionalFieldsOn..st index e4020d527..e0ea1835e 100644 --- a/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/streamOptionalFieldsOn..st +++ b/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/instance/streamOptionalFieldsOn..st @@ -3,6 +3,8 @@ streamOptionalFieldsOn: aStream (Interop hasMembers: self object) ifTrue: [ aStream nextPutAll: self fieldsMembers ]. + (Interop hasHashEntries: self object) ifTrue: [ + aStream nextPut: self fieldHashEntries ]. (Interop isMetaObject: self object) ifTrue: [ aStream nextPut: self fieldMetaName ]. (Interop hasMetaObject: self object) ifTrue: [ diff --git a/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/methodProperties.json b/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/methodProperties.json index 2459d1665..7aa73f895 100644 --- a/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/methodProperties.json +++ b/src/TruffleSqueak-Tools-Core.package/PolyglotInspector.class/methodProperties.json @@ -6,11 +6,13 @@ "buildCodePaneWith:" : "fn 6/25/2021 17:56", "exceptionInfoFor:" : "fn 6/10/2021 17:15", "fieldException" : "fn 6/11/2021 09:17", + "fieldHashEntries" : "fn 6/29/2021 21:24", "fieldLanguageInfo" : "fn 6/10/2021 16:48", "fieldMetaName" : "fn 4/11/2021 15:02", "fieldMetaObjectInfo" : "fn 6/25/2021 09:24", "fieldSource" : "fn 4/11/2021 15:02", "fieldsMembers" : "fn 6/26/2021 10:49", + "hashEntriesOf:" : "fn 6/29/2021 21:43", "helpText" : "fn 6/25/2021 17:57", "initialExtent" : "fn 2/12/2021 10:35", "inspect:" : "fn 11/21/2019 15:47", @@ -32,4 +34,4 @@ "streamArrayElementsOn:" : "fn 4/11/2021 15:03", "streamBaseFieldsOn:" : "fn 2/11/2021 11:01", "streamFieldsOn:" : "fn 2/11/2021 11:49", - "streamOptionalFieldsOn:" : "fn 6/26/2021 11:17" } } + "streamOptionalFieldsOn:" : "fn 6/29/2021 21:32" } }