Browse Source

Deprecate Object >> asJavaScriptObject.

Never used anyway, only specific versions are.
Herby Vojčík 4 years ago
parent
commit
e2f81faded
3 changed files with 6 additions and 2 deletions
  1. 2 0
      lang/API-CHANGES.txt
  2. 3 2
      lang/src/Kernel-Objects.js
  3. 1 0
      lang/src/Kernel-Objects.st

+ 2 - 0
lang/API-CHANGES.txt

@@ -3,6 +3,8 @@
 * Deprecate ClassBuilder >> addSubclass:named:instanceVariableNames:package:.
 * Deprecate ClassBuilder >> addSubclass:named:instanceVariableNames:package:.
 * Deprecate ... >> migrateClassNamed:superclass:instanceVariableNames:package:.
 * Deprecate ... >> migrateClassNamed:superclass:instanceVariableNames:package:.
 * Behavior >> instanceVariableNames aimed at only that. No visible change atm.
 * Behavior >> instanceVariableNames aimed at only that. No visible change atm.
+* Deprecate Object >> asJavaScriptObject.
+  * Hard to do generically if slots are added later.
 
 
 + Behavior >>
 + Behavior >>
   + slots
   + slots

+ 3 - 2
lang/src/Kernel-Objects.js

@@ -754,17 +754,18 @@ selector: "asJavaScriptObject",
 protocol: "converting",
 protocol: "converting",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
 args: [],
-source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarNamed: each) asJavaScriptObject ].\x0a\x09^ variables",
+source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09self deprecatedAPI: 'Implement domain-specific #asJavaScriptObject on your classes instead.'.\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarNamed: each) asJavaScriptObject ].\x0a\x09^ variables",
 referencedClasses: ["HashedCollection"],
 referencedClasses: ["HashedCollection"],
 //>>excludeEnd("ide");
 //>>excludeEnd("ide");
 pragmas: [],
 pragmas: [],
-messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarNamed:"]
+messageSends: ["deprecatedAPI:", "new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarNamed:"]
 }, function ($methodClass){ return function (){
 }, function ($methodClass){ return function (){
 var self=this,$self=this;
 var self=this,$self=this;
 var variables;
 var variables;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 //>>excludeEnd("ctx");
+$self._deprecatedAPI_("Implement domain-specific #asJavaScriptObject on your classes instead.");
 variables=$recv($globals.HashedCollection)._new();
 variables=$recv($globals.HashedCollection)._new();
 $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
 $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);

+ 1 - 0
lang/src/Kernel-Objects.st

@@ -294,6 +294,7 @@ asJSONString
 
 
 asJavaScriptObject
 asJavaScriptObject
 	| variables |
 	| variables |
+	self deprecatedAPI: 'Implement domain-specific #asJavaScriptObject on your classes instead.'.
 	variables := HashedCollection new.
 	variables := HashedCollection new.
 	self class allInstanceVariableNames do: [ :each |
 	self class allInstanceVariableNames do: [ :each |
 		variables at: each put: (self instVarNamed: each) asJavaScriptObject ].
 		variables at: each put: (self instVarNamed: each) asJavaScriptObject ].