Merge pull request #1546 from Arnavion/fix-emithost-this-binding
Don't lose the this reference for compilerHost methods.
This commit is contained in:
commit
79dc0f96d3
|
@ -171,7 +171,7 @@ module ts {
|
|||
getDiagnosticsProducingTypeChecker,
|
||||
getCommonSourceDirectory: () => commonSourceDirectory,
|
||||
emit,
|
||||
getCurrentDirectory: host.getCurrentDirectory,
|
||||
getCurrentDirectory: () => host.getCurrentDirectory(),
|
||||
getNodeCount: () => getDiagnosticsProducingTypeChecker().getNodeCount(),
|
||||
getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(),
|
||||
getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(),
|
||||
|
@ -181,14 +181,15 @@ module ts {
|
|||
|
||||
function getEmitHost(writeFileCallback?: WriteFileCallback): EmitHost {
|
||||
return {
|
||||
getCanonicalFileName: host.getCanonicalFileName,
|
||||
getCanonicalFileName: fileName => host.getCanonicalFileName(fileName),
|
||||
getCommonSourceDirectory: program.getCommonSourceDirectory,
|
||||
getCompilerOptions: program.getCompilerOptions,
|
||||
getCurrentDirectory: host.getCurrentDirectory,
|
||||
getNewLine: host.getNewLine,
|
||||
getCurrentDirectory: () => host.getCurrentDirectory(),
|
||||
getNewLine: () => host.getNewLine(),
|
||||
getSourceFile: program.getSourceFile,
|
||||
getSourceFiles: program.getSourceFiles,
|
||||
writeFile: writeFileCallback || host.writeFile,
|
||||
writeFile: writeFileCallback || (
|
||||
(fileName, data, writeByteOrderMark, onError) => host.writeFile(fileName, data, writeByteOrderMark, onError)),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue