Revert "Revert "Made use of ::= in core libraries and defined a RebindError condition...
[cslatevm.git] / src / lib / lookup.slate
blobe4bd9bc5ebca99e0b3b345fdb8801dd1f580caf7
1 define: #LookupSequence &slots: {#source. #parents -> ExtensibleArray new}.
2 "Describes the objects that the VM will consult in order when a method lookup
3 happens. This allows introspection and interactive debugging of lookup issues.
4 It also provides a reference implementation in Slate of the lookup algorithm
5 without being obscured in underlying VM details and optimizations."
7 s@(LookupSequence traits) newOn: obj
8 [(s clone `setting: #{#source. #parents} to: {obj. s parents new}) refresh].
10 obj@(Root traits) lookupSequence
11 [LookupSequence newOn: obj].
13 s@(LookupSequence traits) refresh
15   s parents clear.
16   (s source walker &traversal: DepthFirst &childrenVia:
17     [| :obj | obj restrictsDelegation ifTrue: [obj delegateValues] ifFalse: [#{}]]) >>
18     s parents writer.
19   s