Changeset 4947 for lang/javascript

Show
Ignore:
Timestamp:
01/19/08 15:14:57 (5 years ago)
Author:
nshuyo
Message:

lang/javascript/jsruby: debug & optimize a little (experimentally)

Files:
1 modified

Legend:

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

    r4946 r4947  
    3636 
    3737  RubyEngine.RubyObject.Numeric.methods.upto = function(self, args, block) { 
    38 console.log("self:", self.toSource()); 
    39 console.log("args:", args.toSource()); 
    40 console.dir(block); 
    4138    if (!block) return null; 
    4239    var b = new RubyEngine.SMachine.BlockIterator(block, function(b){ 
     
    167164      this.writeStdout("\n"); 
    168165    } 
    169   }, 
     166  } 
    170167} 
    171168 
     
    177174    this.compile(node); 
    178175    this.loop(); 
    179 console.dir(this.stack); 
    180176 
    181177    //var ret; 
     
    187183  compile: function(x) { 
    188184                if (Array.prototype.isPrototypeOf(x)) { 
    189                         this.command.push( new RubyEngine.SMachine.Iterator(x) ); 
     185      if (x.length==1) { 
     186        this.command.push( this.compile(x[0]) ); 
     187      } else { 
     188                        this.command.push( new RubyEngine.SMachine.Iterator(x) ); 
     189                        } 
    190190                } else if (RubyEngine.Node.Expression.prototype.isPrototypeOf(x)) { 
    191191        var list = x.list;