Browse Source

kernel: goodies api renames.

Herby Vojčík 4 years ago
parent
commit
4672761a50
3 changed files with 32 additions and 32 deletions
  1. 6 6
      lang/base/kernel-goodies.js
  2. 12 12
      lang/base/kernel-language.js
  3. 14 14
      lang/base/kernel-runtime.js

+ 6 - 6
lang/base/kernel-goodies.js

@@ -13,15 +13,15 @@ define(function () {
         return child;
     }
 
-    function defineMethod (klass, name, method) {
+    function installMethodOfJsClass (klass, name, fn) {
         Object.defineProperty(klass.prototype, name, {
-            value: method,
+            value: fn,
             enumerable: false, configurable: true, writable: true
         });
     }
 
-    function installJSMethod (obj, jsSelector, fn) {
-        Object.defineProperty(obj, jsSelector, {
+    function installMethodOfJsObject (obj, name, fn) {
+        Object.defineProperty(obj, name, {
             value: fn,
             enumerable: false, configurable: true, writable: true
         });
@@ -99,8 +99,8 @@ define(function () {
         addElement: addElement,
         js2st: js2st,
         st2js: st2js,
-        installJSMethod: installJSMethod,
-        defineMethod: defineMethod,
+        installMethodOfJsObject: installMethodOfJsObject,
+        installMethodOfJsClass: installMethodOfJsClass,
         inherits: inherits
     }
 });

+ 12 - 12
lang/base/kernel-language.js

@@ -4,7 +4,7 @@ define(['./kernel-goodies'], function ($goodies) {
     "use strict";
 
     var inherits = $goodies.inherits;
-    var defineMethod = $goodies.defineMethod;
+    var installMethodOfJsClass = $goodies.installMethodOfJsClass;
     var addElement = $goodies.addElement;
     var removeElement = $goodies.removeElement;
 
@@ -144,19 +144,19 @@ define(['./kernel-goodies'], function ($goodies) {
 
             SmalltalkTrait.prototype.trait = true;
 
-            defineMethod(SmalltalkTrait, "toString", function () {
+            installMethodOfJsClass(SmalltalkTrait, "toString", function () {
                 return 'Smalltalk Trait ' + this.name;
             });
             declareEvent("traitAdded");
-            defineMethod(SmalltalkTrait, "added", function () {
+            installMethodOfJsClass(SmalltalkTrait, "added", function () {
                 emit.traitAdded(this);
             });
             declareEvent("traitRemoved");
-            defineMethod(SmalltalkTrait, "removed", function () {
+            installMethodOfJsClass(SmalltalkTrait, "removed", function () {
                 emit.traitRemoved(this);
             });
             declareEvent("traitMethodAdded");
-            defineMethod(SmalltalkTrait, "methodAdded", function (method) {
+            installMethodOfJsClass(SmalltalkTrait, "methodAdded", function (method) {
                 var self = this;
                 this.traitUsers.forEach(function (each) {
                     traitMethodChanged(method.selector, method, self, each);
@@ -164,7 +164,7 @@ define(['./kernel-goodies'], function ($goodies) {
                 emit.traitMethodAdded(method, this);
             });
             declareEvent("traitMethodRemoved");
-            defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
+            installMethodOfJsClass(SmalltalkTrait, "methodRemoved", function (method) {
                 var self = this;
                 this.traitUsers.forEach(function (each) {
                     traitMethodChanged(method.selector, null, self, each);
@@ -226,28 +226,28 @@ define(['./kernel-goodies'], function ($goodies) {
 
             SmalltalkMetaclass.prototype.meta = true;
 
-            defineMethod(SmalltalkClass, "toString", function () {
+            installMethodOfJsClass(SmalltalkClass, "toString", function () {
                 return 'Smalltalk ' + this.name;
             });
-            defineMethod(SmalltalkMetaclass, "toString", function () {
+            installMethodOfJsClass(SmalltalkMetaclass, "toString", function () {
                 return 'Smalltalk Metaclass ' + this.instanceClass.name;
             });
             declareEvent("classAdded");
-            defineMethod(SmalltalkClass, "added", function () {
+            installMethodOfJsClass(SmalltalkClass, "added", function () {
                 addSubclass(this);
                 emit.classAdded(this);
             });
             declareEvent("classRemoved");
-            defineMethod(SmalltalkClass, "removed", function () {
+            installMethodOfJsClass(SmalltalkClass, "removed", function () {
                 emit.classRemoved(this);
                 removeSubclass(this);
             });
             declareEvent("behaviorMethodAdded");
-            defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
+            installMethodOfJsClass(SmalltalkBehavior, "methodAdded", function (method) {
                 emit.behaviorMethodAdded(method, this);
             });
             declareEvent("behaviorMethodRemove");
-            defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
+            installMethodOfJsClass(SmalltalkBehavior, "methodRemoved", function (method) {
                 emit.behaviorMethodRemoved(method, this);
             });
 

+ 14 - 14
lang/base/kernel-runtime.js

@@ -3,8 +3,8 @@
 define(['./kernel-goodies'], function ($goodies) {
     "use strict";
 
-    var defineMethod = $goodies.defineMethod;
-    var installJSMethod = $goodies.installJSMethod;
+    var installMethodOfJsClass = $goodies.installMethodOfJsClass;
+    var installMethodOfJsObject = $goodies.installMethodOfJsObject;
     var st2js = $goodies.st2js;
     var js2st = $goodies.js2st;
 
@@ -47,9 +47,9 @@ define(['./kernel-goodies'], function ($goodies) {
                     var jsSelector = st2js(selector);
                     jsSelectors.push(jsSelector);
                     var fn = createDnuHandler(selector);
-                    installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
+                    installMethodOfJsObject(nilAsClass.fn.prototype, jsSelector, fn);
                     targetClasses.forEach(function (target) {
-                        installJSMethod(target.fn.prototype, jsSelector, fn);
+                        installMethodOfJsObject(target.fn.prototype, jsSelector, fn);
                     });
                 });
             }
@@ -74,7 +74,7 @@ define(['./kernel-goodies'], function ($goodies) {
         function RuntimeClassesBrik (brikz, st) {
             var jsSelectors = brikz.runtimeSelectors.jsSelectors;
             var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
-            var installMethod = brikz.runtimeMethods.installMethod;
+            var installAmberMethodIntoAmberClass = brikz.runtimeMethods.installAmberMethodIntoAmberClass;
             var traitsOrClasses = brikz.behaviors.traitsOrClasses;
             var wireKlass = brikz.classes.wireKlass;
             var installIvarCompat = brikz.classes.installIvarCompat;
@@ -146,14 +146,14 @@ define(['./kernel-goodies'], function ($goodies) {
                 var myproto = klass.fn.prototype,
                     superproto = klass.superclass.fn.prototype;
                 jsSelectors.forEach(function (jsSelector) {
-                    installJSMethod(myproto, jsSelector, superproto[jsSelector]);
+                    installMethodOfJsObject(myproto, jsSelector, superproto[jsSelector]);
                 });
             }
 
             function installMethods (klass) {
                 var methods = klass.methods;
                 Object.keys(methods).forEach(function (selector) {
-                    installMethod(methods[selector], klass);
+                    installAmberMethodIntoAmberClass(methods[selector], klass);
                 });
             }
 
@@ -206,18 +206,18 @@ define(['./kernel-goodies'], function ($goodies) {
         function RuntimeMethodsBrik (brikz, st) {
             var st2js = brikz.selectorConversion.st2js;
 
-            function installMethod (method, klass) {
+            function installAmberMethodIntoAmberClass (method, klass) {
                 var jsSelector = method.jsSelector;
                 if (!jsSelector) {
                     jsSelector = method.jsSelector = st2js(method.selector);
                 }
-                installJSMethod(klass.fn.prototype, jsSelector, method.fn);
+                installMethodOfJsObject(klass.fn.prototype, jsSelector, method.fn);
             }
 
-            this.installMethod = installMethod;
+            this.installAmberMethodIntoAmberClass = installAmberMethodIntoAmberClass;
 
             emit.behaviorMethodAdded = function (method, klass) {
-                installMethod(method, klass);
+                installAmberMethodIntoAmberClass(method, klass);
                 propagateMethodChange(klass, method, klass);
             };
 
@@ -241,7 +241,7 @@ define(['./kernel-goodies'], function ($goodies) {
                     if (subclass === exclude) return;
                     if (subclass.methods[selector]) return sentinel;
                     if (subclass.detachedRoot) {
-                        installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
+                        installMethodOfJsObject(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
                     }
                 });
             }
@@ -293,7 +293,7 @@ define(['./kernel-goodies'], function ($goodies) {
             SmalltalkMethodContext.prototype.outerContext = null;
             SmalltalkMethodContext.prototype.index = 0;
 
-            defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals) {
+            installMethodOfJsClass(SmalltalkMethodContext, "fill", function (receiver, selector, locals) {
                 this.receiver = receiver;
                 this.selector = selector;
                 if (locals != null) this.locals = locals;
@@ -301,7 +301,7 @@ define(['./kernel-goodies'], function ($goodies) {
                     this.homeContext.evaluatedSelector = selector;
                 }
             });
-            defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
+            installMethodOfJsClass(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
                 if (locals != null) this.locals = locals;
                 this.outerContext = ctx;
                 if (index) this.index = index;