Browse Source

Revert "Remove kernel-level deprecations."

This reverts commit c5f2c219
Herby Vojčík 5 years ago
parent
commit
0dbc2292fd

+ 0 - 1
CHANGELOG

@@ -2,7 +2,6 @@
 ===================================
 
 * Fixes.
-* Remove kernel-level deprecations.
 * Flatter Collection hierarchy with traits, remove IndexableCollection class.
 * Remove some old IE8 cruft.
 * Push CharacterArray down, make it and alias to String and deprecate it.

+ 11 - 0
lang/base/boot.js

@@ -57,6 +57,17 @@ define([
                 if (initialized) return;
                 brikz.classes.bootstrapHierarchy();
                 configureWithRuntime(brikz);
+                // TODO deprecation helper; remove
+                Object.defineProperty(st, "packages", {
+                    get: function () {
+                        console.warn("Use of .packages deprecated, use .packageDescriptors");
+                        return st.packageDescriptors;
+                    },
+                    set: function (v) {
+                        console.trace();
+                        throw new Error("No one should be setting st.packages directly on initialized Amber.");
+                    }
+                });
                 return Promise.resolve(brikz.startImage.run())
                     .then(function () {
                         initialized = true;

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

@@ -197,6 +197,17 @@ define(function () {
                 throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
             }
             method.owner = traitOrBehavior;
+            // TODO deprecation helper; remove
+            Object.defineProperty(method, "methodClass", {
+                get: function () {
+                    console.warn("Use of .methodClass deprecated, use .owner");
+                    return method.owner;
+                },
+                set: function (v) {
+                    console.warn("Use of .methodClass= deprecated, use .owner=");
+                    method.owner = v;
+                }
+            });
             registerNewSelectors(method);
             traitOrBehavior.localMethods[method.selector] = method;
             updateMethod(method.selector, traitOrBehavior);

+ 23 - 1
lang/base/kernel-language.js

@@ -109,6 +109,17 @@ define(function () {
                 name: traitName,
                 make: function () {
                     var that = new SmalltalkTrait();
+                    // TODO deprecation helper; remove
+                    Object.defineProperty(that, "className", {
+                        get: function () {
+                            console.warn("Use of .className deprecated, use .name");
+                            return that.name;
+                        },
+                        set: function (v) {
+                            console.warn("Use of .className= deprecated, use .name=");
+                            that.name = v;
+                        }
+                    });
                     that.name = traitName;
                     that.traitUsers = [];
                     setupMethods(that);
@@ -313,7 +324,7 @@ define(function () {
 
         this.bootstrapHierarchy = function () {
             var nilSubclasses = [globals.ProtoObject];
-            nilAsClass.a$cls = globals.Class;
+            nilAsClass.a$cls = nilAsClass.klass = globals.Class;
             nilSubclasses.forEach(function (each) {
                 each.a$cls.superclass = globals.Class;
                 addSubclass(each.a$cls);
@@ -340,6 +351,17 @@ define(function () {
                     }, superclass.fn);
                 that.iVarNames = iVarNames || [];
 
+                // TODO deprecation helper; remove
+                Object.defineProperty(that, "className", {
+                    get: function () {
+                        console.warn("Use of .className deprecated, use .name");
+                        return that.name;
+                    },
+                    set: function (v) {
+                        console.warn("Use of .className= deprecated, use .name=");
+                        that.name = v;
+                    }
+                });
                 that.name = className;
                 that.subclasses = [];
 

+ 4 - 4
lang/src/Kernel-Infrastructure.js

@@ -3090,7 +3090,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-delete anObject.a$cls;;
+delete anObject.klass; delete anObject.a$cls;;
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
@@ -3098,7 +3098,7 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anObject"],
-source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.a$cls;'>",
+source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass; delete anObject.a$cls;'>",
 referencedClasses: [],
 //>>excludeEnd("ide");
 messageSends: []
@@ -3414,7 +3414,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-anObject.a$cls = null;
+anObject.klass = null; anObject.a$cls = null;
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
@@ -3422,7 +3422,7 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anObject"],
-source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.a$cls = null'>",
+source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null; anObject.a$cls = null'>",
 referencedClasses: [],
 //>>excludeEnd("ide");
 messageSends: []

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

@@ -823,7 +823,7 @@ cancelOptOut: anObject
 	This removes the shadow and anObject is Smalltalk object
 	again if it was before."
 	
-	<inlineJS: 'delete anObject.a$cls;'>
+	<inlineJS: 'delete anObject.klass; delete anObject.a$cls;'>
 !
 
 core
@@ -843,7 +843,7 @@ optOut: anObject
 	This shadows the property for anObject.
 	The object is treated as plain JS object following this."
 	
-	<inlineJS: 'anObject.a$cls = null'>
+	<inlineJS: 'anObject.klass = null; anObject.a$cls = null'>
 !
 
 parse: aString