Avoid infinite loop checking yield expression (#21728)

* Avoid infinite loop checking yield expression

* Revert now-unneeded change

* Revert test filename changes
This commit is contained in:
Andy 2018-11-19 11:18:32 -08:00 committed by Nathan Shively-Sanders
parent ca7f78b8df
commit 79b9fa51b6
4 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,16 @@
//// [yieldExpressionInFlowLoop.ts]
function* f() {
let result;
while (1) {
result = yield result;
}
}
//// [yieldExpressionInFlowLoop.js]
function* f() {
let result;
while (1) {
result = yield result;
}
}

View file

@ -0,0 +1,14 @@
=== tests/cases/compiler/yieldExpressionInFlowLoop.ts ===
function* f() {
>f : Symbol(f, Decl(yieldExpressionInFlowLoop.ts, 0, 0))
let result;
>result : Symbol(result, Decl(yieldExpressionInFlowLoop.ts, 1, 7))
while (1) {
result = yield result;
>result : Symbol(result, Decl(yieldExpressionInFlowLoop.ts, 1, 7))
>result : Symbol(result, Decl(yieldExpressionInFlowLoop.ts, 1, 7))
}
}

View file

@ -0,0 +1,18 @@
=== tests/cases/compiler/yieldExpressionInFlowLoop.ts ===
function* f() {
>f : () => IterableIterator<any>
let result;
>result : any
while (1) {
>1 : 1
result = yield result;
>result = yield result : any
>result : any
>yield result : any
>result : any
}
}

View file

@ -0,0 +1,9 @@
// @noImplicitAny: true
// @target: es6
function* f() {
let result;
while (1) {
result = yield result;
}
}