-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make ForeignObject>>printOnTitle more consistent
- Loading branch information
Showing
2 changed files
with
12 additions
and
17 deletions.
There are no files selected for viewing
27 changes: 11 additions & 16 deletions
27
src/TruffleSqueak-Core.package/ForeignObject.class/instance/printOnTitle.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ','), ']' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters