UndefVar.st
author claus
Fri, 11 Aug 1995 18:04:27 +0200
changeset 103 f4a69d7dd387
parent 102 77e4d1119ff2
child 135 aa4f7b8f121e
permissions -rw-r--r--
.

"
 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 comment:'
COPYRIGHT (c) 1993 by Claus Gittinger
	      All Rights Reserved

$Header: /cvs/stx/stx/libcomp/Attic/UndefVar.st,v 1.7 1995-08-11 16:04:21 claus Exp $
'!

!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.
"
!

version
"
$Header: /cvs/stx/stx/libcomp/Attic/UndefVar.st,v 1.7 1995-08-11 16:04:21 claus Exp $
"
!

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:'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:'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:'private accessing'!

setName:aString
    name := aString
! !

!UndefinedVariable methodsFor:'printing & storing'!

printString
    "return a string for printing myself"

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