added nsup field to the class object to chain back to the upper namespace in the hierarchy.
changed bootstrapping code and compiler code to weave top-level namespace hierarchy more consistantly, mostly related to the System class and its intrinsic namespace dictionary linked via the nsdic field
This commit is contained in:
@ -6,26 +6,15 @@ class(#pointer,#limited) Class(Apex)
|
||||
{
|
||||
var spec, selfspec, superclass, subclasses, name, modname.
|
||||
var instvars, classinstvars, classvars, pooldics.
|
||||
var instmthdic, classmthdic, nsdic, cdic.
|
||||
var instmthdic, classmthdic, nsup, nsdic, cdic.
|
||||
var trsize, initv, initv_ci.
|
||||
|
||||
method(#class) initialize
|
||||
{
|
||||
^self.
|
||||
}
|
||||
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 name { ^self.name }
|
||||
method superclass { ^self.superclass }
|
||||
|
||||
method specNumInstVars
|
||||
{
|
||||
@ -45,8 +34,6 @@ class(#pointer,#limited) Class(Apex)
|
||||
^false
|
||||
}*)
|
||||
|
||||
method nsdic
|
||||
{
|
||||
^self.nsdic
|
||||
}
|
||||
method nsup { ^self.nsup }
|
||||
method nsdic { ^self.nsdic }
|
||||
}
|
||||
|
@ -513,8 +513,23 @@ class Dictionary(Set)
|
||||
}
|
||||
}
|
||||
|
||||
class SystemDictionary(Set)
|
||||
(* Namespace is marked with #limited. If a compiler is writeen in moo itself, it must
|
||||
* call a primitive to instantiate a new namespace rather than sending the new message
|
||||
* to Namespace *)
|
||||
class(#limited) Namespace(Set)
|
||||
{
|
||||
var name, nsup.
|
||||
|
||||
method name { ^self.name }
|
||||
## method name: name { self.name := name }
|
||||
|
||||
(* nsup points to either the class associated with this namespace or directly
|
||||
* the upper namespace placed above this namespace. when it points to a class,
|
||||
* you should inspect the nsup field of the class to reach the actual upper
|
||||
* namespace *)
|
||||
method nsup { ^self.nsup }
|
||||
## method nsup: nsup { self.nsup := nsup }
|
||||
|
||||
method at: key
|
||||
{
|
||||
if (key class ~= Symbol) { InvalidArgumentException signal: 'key is not a symbol' }.
|
||||
@ -528,17 +543,12 @@ class SystemDictionary(Set)
|
||||
}
|
||||
}
|
||||
|
||||
class Namespace(Set)
|
||||
{
|
||||
}
|
||||
|
||||
class PoolDictionary(Set)
|
||||
{
|
||||
}
|
||||
|
||||
class MethodDictionary(Dictionary)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
extend Apex
|
||||
|
@ -94,6 +94,7 @@ class MyObject(Object)
|
||||
'unusable variable in compiled code'
|
||||
'inaccessible variable'
|
||||
'ambiguous variable'
|
||||
'inaccessible self'
|
||||
'wrong expression primary'
|
||||
'too many temporaries'
|
||||
'too many arguments'
|
||||
|
Reference in New Issue
Block a user