Permalink
Browse files

Bug fix of String."+"

git-svn-id: http://hotruby.googlecode.com/svn/trunk@33 4fb8041d-b042-0410-9571-f50be27af959
  • Loading branch information...
1 parent 6c3d3a3 commit 6db571e89606e4daed2292b75b0dcc6927bc1db0 yukoba@accelart.jp committed Jan 27, 2008
View
@@ -229,7 +229,10 @@ HotRuby.prototype.classes = {
"String" : {
"+" : function(recver, args) {
- return this.createRubyString(recver.__native + args[0].__native);
+ if(typeof(args[0]) == "object")
+ return this.createRubyString(recver.__native + args[0].__native);
+ else
+ return this.createRubyString(recver.__native + args[0]);
},
"*" : function(recver, args) {
View
@@ -7,5 +7,6 @@ goto end
:main
ruby compile.rb %1\%1.rb -o %1\%1.js -p %1\%1_pretty.json
+copy %1\%1.js ..\web\js\test
:end
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,21 @@
+class Pi
+ def initialize hoge, hoge2
+ @a = 352.0 + hoge + hoge2
+ @@c = 3
+ end
+ def getA
+ @a
+ end
+end
+
+class Pi2 < Pi
+ def initialize hoge, hoge2
+ super
+ @b = 110.0 + @@c
+ end
+ def calc
+ getA / @b
+ end
+end
+
+puts '335/113 = ' + Pi2.new(1, 2).calc
Oops, something went wrong.

0 comments on commit 6db571e

Please sign in to comment.