ChakraCore
ChakraCore copied to clipboard
Use before declaration error has wrong line number.
function test3() {
var k = 1;
d = 2;
let d;
}
test3();
Emits
ReferenceError: Use before declaration
at test3 (e:\chgittest\bug8.js:2:3)
at Global code (e:\chgittest\bug8.js:6:1)
The line number should be 3.
EmitUseBeforeDeclarationdoes not have enclosing Start/End Statement.
This is a symptom of the use before declaration check occurring at the beginning of Emit() in ByteCodeEmitter.cpp, before individual nodes are processed and their corresponding start/end statement calls made.
I would like to move the use before declaration check into those individual cases for this reason and a few other reasons. This issue should be fixed when I do that.
Fixed by #936