developit / developit/decko

@bind decorator bug when super method is called

オープン
#12 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
1k
フォーク
34
PR マージ指標
30日以内にマージされた PR はありません

説明

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:
```javascript
class A {
@bind
f() {
console.log('I\'m A.f');
}
}

class B extends A {
@bind
f() {
console.log('I\'m B.f BEGIN');
super.f();
console.log('I\'m B.f END');
}
}

let b = new B();
console.log('call b.f() 1st time:');
b.f();
console.log('call b.f() 2nd time:');
b.f();
```
Output:
```
call b.f() 1st time:
I'm B.f BEGIN
I'm A.f
I'm B.f END
call b.f() 2nd time:
I'm A.f
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。