Skip to content

Commit

Permalink
Add GTInspectors for Data (Ctors, Rvars)
Browse files Browse the repository at this point in the history
  • Loading branch information
shingarov committed Jun 29, 2024
1 parent 2bb6a78 commit a06e8f8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 7 deletions.
38 changes: 38 additions & 0 deletions src/SpriteLang/Data.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,33 @@ dataSigs (Data _ _ ctors) = [(F.symbol b, t) | (b, t) <- ctors]
^ctors collectAssociations: [ :b :t | b id -> t ]
]

{ #category : #GT }
Data >> gtInspectorCtorsIn: composite [
<gtInspectorPresentationOrder: 1>

^ composite fastTable
title: 'Ctors';
display: [ ctors ];
column: 'Ctor' evaluated: [ :each | each key id ];
column: 'Type' evaluated: [ :each | each value printString ];
send: [ :sel |
sel
ifNil: [ nil ]
ifNotNil: [ sel value ]
]

]

{ #category : #GT }
Data >> gtInspectorRvarsIn: composite [
<gtInspectorPresentationOrder: 2>

^ composite fastList
title: 'Rvars';
display: [ rvars ];
format: [ :each | each prettyPrint ]
]

{ #category : #accessing }
Data >> inv [
^ inv
Expand All @@ -71,6 +98,17 @@ Data >> name: anObject [
name := anObject
]

{ #category : #printing }
Data >> printOn: aStream [
aStream nextPutAll: ''.
aStream nextPutAll: name.
vars do: [ :eachTypeVar |
aStream nextPutAll: ' '''.
aStream nextPutAll: eachTypeVar
]

]

{ #category : #accessing }
Data >> rvars [
^ rvars
Expand Down
18 changes: 11 additions & 7 deletions src/SpriteLang/RVar.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,20 @@ cf. Check.hs
]

{ #category : #printing }
RVar >> printOn: aStream [
aStream nextPutAll: 'RVar{';
nextPutAll: rvName;
nextPut: $(.
rvArgs printOn: aStream delimiter: ', '.
aStream nextPutAll: ')}'

RVar >> prettyPrint [
^rvName,
'(',
((rvArgs collect: #printString) separatedBy: ', '),
')'

]

{ #category : #printing }
RVar >> printOn: aStream [
aStream nextPutAll: 'RVar ';
nextPutAll: self prettyPrint
]

{ #category : #'as yet unclassified' }
RVar >> rVarARef__Types [
"
Expand Down

0 comments on commit a06e8f8

Please sign in to comment.