use of superClass_.XXX.call(this vs superClass_.xxx(

1,637 views
Skip to first unread message

toe...@extremenetworks.com

unread,
Aug 17, 2015, 1:01:06 PM8/17/15
to Blockly
I just spent time debugging an odd problem that was randomly occurring and tracked it down to uses of calling the superClass_ function and wanted to understand why in most cases the call to the superClass_ function used a .call(this, mechanism...

Specifically in field_variable.js and field_angle.js we have a
Blockly.FieldVariable.superClass_.setChangeHandler(wrappedHandler);

However, when I debugged into the lower level routine, it doesn't seem to have the right this value.  By changing it to:

Blockly.FieldVariable.superClass_.setChangeHandler.call(this,wrappedHandler);

We have been able to make things work more reliably.

I have scanned through all of the code and the setChangeHandler ones seemed to be the only occurrences of using a superClass_ function without .call(this,.

Am I not understanding something about setChangeHandler or is this just a simple bug?

Neil Fraser

unread,
Aug 18, 2015, 2:21:05 AM8/18/15
to blo...@googlegroups.com
It's a bug.  Fixed.  Thanks!

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

toe...@extremenetworks.com

unread,
Aug 18, 2015, 7:29:40 AM8/18/15
to Blockly, ro...@neil.fraser.name
Thank you very much!
Reply all
Reply to author
Forward
0 new messages