regenerator-runtime
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -5,3 +5,3 @@ { | ||
"description": "Runtime for Regenerator-compiled generator and async functions.", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"main": "runtime-module.js", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
104
runtime.js
@@ -267,7 +267,11 @@ /** | ||
context.method = method; | ||
context.arg = arg; | ||
while (true) { | ||
var delegate = context.delegate; | ||
if (delegate) { | ||
if (method === "return" || | ||
(method === "throw" && delegate.iterator[method] === undefined)) { | ||
if (context.method === "return" || | ||
(context.method === "throw" && | ||
delegate.iterator[context.method] === undefined)) { | ||
// A return or throw (when the delegate iterator has no throw | ||
@@ -281,8 +285,13 @@ // method) always terminates the yield* loop. | ||
if (returnMethod) { | ||
var record = tryCatch(returnMethod, delegate.iterator, arg); | ||
var record = tryCatch( | ||
returnMethod, | ||
delegate.iterator, | ||
context.arg | ||
); | ||
if (record.type === "throw") { | ||
// If the return method threw an exception, let that | ||
// exception prevail over the original return or throw. | ||
method = "throw"; | ||
arg = record.arg; | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
continue; | ||
@@ -292,3 +301,3 @@ } | ||
if (method === "return") { | ||
if (context.method === "return") { | ||
// Continue with the outer return, now that the delegate | ||
@@ -301,5 +310,5 @@ // iterator has been terminated. | ||
var record = tryCatch( | ||
delegate.iterator[method], | ||
delegate.iterator[context.method], | ||
delegate.iterator, | ||
arg | ||
context.arg | ||
); | ||
@@ -312,4 +321,4 @@ | ||
// overhead of an extra function call. | ||
method = "throw"; | ||
arg = record.arg; | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
continue; | ||
@@ -321,4 +330,4 @@ } | ||
// "next" with an undefined arg. | ||
method = "next"; | ||
arg = undefined; | ||
context.method = "next"; | ||
context.arg = undefined; | ||
@@ -337,22 +346,17 @@ var info = record.arg; | ||
if (method === "next") { | ||
if (context.method === "next") { | ||
// Setting context._sent for legacy support of Babel's | ||
// function.sent implementation. | ||
context.sent = context._sent = arg; | ||
context.sent = context._sent = context.arg; | ||
} else if (method === "throw") { | ||
} else if (context.method === "throw") { | ||
if (state === GenStateSuspendedStart) { | ||
state = GenStateCompleted; | ||
throw arg; | ||
throw context.arg; | ||
} | ||
if (context.dispatchException(arg)) { | ||
// If the dispatched exception was caught by a catch block, | ||
// then let that catch block handle the exception normally. | ||
method = "next"; | ||
arg = undefined; | ||
} | ||
context.dispatchException(context.arg); | ||
} else if (method === "return") { | ||
context.abrupt("return", arg); | ||
} else if (context.method === "return") { | ||
context.abrupt("return", context.arg); | ||
} | ||
@@ -370,3 +374,7 @@ | ||
var info = { | ||
if (record.arg === ContinueSentinel) { | ||
continue; | ||
} | ||
return { | ||
value: record.arg, | ||
@@ -376,18 +384,8 @@ done: context.done | ||
if (record.arg === ContinueSentinel) { | ||
if (context.delegate && method === "next") { | ||
// Deliberately forget the last sent value so that we don't | ||
// accidentally pass it on to the delegate. | ||
arg = undefined; | ||
} | ||
} else { | ||
return info; | ||
} | ||
} else if (record.type === "throw") { | ||
state = GenStateCompleted; | ||
// Dispatch the exception by looping back around to the | ||
// context.dispatchException(arg) call above. | ||
method = "throw"; | ||
arg = record.arg; | ||
// context.dispatchException(context.arg) call above. | ||
context.method = "throw"; | ||
context.arg = record.arg; | ||
} | ||
@@ -518,2 +516,5 @@ } | ||
this.method = "next"; | ||
this.arg = undefined; | ||
this.tryEntries.forEach(resetTryEntry); | ||
@@ -555,3 +556,11 @@ | ||
context.next = loc; | ||
return !!caught; | ||
if (caught) { | ||
// If the dispatched exception was caught by a catch block, | ||
// then let that catch block handle the exception normally. | ||
context.method = "next"; | ||
context.arg = undefined; | ||
} | ||
return !! caught; | ||
} | ||
@@ -624,8 +633,8 @@ | ||
if (finallyEntry) { | ||
this.method = "next"; | ||
this.next = finallyEntry.finallyLoc; | ||
} else { | ||
this.complete(record); | ||
return ContinueSentinel; | ||
} | ||
return ContinueSentinel; | ||
return this.complete(record); | ||
}, | ||
@@ -642,3 +651,4 @@ | ||
} else if (record.type === "return") { | ||
this.rval = record.arg; | ||
this.rval = this.arg = record.arg; | ||
this.method = "return"; | ||
this.next = "end"; | ||
@@ -648,2 +658,4 @@ } else if (record.type === "normal" && afterLoc) { | ||
} | ||
return ContinueSentinel; | ||
}, | ||
@@ -687,2 +699,8 @@ | ||
if (this.method === "next") { | ||
// Deliberately forget the last sent value so that we don't | ||
// accidentally pass it on to the delegate. | ||
this.arg = undefined; | ||
} | ||
return ContinueSentinel; | ||
@@ -689,0 +707,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25288
6
626