瀏覽代碼

kernel: .packages => .packageDescriptors

Deprecation getters / setters in place.
Herbert Vojčík 7 年之前
父節點
當前提交
9795093fd7
共有 4 個文件被更改,包括 17 次插入7 次删除
  1. 3 3
      src/Kernel-Infrastructure.js
  2. 1 1
      src/Kernel-Infrastructure.st
  3. 11 0
      support/boot.js
  4. 2 3
      support/kernel-fundamentals.js

+ 3 - 3
src/Kernel-Infrastructure.js

@@ -2909,7 +2909,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-$recv($recv($self._core())._packages())._keysAndValuesDo_((function(key,value){
+$recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -2925,10 +2925,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "adoptPackageDictionary\x0a\x09self core packages keysAndValuesDo: [ :key :value | Package named: key javaScriptDescriptor: value ]",
+source: "adoptPackageDictionary\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value | Package named: key javaScriptDescriptor: value ]",
 referencedClasses: ["Package"],
 //>>excludeEnd("ide");
-messageSends: ["keysAndValuesDo:", "packages", "core", "named:javaScriptDescriptor:"]
+messageSends: ["keysAndValuesDo:", "packageDescriptors", "core", "named:javaScriptDescriptor:"]
 }),
 $globals.SmalltalkImage);
 

+ 1 - 1
src/Kernel-Infrastructure.st

@@ -1019,7 +1019,7 @@ renamePackage: packageName to: newName
 !SmalltalkImage methodsFor: 'private'!
 
 adoptPackageDictionary
-	self core packages keysAndValuesDo: [ :key :value | Package named: key javaScriptDescriptor: value ]
+	self core packageDescriptors keysAndValuesDo: [ :key :value | Package named: key javaScriptDescriptor: value ]
 !
 
 basicCreatePackage: packageName

+ 11 - 0
support/boot.js

@@ -59,6 +59,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.");
+                    }
+                });
                 brikz.startImage.run();
                 initialized = true;
             });

+ 2 - 3
support/kernel-fundamentals.js

@@ -119,13 +119,12 @@ define(function () {
     }
 
     function PackagesBrik (brikz, st) {
-        // TODO remove .packages, have .packageDescriptors
-        st.packages = {};
+        st.packages = st.packageDescriptors = {};
 
         /* Add a package load descriptor to the system */
         st.addPackage = function (name, properties) {
             if (!name) return null;
-            return st.packages[name] = {properties: properties};
+            return st.packageDescriptors[name] = {properties: properties};
         };
     }