Explorar o código

asJavaScriptSelector commented, moved to Kernel-Objects

Herbert Vojčík %!s(int64=11) %!d(string=hai) anos
pai
achega
fb6f8cbf62

+ 0 - 14
js/Kernel-Collections.deploy.js

@@ -2664,20 +2664,6 @@ return $1;
 messageSends: []}),
 smalltalk.String);
 
-smalltalk.addMethod(
-"_asJavaScriptSelector",
-smalltalk.method({
-selector: "asJavaScriptSelector",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=_st(self)._replace_with_("^([a-zA-Z0-9]*).*$","$1");
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
-messageSends: ["replace:with:"]}),
-smalltalk.String);
-
 smalltalk.addMethod(
 "_asJavascript",
 smalltalk.method({

+ 0 - 19
js/Kernel-Collections.js

@@ -3518,25 +3518,6 @@ referencedClasses: []
 }),
 smalltalk.String);
 
-smalltalk.addMethod(
-"_asJavaScriptSelector",
-smalltalk.method({
-selector: "asJavaScriptSelector",
-category: 'converting',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=_st(self)._replace_with_("^([a-zA-Z0-9]*).*$","$1");
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
-args: [],
-source: "asJavaScriptSelector\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
-messageSends: ["replace:with:"],
-referencedClasses: []
-}),
-smalltalk.String);
-
 smalltalk.addMethod(
 "_asJavascript",
 smalltalk.method({

+ 14 - 0
js/Kernel-Objects.deploy.js

@@ -3814,3 +3814,17 @@ messageSends: ["error:"]}),
 smalltalk.UndefinedObject.klass);
 
 
+smalltalk.addMethod(
+"_asJavaScriptSelector",
+smalltalk.method({
+selector: "asJavaScriptSelector",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self)._replace_with_("^([a-zA-Z0-9]*).*$","$1");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
+messageSends: ["replace:with:"]}),
+smalltalk.String);
+

+ 19 - 0
js/Kernel-Objects.js

@@ -5130,3 +5130,22 @@ referencedClasses: []
 smalltalk.UndefinedObject.klass);
 
 
+smalltalk.addMethod(
+"_asJavaScriptSelector",
+smalltalk.method({
+selector: "asJavaScriptSelector",
+category: '*Kernel-Objects',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self)._replace_with_("^([a-zA-Z0-9]*).*$","$1");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
+args: [],
+source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
+messageSends: ["replace:with:"],
+referencedClasses: []
+}),
+smalltalk.String);
+

+ 0 - 4
st/Kernel-Collections.st

@@ -1154,10 +1154,6 @@ asJSON
 	^self
 !
 
-asJavaScriptSelector
-	^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'
-!
-
 asJavascript
 	<
 		if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)

+ 7 - 0
st/Kernel-Objects.st

@@ -1725,3 +1725,10 @@ new
 		self error: 'You cannot create new instances of UndefinedObject. Use nil'
 ! !
 
+!String methodsFor: '*Kernel-Objects'!
+
+asJavaScriptSelector
+	"Return first keyword of the selector, without trailing colon."
+	^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'
+! !
+