DoItChange.st
author Claus Gittinger <cg@exept.de>
Sun, 23 Feb 2020 16:35:34 +0100
changeset 4557 069040b49bec
parent 4482 96ecc9e89d37
permissions -rw-r--r--
#REFACTORING by exept class: CVSSourceCodeManager class changed: #revisionInfoFromString:inClass:

"{ Encoding: utf8 }"

"
 COPYRIGHT (c) 1998 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libbasic3' }"

"{ NameSpace: Smalltalk }"

Change subclass:#DoItChange
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'System-Changes'
!

!DoItChange class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1998 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

!

documentation
"
    I represent a doIt (typically #initialize-messages) within a changeSet
"
! !

!DoItChange methodsFor:'applying'!

apply
    "apply the change"

    Compiler evaluate:source.
! !

!DoItChange methodsFor:'comparing'!

isInitialize
    "return true, if the given change represents a #initialize message."

    |tree|

    tree := Parser parseExpression:source onError:nil.
    ^ tree notNil
      and:[ tree isMessage 
      and:[ tree selector == #initialize ]]
!

sameAs:changeB
    "return true, if the given change represents the same change as the receiver."

    changeB isDoIt ifFalse:[^ false].
    ^ self sameSourceAs:changeB


! !

!DoItChange methodsFor:'printing & storing'!

printOn:aStream
    aStream nextPutAll:'DoIt: '.
    aStream nextPutAll:source.
! !

!DoItChange methodsFor:'queries'!

receiverClassName
    |tree|

    tree := Parser parseExpression:source onError:nil.
    (tree notNil 
      and:[ tree isMessage 
      and:[ tree receiver isVariable 
    ]]) ifTrue:[
        ^ tree receiver name
    ].
    ^ nil
! !

!DoItChange methodsFor:'testing'!

isDoIt
    ^ true
! !

!DoItChange methodsFor:'visiting'!

acceptChangeVisitor:aVisitor
    ^ aVisitor visitDoItChange:self.

    "Created: / 25-11-2011 / 17:15:07 / cg"
! !

!DoItChange class methodsFor:'documentation'!

version
    ^ '$Header$'
! !