File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -100,16 +100,15 @@ func (p *Promise) Then(cbs ...FunctionCallback) *Promise {
100100
101101var ptr C.ValuePtr
102102switch len (cbs ) {
103+ case 0 :
104+ return p
103105case 1 :
104106cbID := p .ctx .iso .registerCallback (cbs [0 ])
105107ptr = C .PromiseThen (p .ptr , C .int (cbID ))
106- case 2 :
108+ default :
107109cbID1 := p .ctx .iso .registerCallback (cbs [0 ])
108110cbID2 := p .ctx .iso .registerCallback (cbs [1 ])
109111ptr = C .PromiseThen2 (p .ptr , C .int (cbID1 ), C .int (cbID2 ))
110-
111- default :
112- panic ("1 or 2 callbacks required" )
113112}
114113return & Promise {& Object {& Value {ptr , p .ctx }}}
115114}
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ func TestPromiseRejected(t *testing.T) {
7979thenInfo = info
8080return nil
8181}).
82+ Then ().
8283Then (
8384func (_ * v8go.FunctionCallbackInfo ) * v8go.Value {
8485then2Fulfilled = true
You can’t perform that action at this time.
0 commit comments