Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
git-svn-id: http://hotruby.googlecode.com/svn/trunk@21 4fb8041d-b042-0410-9571-f50be27af959
  • Loading branch information
yukoba@accelart.jp committed Jan 15, 2008
1 parent ec3c929 commit 8be6433
Show file tree
Hide file tree
Showing 10 changed files with 674 additions and 25 deletions.
15 changes: 10 additions & 5 deletions src/RubyVM.js
Expand Up @@ -40,6 +40,10 @@ var HotRuby = function() {
__className : "FalseClass",
__native : false
};
this.topObject = {
__className : "Object",
__native : {}
};

this.checkEnv();
};
Expand Down Expand Up @@ -114,7 +118,7 @@ HotRuby.prototype = {
*/
run : function(opcode) {
try {
this.runOpcode(opcode, this.classes["<global>"], null, null, [], null, false, null);
this.runOpcode(opcode, this.classes["<global>"], null, this.topObject, [], null, false, null);
} catch(e) {
alert(e);
}
Expand Down Expand Up @@ -399,8 +403,9 @@ HotRuby.prototype = {
var args = sf.stack.slice(sf.sp - cmd[2], sf.sp);
sf.sp -= cmd[2];
var recver = sf.stack[--sf.sp];
//if (recver == null || recver == this.nilObj)
// recver = sf.self;
if(cmd[4] & HotRuby.VM_CALL_FCALL_BIT) {
recver = sf.self;
}
if(cmd[3] instanceof Array)
cmd[3] = this.createRubyProc(cmd[3], sf);
if(cmd[3] != null)
Expand Down Expand Up @@ -455,13 +460,13 @@ HotRuby.prototype = {
this.setConstant(sf, sf.classObj, cmd[1], newClass);
}
// Run the class definition
this.runOpcode(cmd[2], newClass, null, null, [], sf, false, null);
this.runOpcode(cmd[2], newClass, null, sf.self, [], sf, false, null);
} else if(cmd[3] == 1) {
// Object-Specific Classes
if(cbaseObj == null || typeof(cbaseObj) != "object")
throw "Not supported Object-Specific Classes on Primitive Object"
// Run the class definition
this.runOpcode(cmd[2], cbaseObj.__className, null, null, [], sf, false, cbaseObj);
this.runOpcode(cmd[2], cbaseObj.__className, null, sf.self, [], sf, false, cbaseObj);
} else if(cmd[3] == 2) {
// TODO
throw "Not implemented";
Expand Down
1 change: 1 addition & 0 deletions test/const/const.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion test/const/const.json

This file was deleted.

0 comments on commit 8be6433

Please sign in to comment.