moo/kernel/Class.moo

51 lines
1.2 KiB
Smalltalk
Raw Normal View History

interface ClassInterface
{
method name.
method superclass.
}
//
// the Class object should be a variable-pointer object because
// it needs to accomodate class instance variables.
//
class(#pointer,#limited,#uncopyable) Class(Apex) [ClassInterface]
{
var name, instmthdic, classmthdic, nsup, nsdic.
var spec, selfspec, superclass, subclasses, modname.
var instvars, classinstvars, classvars, pooldics.
2017-06-16 09:45:22 +00:00
var trsize, trgc, initv, initv_ci.
method(#class) initialize { ^self }
/* most of the following methods can actually become class methods of Apex.
* if the instance varibles can be made accessible from the Apex class. */
method name { ^self.name }
method superclass { ^self.superclass }
method specNumInstVars
{
// shift right by 8 bits.
// see MOO_CLASS_SPEC_NAMED_INSTVARS in moo-prv.h for details.
^self.spec bitShift: -8
}
/*method inheritsFrom: aSuperclass
{
| c |
c := self superclass.
[c notNil] whileTrue: [
[ c == aSuperclass ] ifTrue: [^true].
c := c superclass.
].
^false
}*/
method nsup { ^self.nsup }
method nsdic { ^self.nsdic }
}
2018-07-08 17:13:10 +00:00
class(#pointer,#limited,#uncopyable) Interface(Apex)
2018-07-08 17:13:10 +00:00
{
var name, instmthdic, classmthdic, nsup, nsdic.
2018-07-08 17:13:10 +00:00
}