Browse Source

Moving st selector -> property name conversion to boot.js.

Herbert Vojčík 9 years ago
parent
commit
ab5d305df2
3 changed files with 10 additions and 11 deletions
  1. 2 5
      src/Kernel-Infrastructure.js
  2. 1 5
      src/Kernel-Infrastructure.st
  3. 7 1
      support/boot.js

+ 2 - 5
src/Kernel-Infrastructure.js

@@ -3619,13 +3619,10 @@ protocol: '*Kernel-Infrastructure',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-
-    if (self[0] === '_') return ''; // TODO revert when #1062 root cause fixed
-	var colonPosition = self.indexOf(':');
-	return colonPosition === -1 ? self : self.slice(0, colonPosition);;
+return smalltalk.st2prop(self);
 return self}, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},globals.String)})},
 args: [],
-source: "asJavaScriptSelector\x0a<\x0a    if (self[0] === '_') return ''; // TODO revert when #1062 root cause fixed\x0a\x09var colonPosition = self.indexOf(':');\x0a\x09return colonPosition === -1 ? self : self.slice(0, colonPosition);\x0a>",
+source: "asJavaScriptSelector\x0a<return smalltalk.st2prop(self)>",
 messageSends: [],
 referencedClasses: []
 }),

+ 1 - 5
src/Kernel-Infrastructure.st

@@ -1374,11 +1374,7 @@ do: aBlock displayingProgress: aString
 !String methodsFor: '*Kernel-Infrastructure'!
 
 asJavaScriptSelector
-<
-    if (self[0] === '_') return ''; // TODO revert when #1062 root cause fixed
-	var colonPosition = self.indexOf(':');
-	return colonPosition === -1 ? self : self.slice(0, colonPosition);
->
+<return smalltalk.st2prop(self)>
 !
 
 asSetting

+ 7 - 1
support/boot.js

@@ -1034,7 +1034,7 @@ define("amber/boot", [ 'require', './browser-compatibility' ], function (require
 		 "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
 
 		function callJavaScriptMethod(receiver, selector, args) {
-			var jsSelector = selector._asJavaScriptSelector();
+			var jsSelector = st.st2prop(selector);
 			if (jsSelector in receiver) {
 				var jsProperty = receiver[jsSelector];
 				if (typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
@@ -1108,6 +1108,12 @@ define("amber/boot", [ 'require', './browser-compatibility' ], function (require
 				.replace(/_comma/g, ',')
 				.replace(/_at/g, '@');
 		}
+
+        st.st2prop = function (stSelector) {
+            if (stSelector[0] === '_') return ''; // TODO revert when #1062 root cause fixed
+            var colonPosition = stSelector.indexOf(':');
+            return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
+        };
 	}
 
 	/* Adds AMD and requirejs related methods to the smalltalk object */