developit / developit/decko

@bind decorator bug when super method is called

Aperta
#12 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
1k
Fork
34
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by running the JavaScript reproduction in the issue and compare the first and second calls to b.f(). Then inspect the @bind decorator implementation and its handling of decorated superclass methods. Done means repeated calls preserve the shown B.f and A.f sequence.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.