Changeset 5141 for lang/javascript

Show
Ignore:
Timestamp:
01/21/08 02:30:33 (5 years ago)
Author:
nshuyo
Message:

lang/javascript/jsruby: fixed some bugs (experimentally)

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

Legend:

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

    r4949 r5141  
    88 
    99        this.command = []; 
    10         this.stack = []; 
     10        this.stack = [null]; 
    1111 
    1212  // patch 
     
    4848    if (block.vars) b.varname = block.vars[0].name; 
    4949    this.command.push(b); 
     50    return self; 
    5051  } 
    5152} 
     
    6263      this.command.push(self); 
    6364      this.command.push("popLevel"); 
    64       this.command.push(this.compile(self.block.block)); 
     65      this.compile(self.block.block); 
    6566    } 
    6667  } 
     
    184185                if (Array.prototype.isPrototypeOf(x)) { 
    185186      if (x.length==1) { 
    186         this.command.push( this.compile(x[0]) ); 
     187        this.stack.pop();  // anxious... 
     188        this.compile(x[0]); 
    187189      } else { 
    188190                        this.command.push( new RubyEngine.SMachine.Iterator(x) ); 
  • lang/javascript/jsruby/trunk/tests/jsobject.html

    r4448 r5141  
    2020def test2(x) 
    2121  x.new 2 
     22end 
     23 
     24def test3(x) 
     25  x.bar = 3 
    2226end 
    2327 
     
    4549} 
    4650 
     51function testSetProperty() { 
     52        var foo = {} 
     53        ruby.test3(foo); 
     54        assertEquals("set property 1", foo.bar, 3); 
     55} 
     56 
    4757</script> 
    4858</head>