Skip to content

Commit

Permalink
Make ForeignObject>>printOnTitle more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Mar 11, 2021
1 parent 827699b commit 37c97ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
printing
printOnTitle
| arraySize memberSize properties name |
(Interop isNull: self) ifTrue: [ ^ 'ForeignNil' ].
(Interop isString: self) ifTrue: [ ^ 'ForeignString[', self asString, ']' ].
(Interop fitsInLong: self) ifTrue: [ ^ 'ForeignInteger[', (Interop asLong: self), ']' ].
(Interop fitsInDouble: self) ifTrue: [ ^ 'ForeignFloat[', (Interop asDouble: self), ']' ].
| properties |
properties := OrderedCollection new.
arraySize := (Interop hasArrayElements: self)
ifTrue: [ Interop getArraySize: self ] ifFalse: [ 0 ].
memberSize := (Interop hasMembers: self)
ifTrue: [ Interop getMemberSize: self ] ifFalse: [ 0 ].
arraySize > 0 ifTrue: [ properties add: 'arraySize=', arraySize ].
memberSize > 0 ifTrue: [ properties add: 'memberSize=', memberSize ].
(Interop isNull: self) ifTrue: [ properties add: 'nil' ].
(Interop isHostObject: self) ifTrue: [ properties add: 'host' ].
(Interop isString: self) ifTrue: [ properties add: 'string' ].
(Interop fitsInLong: self) ifTrue: [ properties add: (Interop asLong: self) asString ].
(Interop fitsInDouble: self) ifTrue: [ properties add: (Interop asDouble: self) asString ].
(Interop isMetaObject: self) ifTrue: [ properties add: 'meta' ].
(Interop isInstantiable: self) ifTrue: [ properties add: 'instantiable' ].
(Interop isExecutable: self) ifTrue: [ properties add: 'executable' ].
(Interop isMetaObject: self) ifTrue: [ properties add: 'meta' ].
(Interop hasIdentity: self) ifTrue: [ properties add: 'identity' ].
name := (Interop isHostObject: self)
ifTrue: [ 'HostObject' ]
ifFalse: [ 'ForeignObject' ].
(Interop hasArrayElements: self) ifTrue: [ properties add: 'arraySize=', (Interop getArraySize: self) ].
(Interop hasMembers: self) ifTrue: [ properties add: 'memberSize=', (Interop getMemberSize: self) ].
^ properties
ifEmpty: [ name ]
ifNotEmpty: [ name, '[', (properties joinSeparatedBy: ','), ']' ]
ifEmpty: [ 'ForeignObject' ]
ifNotEmpty: [ 'ForeignObject[', (properties joinSeparatedBy: ','), ']' ]
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"or:" : "fn 2/11/2021 10:35",
"postCopy" : "fn 8/2/2019 16:59",
"printOn:" : "fn 4/13/2019 20:45",
"printOnTitle" : "fn 2/19/2021 13:18",
"printOnTitle" : "fn 3/11/2021 14:26",
"shallowCopy" : "fn 8/2/2019 16:59",
"size" : "fn 11/11/2019 22:08",
"value" : "fn 2/4/2020 00:11",
Expand Down

0 comments on commit 37c97ba

Please sign in to comment.