NamespaceAwareLookup.st
branchjv
changeset 21086 dae6aabc5a14
parent 20133 fefb47dc71f6
child 21242 19fabe339f8b
--- a/NamespaceAwareLookup.st	Fri Nov 18 20:48:57 2016 +0000
+++ b/NamespaceAwareLookup.st	Wed Nov 23 16:40:25 2016 +0000
@@ -96,7 +96,19 @@
 	"
 
 %{
-    OBJ sendingMthd = __ContextInstPtr(sendingContext)->c_method;
+    OBJ sendingMthd = nil;
+    OBJ ctx = sendingContext;
+    while ( ctx && 
+          (__isLazy(ctx) 
+                ? __isLazyBCon(ctx) 
+                : __qIsBlockContextLike(ctx))) {
+        ctx = __ContextInstPtr(ctx)->c_home;
+    }
+    if ( (ctx != nil) &&
+	 (((INT)(__ContextInstPtr(ctx)->c_flags) & __MASKSMALLINT(__METHOD_VALID))) ) {
+        sendingMthd = __ContextInstPtr(sendingContext)->c_method;	 
+    }
+	          
     if (__Class(sendingMthd) == Method &&
 	    __MethodInstPtr(sendingMthd)->m_annotation == nil) {
 	    OBJ m = __lookup(initialSearchClass, selector);
@@ -126,8 +138,21 @@
      since class browser involves dozens of super-polymorphic
      sends (> 1000 receiver classes per send-site).
     "
-%{
-    sendingMthd = __ContextInstPtr(sendingContext)->c_method;
+    
+%{    
+    OBJ ctx = sendingContext;
+    sendingMthd = nil;
+    while ( ctx && 
+          (__isLazy(ctx) 
+                ? __isLazyBCon(ctx) 
+                : __qIsBlockContextLike(ctx))) {
+        ctx = __ContextInstPtr(ctx)->c_home;
+    }
+    if ( (ctx != nil) &&
+	 (((INT)(__ContextInstPtr(ctx)->c_flags) & __MASKSMALLINT(__METHOD_VALID))) ) {
+        sendingMthd = __ContextInstPtr(ctx)->c_method;	 
+    }
+
     if (__Class(sendingMthd) == Method &&
             __MethodInstPtr(sendingMthd)->m_annotation == nil) {
             OBJ m = __lookup(initialSearchClass, selector);