Skip to content

Commit

Permalink
Now that RBComment is a subclass of RBProgramnode, we can remove the …
Browse files Browse the repository at this point in the history
…duplicated methods
  • Loading branch information
MarcusDenker committed Jul 22, 2020
1 parent d59067f commit 6fb4941
Showing 1 changed file with 0 additions and 73 deletions.
73 changes: 0 additions & 73 deletions src/AST-Core/RBComment.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ RBComment >> contents [
^ contents
]

{ #category : #properties }
RBComment >> hasProperty: aKey [
"Test if the property aKey is present."

^ properties notNil and: [ properties includesKey: aKey ]
]

{ #category : #testing }
RBComment >> intersectsInterval: anInterval [
"Make comments polymorphic with program nodes for hit detection"
Expand All @@ -71,16 +64,6 @@ RBComment >> intersectsInterval: anInterval [
or: [ self start between: anInterval first and: anInterval last ]
]

{ #category : #accessing }
RBComment >> parent [
^ parent
]

{ #category : #accessing }
RBComment >> parent: anObject [
parent := anObject
]

{ #category : #printing }
RBComment >> printOn: aStream [
super printOn: aStream.
Expand All @@ -89,62 +72,6 @@ RBComment >> printOn: aStream [
aStream nextPutAll: '" '.
]

{ #category : #properties }
RBComment >> propertyAt: aKey [
"Answer the property value associated with aKey."

^ self propertyAt: aKey ifAbsent: [ self error: 'Property not found' ]
]

{ #category : #properties }
RBComment >> propertyAt: aKey ifAbsent: aBlock [
"Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock."

^ properties
ifNil: aBlock
ifNotNil: [ properties at: aKey ifAbsent: aBlock ]
]

{ #category : #properties }
RBComment >> propertyAt: aKey ifAbsentPut: aBlock [
"Answer the property associated with aKey or, if aKey isn't found store the result of evaluating aBlock as new value."

^ self propertyAt: aKey ifAbsent: [ self propertyAt: aKey put: aBlock value ]
]

{ #category : #properties }
RBComment >> propertyAt: aKey ifPresent: aPresentBlock ifAbsent: anAbsentBlock [
"Answer the property value associated with aKey or, if aKey is found, answer the result of evaluating aPresentBlock, else evaluates anAbsentBlock."

^ properties ifNil: anAbsentBlock ifNotNil: [ properties at: aKey ifPresent: aPresentBlock ifAbsent: anAbsentBlock ]
]

{ #category : #properties }
RBComment >> propertyAt: aKey put: anObject [
"Set the property at aKey to be anObject. If aKey is not found, create a new entry for aKey and set is value to anObject. Answer anObject."

^ (properties ifNil: [ properties := SmallDictionary new: 1 ])
at: aKey put: anObject
]

{ #category : #properties }
RBComment >> removeProperty: aKey [
"Remove the property with aKey. Answer the property or raise an error if aKey isn't found."

^ self removeProperty: aKey ifAbsent: [ self error: 'Property not found' ].
]

{ #category : #properties }
RBComment >> removeProperty: aKey ifAbsent: aBlock [
"Remove the property with aKey. Answer the value or, if aKey isn't found, answer the result of evaluating aBlock."

| answer |
properties ifNil: [ ^ aBlock value ].
answer := properties removeKey: aKey ifAbsent: aBlock.
properties isEmpty ifTrue: [ properties := nil ].
^ answer
]

{ #category : #accessing }
RBComment >> size [
^ contents size + 2 "must take into account quotation marks"
Expand Down

0 comments on commit 6fb4941

Please sign in to comment.