Closed
Description
The following code causes the compiler to crash:
function foo() {
for (;;) {
const a = 0
switch (a) {
case 0:
return b => b(a)
}
}
}
The error is:
TypeError: Cannot read property 'kind' of undefined
at convertLoopBody (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:27811:45)
at emitLoop (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:27797:32)
at emitForStatement (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:28011:17)
at emitJavaScriptWorker (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31428:32)
at emitNodeWithoutSourceMap (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31265:21)
at emitNodeWithSourceMap (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31259:21)
at emitNodeConsideringCommentsOption (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31250:21)
at emit (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:31233:17)
at emitLinesStartingAt (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:26271:21)
at emitBlockFunctionBody (/home/andy/git/TYPESCRIPT/node_modules/typescript/lib/tsc.js:29114:21)
Tested on typescript 1.8.0-dev.20160114
.