Changeset 3044
- Timestamp:
- 12/11/07 16:10:45 (6 years ago)
- Location:
- lang/javascript/jsruby/trunk/src
- Files:
-
- 2 modified
-
builtinobjects.js (modified) (1 diff)
-
interpreter.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/jsruby/trunk/src/builtinobjects.js
r2989 r3044 10 10 return c; 11 11 } 12 RubyEngine.RubyObject.call = function(self, name, args, block){ 13 var clz = self.clz; 14 var method; 15 while( !(method=clz.methods[name]) ) if ( !(clz=clz.superclz) ) break; 16 if (method) { 17 return method.apply(this, [self, args, block]); 18 } else if (name!="method_missing") { 19 var newarg = [new RubyEngine.RubyObject.String(node.name)].concat(node.args); 20 var ret = RubyEngine.RubyObject.call.apply(this, [self, "method_missing", newarg, node.block]); 21 if (ret!=undefined) return ret; 22 return new RubyEngine.RubyObject.NameError("undefined local variable or method `"+name+"' for "+self.clz.toString(), name); 23 } 24 return undefined; 25 }; 12 26 13 27 14 28 RubyEngine.RubyObject.Object = function(){ this.clz = RubyEngine.RubyObject.Object; } 15 29 RubyEngine.RubyObject.Object.prototype.toValue = function(){ return this; } // to Javascript value(instance) 16 RubyEngine.RubyObject.Object.prototype.call = function(ruby, name, args, block){17 var clz = this.clz;18 var method;19 while( !(method=clz.methods[name]) ) if ( !(clz=clz.superclz) ) break;20 if (method) {21 return method.apply(ruby, [this, args, block]);22 } else {23 }24 };25 30 26 31 -
lang/javascript/jsruby/trunk/src/interpreter.js
r2991 r3044 155 155 obj = this.run(node.target); 156 156 } 157 var method = obj.clz.methods[node.name]; 158 if (method) { 159 return method.apply(this, [obj, node.args, node.block]); 160 } else { 161 alert("undefined method :" + obj.toSource() + "." + node.toSource()); 162 } 157 return RubyEngine.RubyObject.call.apply(this, [obj, node.name, node.args, node.block]); 163 158 } 164 159
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)