moo/stix/kernel/Class.st
hyunghwan.chung 7779229b52 changed some directives from symbols to plain words including class, method, pooldic, dcl.
introduced stix_pfrc_t as a return code type from a primitive function
2017-01-06 09:53:40 +00:00

51 lines
951 B
Smalltalk

##
## the Class object should be a variable-pointer object because
## it needs to accomodate class instance variables.
##
class(#pointer) Class(Apex)
{
dcl spec selfspec superclass subclasses name instvars classvars classinstvars pooldics instmthdic classmthdic.
method(#class) basicNew
{
## you must not instantiate a new class this way.
self cannotInstantiate.
}
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 7 bits.
## see stix-prv.h for details.
^self.spec bitShift: -7
}
(*method inheritsFrom: aSuperclass
{
| c |
c := self superclass.
[c notNil] whileTrue: [
[ c == aSuperclass ] ifTrue: [^true].
c := c superclass.
].
^false
}*)
}