Selaa lähdekoodia

Merge branch 'master' into bootjs-dnu-refactor

Conflicts:
	support/boot.js
Herbert Vojčík 9 vuotta sitten
vanhempi
commit
b18a5105dc
4 muutettua tiedostoa jossa 11 lisäystä ja 10 poistoa
  1. 1 1
      package.json
  2. 2 4
      src/Kernel-Infrastructure.js
  3. 1 4
      src/Kernel-Infrastructure.st
  4. 7 1
      support/boot.js

+ 1 - 1
package.json

@@ -23,7 +23,7 @@
     "url": "git://github.com/amber-smalltalk/amber.git"
   },
   "engines": {
-    "node": ">=0.8.0"
+    "node": ">=0.10.0"
   },
   "scripts": {
     "test": "grunt test"

+ 2 - 4
src/Kernel-Infrastructure.js

@@ -3619,12 +3619,10 @@ protocol: '*Kernel-Infrastructure',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-
-	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\x09var colonPosition = self.indexOf(':');\x0a\x09return colonPosition === -1 ? self : self.slice(0, colonPosition);\x0a>",
+source: "asJavaScriptSelector\x0a<return smalltalk.st2prop(self)>",
 messageSends: [],
 referencedClasses: []
 }),

+ 1 - 4
src/Kernel-Infrastructure.st

@@ -1374,10 +1374,7 @@ do: aBlock displayingProgress: aString
 !String methodsFor: '*Kernel-Infrastructure'!
 
 asJavaScriptSelector
-<
-	var colonPosition = self.indexOf(':');
-	return colonPosition === -1 ? self : self.slice(0, colonPosition);
->
+<return smalltalk.st2prop(self)>
 !
 
 asSetting

+ 7 - 1
support/boot.js

@@ -1017,7 +1017,7 @@ define("amber/boot", [ 'require', './browser-compatibility' ], function (require
 			}
 			/* Call a method of a JS object, or answer a property if it exists.
 			 Else try wrapping a JSObjectProxy around the receiver. */
-			var propertyName = stSelector._asJavaScriptSelector();
+			var propertyName = st.st2prop(stSelector);
 			if (!(propertyName in receiver)) {
 				return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
 			}
@@ -1104,6 +1104,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 */