|
@@ -33,7 +33,6 @@
|
|
|
|
|
|
|
==================================================================== */
|
|
|
|
|
|
-
|
|
|
/* Smalltalk constructors definition */
|
|
|
|
|
|
function SmalltalkObject(){};
|
|
@@ -213,20 +212,24 @@ function Smalltalk(){
|
|
|
/* Handles JS method calls. Assumes that a single array or single argument was passed from Jtalk.
|
|
|
Example: someJSObject foo: #(1 2 3) -> someJSObject.foo(1,2,3); */
|
|
|
var jsSelector = selector.replace(/_/g, '');
|
|
|
- var jsFunction = receiver[jsSelector];
|
|
|
+ var jsProperty = receiver[jsSelector];
|
|
|
var jsArguments;
|
|
|
- if(receiver.klass === undefined && typeof jsFunction === "function") {
|
|
|
- if(args[0] && args[0].constructor === Array) {
|
|
|
- jsArguments = args[0]
|
|
|
- } else {
|
|
|
- jsArguments = [args[0]]
|
|
|
+ if(receiver.klass === undefined) {
|
|
|
+ if(typeof jsProperty === "function") {
|
|
|
+ if(args[0] && args[0].constructor === Array) {
|
|
|
+ jsArguments = args[0]
|
|
|
+ } else {
|
|
|
+ jsArguments = [args[0]]
|
|
|
+ }
|
|
|
+ return jsProperty.apply(receiver, jsArguments);
|
|
|
+ } else if(jsProperty !== undefined) {
|
|
|
+ return jsProperty
|
|
|
}
|
|
|
- return jsFunction.apply(receiver, jsArguments);
|
|
|
}
|
|
|
|
|
|
/* Handles not understood messages. Also see the Jtalk counter-part
|
|
|
Object>>doesNotUnderstand: */
|
|
|
- if(!receiver.klass) {throw(receiver + ' is not a Jtalk object and ' + jsSelector + ' is not a function')}
|
|
|
+ if(!receiver.klass) {throw(receiver + ' is not a Jtalk object and ' + jsSelector + ' is undefined')}
|
|
|
|
|
|
return receiver._doesNotUnderstand_(
|
|
|
st.Message._new()
|