BuiltinLookup.st
branchjv
changeset 17762 6eb4414e6a31
parent 17761 b0e5971141bc
child 17792 0254c771237a
--- a/BuiltinLookup.st	Mon Apr 26 19:26:38 2010 +0100
+++ b/BuiltinLookup.st	Thu Apr 29 16:55:35 2010 +0100
@@ -47,10 +47,11 @@
 
 instance
     
-    Instance isNil ifTrue: [Instance := super new].
+    Instance isNil ifTrue: [Instance := self basicNew].
     ^ Instance
 
     "Created: / 26-04-2010 / 19:25:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-04-2010 / 21:32:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BuiltinLookup methodsFor:'lookup'!
@@ -64,15 +65,31 @@
      The returned method object will be put into the inline- and polyCache
      at the call site; it might therefore be called more than once for the
      same receiver-class/selector combination (once for each call site).
-     If I return nil, a doesNotUnderstand will be invoked."
+     If I return nil, a doesNotUnderstand will be invoked.
+
+     BuiltinLookup represents the lookup as perfomed by the VM. Class
+     variable 'Instance' is a special value for the VM, if found in 
+     class's lookupObject slot, the lookup is done in the VM. "
+
+
+
+     |cls md method|
 
-     ^super lookupMethodForSelector:aSelector directedTo:searchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
+     cls := searchClass.
+     cls isNil ifTrue:[ cls := aReceiver class ].
+     [ cls notNil ] whileTrue:[
+        md := cls methodDictionary.
+        method := md at:aSelector ifAbsent:nil.
+        method notNil ifTrue:[^ method ].
+        cls := cls superclass.
+     ].
+     ^ nil
 
-    "Created: / 26-04-2010 / 19:29:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-04-2010 / 21:18:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BuiltinLookup class methodsFor:'documentation'!
 
 version_SVN
-    ^ '$Id: BuiltinLookup.st 10517 2010-04-26 18:26:38Z vranyj1 $'
+    ^ '$Id: BuiltinLookup.st 10518 2010-04-29 15:55:35Z vranyj1 $'
 ! !