1
0
Преглед на файлове

Platform class >> includesGlobal:

Deprecate SmalltalkImage >> existsJsGlobal:.
Herby Vojčík преди 6 години
родител
ревизия
d1b0a15398
променени са 7 файла, в които са добавени 53 реда и са изтрити 18 реда
  1. 4 0
      API-CHANGES.txt
  2. 4 9
      src/Kernel-Infrastructure.js
  3. 2 4
      src/Kernel-Infrastructure.st
  4. 4 4
      src/Kernel-Methods.js
  5. 1 1
      src/Kernel-Methods.st
  6. 29 0
      src/Platform-Services.js
  7. 9 0
      src/Platform-Services.st

+ 4 - 0
API-CHANGES.txt

@@ -1,11 +1,15 @@
 0.21.0:
 
+* Deprecate SmalltalkImage >> existsJsGlobal:
+
 + Number >>
   + bitAnd:
   + bitNot
   + bitOr:
   + bitXor:
   + printStringBase:
++ Platform class >>
+  + includesGlobal:
 
 
 0.20.0:

+ 4 - 9
src/Kernel-Infrastructure.js

@@ -3253,23 +3253,18 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
-return true;
-
-}),(function(){
-return false;
-
-}));
+$self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
+return $recv($globals.Platform)._includesGlobal_(aString);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aString"],
-source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
+source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
 referencedClasses: ["Platform"],
 //>>excludeEnd("ide");
-messageSends: ["at:ifPresent:ifAbsent:", "globals"]
+messageSends: ["deprecatedAPI:", "includesGlobal:"]
 }),
 $globals.SmalltalkImage);
 

+ 2 - 4
src/Kernel-Infrastructure.st

@@ -1040,10 +1040,8 @@ deleteClass: aClass
 !SmalltalkImage methodsFor: 'testing'!
 
 existsJsGlobal: aString
-	^ Platform globals 
-		at: aString 
-		ifPresent: [ true ] 
-		ifAbsent: [ false ]
+	self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.
+	^ Platform includesGlobal: aString
 !
 
 isSmalltalkObject: anObject

+ 4 - 4
src/Kernel-Methods.js

@@ -2956,17 +2956,17 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
+return $recv($globals.Platform)._includesGlobal_(aString);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aString"],
-source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
-referencedClasses: ["Smalltalk"],
+source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
+referencedClasses: ["Platform"],
 //>>excludeEnd("ide");
-messageSends: ["existsJsGlobal:"]
+messageSends: ["includesGlobal:"]
 }),
 $globals.NativeFunction.a$cls);
 

+ 1 - 1
src/Kernel-Methods.st

@@ -875,7 +875,7 @@ methodOf: nativeFunc this: thisObject valueWithArgs: args
 !NativeFunction class methodsFor: 'testing'!
 
 exists: aString
-	^ Smalltalk existsJsGlobal: aString
+	^ Platform includesGlobal: aString
 !
 
 isNativeFunction: anObject

+ 29 - 0
src/Platform-Services.js

@@ -1624,6 +1624,35 @@ messageSends: ["globals", "current"]
 }),
 $globals.Platform.a$cls);
 
+$core.addMethod(
+$core.method({
+selector: "includesGlobal:",
+protocol: "testing",
+fn: function (aString){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
+return true;
+
+}),(function(){
+return false;
+
+}));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString"],
+source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["at:ifPresent:ifAbsent:", "globals"]
+}),
+$globals.Platform.a$cls);
+
 $core.addMethod(
 $core.method({
 selector: "newXhr",

+ 9 - 0
src/Platform-Services.st

@@ -428,6 +428,15 @@ newXhr
 	^ self current newXhr
 ! !
 
+!Platform class methodsFor: 'testing'!
+
+includesGlobal: aString
+	^ self globals 
+		at: aString 
+		ifPresent: [ true ] 
+		ifAbsent: [ false ]
+! !
+
 Service subclass: #ProgressHandler
 	instanceVariableNames: ''
 	package: 'Platform-Services'!