Browse Source

CompiledMethod >> methodClass

It now shows where the CompiledMethod
was actually installed (can be different
to origin when acquired via trait).
Herby Vojčík 5 years ago
parent
commit
9d8720474c
3 changed files with 9 additions and 5 deletions
  1. 4 0
      lang/base/kernel-fundamentals.js
  2. 3 3
      lang/src/Kernel-Methods.js
  3. 2 2
      lang/src/Kernel-Methods.st

+ 4 - 0
lang/base/kernel-fundamentals.js

@@ -202,6 +202,10 @@ define(function () {
             }
             if (newMethod === oldMethod) return;
             if (newMethod != null) {
+                if (newMethod.methodClass && newMethod.methodClass !== traitOrBehavior) {
+                    console.warn("Resetting methodClass of " + newMethod.methodClass.name + " >> " + selector + " to " + traitOrBehavior.name);
+                }
+                newMethod.methodClass = traitOrBehavior;
                 traitOrBehavior.methods[selector] = newMethod;
                 traitOrBehavior.methodAdded(newMethod);
             } else {

+ 3 - 3
lang/src/Kernel-Methods.js

@@ -755,7 +755,7 @@ $globals.BlockClosure);
 
 
 
-$core.addClass("CompiledMethod", $globals.Object, ["args", "fn", "messageSends", "pragmas", "owner", "protocol", "referencedClasses", "selector", "source"], "Kernel-Methods");
+$core.addClass("CompiledMethod", $globals.Object, ["args", "fn", "messageSends", "pragmas", "owner", "methodClass", "protocol", "referencedClasses", "selector", "source"], "Kernel-Methods");
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a    Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
 //>>excludeEnd("ide");
@@ -1186,12 +1186,12 @@ selector: "methodClass",
 protocol: "accessing",
 fn: function (){
 var self=this,$self=this;
-return $self.owner;
+return $self.methodClass;
 
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "methodClass\x0a\x09^ owner",
+source: "methodClass\x0a\x09^ methodClass",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],

+ 2 - 2
lang/src/Kernel-Methods.st

@@ -201,7 +201,7 @@ valueWithTimeout: aNumber
 ! !
 
 Object subclass: #CompiledMethod
-	slots: {#args. #fn. #messageSends. #pragmas. #owner. #protocol. #referencedClasses. #selector. #source}
+	slots: {#args. #fn. #messageSends. #pragmas. #owner. #methodClass. #protocol. #referencedClasses. #selector. #source}
 	package: 'Kernel-Methods'!
 !CompiledMethod commentStamp!
 I represent a class method of the system. I hold the source and compiled code of a class method.
@@ -250,7 +250,7 @@ messageSends
 !
 
 methodClass
-	^ owner
+	^ methodClass
 !
 
 origin