You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@bind decorator bug when super method is called #12
This snippet demonstrates that the bind decorator does not work correctly on second method call if that method invokes super method which in turn is also decorated:
Hmm interesting. I've never used this with prototypal inheritance, I can see how it'd overwrite itself like that. Not sure what the best solution for this would be, seems like any fix would break the lazy-binding behavior, which is sortof the big selling feature of this method.
This fix may help. It prevents defineProperty for this if property is accessed from a super class.
Let me know if this solution is acceptable -- I'll create a pull request.
Activity
precious commentedon Sep 2, 2017
This bug can be reproduced with babel es2015 preset.
With
.babelrcconfig{"presets": ["es2015"], "plugins": ["transform-decorators-legacy"]}and
mochaoption--compilers js:babel-core/register.developit commentedon Sep 2, 2017
Hmm interesting. I've never used this with prototypal inheritance, I can see how it'd overwrite itself like that. Not sure what the best solution for this would be, seems like any fix would break the lazy-binding behavior, which is sortof the big selling feature of this method.
fixes developit#12 -- bug in "bind" decorator on super method call fr…
precious commentedon Sep 3, 2017
This fix may help. It prevents
definePropertyforthisif property is accessed from a super class.Let me know if this solution is acceptable -- I'll create a pull request.
wy193777 commentedon Apr 13, 2018
@memoizealso not working when super class' method is called.Finesse commentedon Feb 4, 2019
How does the example even work? When I run it, I get an error: