JavaUnresolvedFieldrefConstant.st
author cg
Fri, 22 Nov 2002 20:14:07 +0000
changeset 713 75e92ac63bf1
parent 600 78174752509d
child 748 da0840b7798c
permissions -rw-r--r--
category change

"
 COPYRIGHT (c) 1997 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:libjava' }"

JavaUnresolvedRefConstant subclass:#JavaUnresolvedFieldrefConstant
	instanceVariableNames:'classIndex'
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Java-Reader-Support'
!

!JavaUnresolvedFieldrefConstant class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 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.
"


! !

!JavaUnresolvedFieldrefConstant class methodsFor:'instance creation'!

pool:aPool poolIndex:idx classIndex:cIdx nameandTypeIndex:nmIdx
    ^ self new 
        pool:aPool poolIndex:idx classIndex:cIdx nameandTypeIndex:nmIdx


! !

!JavaUnresolvedFieldrefConstant methodsFor:'accessing'!

name
    |ref cls nameAndType|

    self isUnresolved ifTrue:[
        ref := self preResolve.
        ref isUnresolved ifFalse:[
            ^ ref name
        ].
        nameAndType := (constantPool at:nameandTypeIndex).
        nameAndType isUnresolved ifTrue:[
            nameAndType displayString printCR.
        ].
        ^ nameAndType name
    ].
('unresolved type: ' , self displayString) printCR.
    ^ self

    "Modified: 24.3.1997 / 13:02:56 / cg"
    "Created: 24.3.1997 / 13:09:26 / cg"
!

pool:aPool poolIndex:slotIndex classIndex:cIdx nameandTypeIndex:nmIdx  
    constantPool := aPool.
    constantPoolIndex := slotIndex.
    classIndex := cIdx.
    nameandTypeIndex := nmIdx



!

type
    |ref cls nameAndType|

    self isUnresolved ifTrue:[
        ref := self preResolve.
        ref isUnresolved ifFalse:[
            ^ ref type
        ].
        nameAndType := (constantPool at:nameandTypeIndex).
        nameAndType isUnresolved ifTrue:[
            nameAndType displayString printCR.
        ].
        ^ JavaMethod typeFromSignature:nameAndType signature in:nil.
    ].
('unresolved type: ' , self displayString) printCR.
    ^ self

    "Modified: / 8.1.1998 / 19:14:05 / cg"
! !

!JavaUnresolvedFieldrefConstant methodsFor:'printing & storing'!

displayString
    |classOrClassRef className nameAndType fieldName|

    classOrClassRef := (constantPool at:classIndex).
    className := classOrClassRef fullName.

    nameAndType := (constantPool at:nameandTypeIndex).
    nameAndType isUnresolved ifTrue:[
        nameAndType := nameAndType preResolve.
    ].
    fieldName := nameAndType name.
    ^ (self class name) , '( idx= ' , constantPoolIndex printString , ' class= ' , className , ' field= ' , fieldName ,')'


! !

!JavaUnresolvedFieldrefConstant methodsFor:'resolving'!

preResolve
    |className class nameAndType ref|

    class := (constantPool at:classIndex).
    class isUnresolved ifTrue:[
        class := class preResolve.
    ].
    class isUnresolved ifFalse:[
        nameAndType := (constantPool at:nameandTypeIndex).
        nameAndType isUnresolved ifTrue:[
            nameAndType := nameAndType preResolve.
        ].
        nameAndType isUnresolved ifFalse:[
            "/ good - class is there

            ref := JavaFieldref class:class nameandType:nameAndType.
            constantPool at:constantPoolIndex put:ref.
            ^ ref
        ]
    ].

    self rememberForResolveWith:(class fullName).
    ^ self

    "Created: 15.4.1996 / 16:05:50 / cg"
    "Modified: 15.4.1996 / 16:26:44 / cg"
!

resolveStatic
self halt.
    ^ self

! !

!JavaUnresolvedFieldrefConstant class methodsFor:'documentation'!

version
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaUnresolvedFieldrefConstant.st,v 1.13 2002/11/22 20:11:42 cg Exp $'
! !