Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Unable to call mutating method of super class #1

Closed
szastupov opened this Issue · 5 comments

2 participants

@szastupov

Here is the modified oo_super test, it doesn't pass. http://gist.github.com/335377

@jaked
Owner

thank you for the bug report, I will look at it as soon as possible

@szastupov

Maybe this info would be helpful:
method set_checked2 checked =
self#set_checked checked;
super#set_checked checked;
self#on_check checked
which compiles to:
f(function (checked$471) {
var self$2D10$470 = this;
_m(self$2D10$470._m[set_checked$472], self$2D10$470, [ checked$471 ]);
_(set_checked$452, [ self$2D10$470, $(), checked$471 ]);
return __m(self$2D10$470._m[on_check$458], self$2D10$470, [ checked$471 ]);
})
And here is the compiled body of set_checked:
function (ckd$189) {
var self$2D1$188 = this;
return (self$2D1$188[icheck$169]).checked = ckd$189;
})

If a debugger doesn't lie, set_checked "this" points to the object in first case (when I call it via self) and to the function itself in second (via super).
I'll keep trying to solve the problem myself, but it's pretty hard due to my little knowledge of ocamljs internals :\ Maybe you give me some clues? :)

@szastupov

Oops, I accidentally closed the ticket :\

@jaked
Owner

Thanks for looking into it. As you discovered, super calls with args were being treated as function calls rather than method calls. The ocaml compiler converts super calls to function calls early in compilation, so I put in a hack to tell that this was actually supposed to be a method call, but it didn't cover the case where the method had args. I just checked in a different hack that fixes your modified test at least, and seems like it should work in general.

@szastupov

Thanks Jake, I'll check it tomorrow with my application.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.