chore(typescript): fixes dart failures and linter

Closes #4359
This commit is contained in:
vsavkin
2015-09-25 12:58:00 -07:00
committed by Victor Savkin
parent 7a53f82516
commit 5bf6a3af15
21 changed files with 293 additions and 178 deletions

View File

@ -59,10 +59,7 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
if (anyMatches(ignoreExportsMatching, exportSymbol.name)) return;
// If the symbol is an Alias then for most things we want the original resolved symbol
var resolvedExport = exportSymbol;
if (exportSymbol.resolvedSymbol && exportSymbol.resolvedSymbol.name !== "unknown") {
resolvedExport = exportSymbol.resolvedSymbol;
}
var resolvedExport = exportSymbol.resolvedSymbol || exportSymbol;
var exportDoc = createExportDoc(exportSymbol.name, resolvedExport, moduleDoc, basePath, parseInfo.typeChecker);
log.debug('>>>> EXPORT: ' + exportDoc.name + ' (' + exportDoc.docType + ') from ' + moduleDoc.id);
@ -285,11 +282,7 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
function getDecorators(symbol) {
var declaration = symbol.valueDeclaration;
if (!declaration) {
console.log("missing declaration for symbol", declaration);
return [];
}
var declaration = symbol.valueDeclaration || symbol.declarations[0];
var sourceFile = ts.getSourceFileOfNode(declaration);
var decorators = declaration.decorators && declaration.decorators.map(function(decorator) {

View File

@ -58,11 +58,17 @@ module.exports = function createCompilerHost(log) {
return ts.sys.newLine;
},
fileExists: function(fileName) {
var stats;
fs.stat(fileName, function(err, s) {
stats = s;
});
return !!stats;
var resolvedPath = path.resolve(baseDir, fileName);
try {
fs.statSync(resolvedPath);
return true;
} catch (e) {
return false;
}
},
readFile: function(fileName) {
var resolvedPath = path.resolve(baseDir, fileName);
return fs.readFileSync(resolvedPath, { encoding: options.charset });
}
};
};

View File

@ -4,9 +4,6 @@ var ts = require('typescript');
module.exports = function getFileInfo(log) {
return function (symbol, basePath) {
if (!symbol.declarations) {
console.log("ouch", symbol);
}
var fileName = ts.getSourceFileOfNode(symbol.declarations[0]).fileName;
var file = path.resolve(basePath, fileName);