UndefVar.st
author Claus Gittinger <cg@exept.de>
Sun, 03 Dec 1995 13:17:26 +0100
changeset 148 ef0e604209ec
parent 140 1ef1d1395146
child 261 0372e948ca2d
permissions -rw-r--r--
version method at the end

"
 COPYRIGHT (c) 1993 by Claus Gittinger
	      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.
"

Object subclass:#UndefinedVariable
	 instanceVariableNames:'name'
	 classVariableNames:''
	 poolDictionaries:''
	 category:'System-Compiler-Support'
!

!UndefinedVariable class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1993 by Claus Gittinger
	      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
"
    node for parse-trees, representing undefined variables

    This class exists solely for the error message when accessing undefined
    variables - instead of returning nil,  the compiler returns an instance
    of this class,  which will not understand ANY message.
    The error message will then be 'UndefinedVariable ...' 
    instead of 'UndefineObject ...', which is somewhat more informative.
"
! !

!UndefinedVariable class methodsFor:'instance creation'!

name:aString
    ^ (self basicNew) setName:aString
! !

!UndefinedVariable methodsFor:'catching messages'!

class
    ^ self
!

methods
    self methodError
!

methodsFor:arg
    self methodError
!

subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s
    self subclassingError
!

subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
    self subclassingError
!

variableByteSubclass:t instanceVariableNames:f 
			  classVariableNames:d poolDictionaries:s category:cat
    self subclassingError
!

variableSubclass:t instanceVariableNames:f 
			  classVariableNames:d poolDictionaries:s category:cat
    self subclassingError
!

variableWordSubclass:t instanceVariableNames:f 
			  classVariableNames:d poolDictionaries:s category:cat
    self subclassingError
! !

!UndefinedVariable methodsFor:'error reporting'!

methodError
    self error:('trying to define methods for undefined class: ', name)
!

subclassingError
    self error:('trying to create subclass of undefined class: ', name)
! !

!UndefinedVariable methodsFor:'file skipping'!

fileInFrom:aStream notifying:someOne passChunk:passChunk
    "this is sent, if you continue after a warning about
     methods for undefined class.
     It simply skips chunks and sends a warning to the Transcript."

    |aString done|

    done := false.
    [done] whileFalse:[
	done := aStream atEnd.
	done ifFalse:[
	    aString := aStream nextChunk.
	    done := aString isNil or:[aString isEmpty].
	    done ifFalse:[
		Transcript showCr:'*** skipping method for undefined class: ' , name
	    ]
	]
    ].
! !

!UndefinedVariable methodsFor:'printing & storing'!

printString
    "return a string for printing myself"

    ^ 'UndefinedVariable(' , name , ')'
! !

!UndefinedVariable methodsFor:'private accessing'!

setName:aString
    name := aString
! !

!UndefinedVariable class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libcomp/Attic/UndefVar.st,v 1.10 1995-12-03 12:14:45 cg Exp $'
! !