Changeset 3590

Show
Ignore:
Timestamp:
12/26/07 12:56:36 (6 years ago)
Author:
nshuyo
Message:

lang/javascript/jsruby: fixed a bug and added a test

Location:
lang/javascript/jsruby/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/jsruby/trunk/src/builtinobjects.js

    r3587 r3590  
    8282  "chr": function(self, args, block) { 
    8383    return new RubyEngine.RubyObject.String( String.fromCharCode(self.num) ); 
     84  }, 
     85  "to_s": function(self, args, block) { 
     86    return new RubyEngine.RubyObject.String( String(self.num) ); 
    8487  }, 
    8588  "upto": function(self, args, block) { 
  • lang/javascript/jsruby/trunk/src/parse.js

    r3589 r3590  
    222222  // Args ( but only Method without arguments and block ) 
    223223  var y; 
    224   if (RubyEngine.Node.Method.prototype.isPrototypeOf(prim) && prim.args==null && prim.block==undefined && (y=this.args())!=undefined) prim.args = y; 
    225  
     224  if (RubyEngine.Node.Method.prototype.isPrototypeOf(prim) && prim.args==null && prim.block==undefined && this.body.match(/^[ \t]*[^ \t\-\+]/) && (y=this.args())!=undefined) prim.args = y; 
    226225  return prim; 
    227226} 
  • lang/javascript/jsruby/trunk/tests/string.html

    r3105 r3590  
    2828        assertEquals("string add 2", ruby.exec(" 'd'+'e'+'f' "), "def"); 
    2929        assertEquals("string add 3", ruby.exec(" x='u'+'b'; \"r\"+x+\"y\" "), "ruby"); 
     30        assertEquals("string add 4", ruby.exec(" x='ru'; y='b'; z='y'; x + y + z "), "ruby"); 
    3031} 
    3132