equal
deleted
inserted
replaced
257 if (state === GenStateCompleted) { |
257 if (state === GenStateCompleted) { |
258 if (method === "throw") { |
258 if (method === "throw") { |
259 throw arg; |
259 throw arg; |
260 } |
260 } |
261 |
261 |
262 // Be forgiving, per 25.3.3.3.3 of the spec: |
262 // Be forgiving, per GeneratorResume behavior specified since ES2015: |
263 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume |
263 // ES2015 spec, step 3: https://262.ecma-international.org/6.0/#sec-generatorresume |
|
264 // Latest spec, step 2: https://tc39.es/ecma262/#sec-generatorresume |
264 return doneResult(); |
265 return doneResult(); |
265 } |
266 } |
266 |
267 |
267 context.method = method; |
268 context.method = method; |
268 context.arg = arg; |
269 context.arg = arg; |
331 function maybeInvokeDelegate(delegate, context) { |
332 function maybeInvokeDelegate(delegate, context) { |
332 var methodName = context.method; |
333 var methodName = context.method; |
333 var method = delegate.iterator[methodName]; |
334 var method = delegate.iterator[methodName]; |
334 if (method === undefined) { |
335 if (method === undefined) { |
335 // A .throw or .return when the delegate iterator has no .throw |
336 // A .throw or .return when the delegate iterator has no .throw |
336 // method, or a missing .next mehtod, always terminate the |
337 // method, or a missing .next method, always terminate the |
337 // yield* loop. |
338 // yield* loop. |
338 context.delegate = null; |
339 context.delegate = null; |
339 |
340 |
340 // Note: ["return"] must be used for ES3 parsing compatibility. |
341 // Note: ["return"] must be used for ES3 parsing compatibility. |
341 if (methodName === "throw" && delegate.iterator["return"]) { |
342 if (methodName === "throw" && delegate.iterator["return"]) { |
485 return next; |
486 return next; |
486 }; |
487 }; |
487 }; |
488 }; |
488 |
489 |
489 function values(iterable) { |
490 function values(iterable) { |
490 if (iterable || iterable === "") { |
491 if (iterable != null) { |
491 var iteratorMethod = iterable[iteratorSymbol]; |
492 var iteratorMethod = iterable[iteratorSymbol]; |
492 if (iteratorMethod) { |
493 if (iteratorMethod) { |
493 return iteratorMethod.call(iterable); |
494 return iteratorMethod.call(iterable); |
494 } |
495 } |
495 |
496 |