Fix merge problems from master

This commit is contained in:
Ryan Cavanaugh 2015-11-09 12:49:36 -08:00
parent 7dd1bf487d
commit e630ce247b
9 changed files with 29 additions and 46 deletions

View File

@ -1,3 +1,4 @@
/// <reference path="utilities.ts"/>
/// <reference path="parser.ts"/>
/* @internal */
@ -109,8 +110,6 @@ namespace ts {
let lastContainer: Node;
let seenThisKeyword: boolean;
const isJavaScriptFile = isSourceFileJavaScript(file);
// state used by reachability checks
let hasExplicitReturn: boolean;
let currentReachabilityState: Reachability;
@ -1154,7 +1153,7 @@ namespace ts {
case SyntaxKind.Identifier:
return checkStrictModeIdentifier(<Identifier>node);
case SyntaxKind.BinaryExpression:
if (isJavaScriptFile) {
if (isInJavaScriptFile(node)) {
if (isExportsPropertyAssignment(node)) {
bindExportsPropertyAssignment(<BinaryExpression>node);
}
@ -1229,7 +1228,7 @@ namespace ts {
return bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, bindingName);
case SyntaxKind.CallExpression:
if (isJavaScriptFile) {
if (isInJavaScriptFile(node)) {
bindCallExpression(<CallExpression>node);
}
break;
@ -1275,8 +1274,8 @@ namespace ts {
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, `"${removeFileExtension(file.fileName) }"`);
}
function bindExportAssignment(node: ExportAssignment|BinaryExpression) {
let boundExpression = node.kind === SyntaxKind.ExportAssignment ? (<ExportAssignment>node).expression : (<BinaryExpression>node).right;
function bindExportAssignment(node: ExportAssignment | BinaryExpression) {
const boundExpression = node.kind === SyntaxKind.ExportAssignment ? (<ExportAssignment>node).expression : (<BinaryExpression>node).right;
if (!container.symbol || !container.symbol.exports) {
// Export assignment in some sort of block construct
bindAnonymousDeclaration(node, SymbolFlags.Alias, getDeclarationName(node));

View File

@ -990,7 +990,7 @@ namespace ts {
// Module names are escaped in our symbol table. However, string literal values aren't.
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
const moduleName = escapeIdentifier(moduleReferenceLiteral.text);
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
if (moduleName === undefined) {
return;
@ -3845,9 +3845,9 @@ namespace ts {
}
function resolveExternalModuleTypeByLiteral(name: StringLiteral) {
let moduleSym = resolveExternalModuleName(name, name);
const moduleSym = resolveExternalModuleName(name, name);
if (moduleSym) {
let resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym);
const resolvedModuleSymbol = resolveExternalModuleSymbol(moduleSym);
if (resolvedModuleSymbol) {
return getTypeOfSymbol(resolvedModuleSymbol);
}

View File

@ -1,5 +1,5 @@
/// <reference path="scanner.ts"/>
/// <reference path="utilities.ts"/>
/// <reference path="scanner.ts"/>
namespace ts {
const nodeConstructors = new Array<new (pos: number, end: number) => Node>(SyntaxKind.Count);

View File

@ -53,13 +53,13 @@ namespace ts {
if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) {
const failedLookupLocations: string[] = [];
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
let resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host);
let resolvedFileName = loadNodeModuleFromFile(supportedJsExtensions, candidate, failedLookupLocations, host);
if (resolvedFileName) {
return { resolvedModule: { resolvedFileName }, failedLookupLocations };
}
resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host);
resolvedFileName = loadNodeModuleFromDirectory(supportedJsExtensions, candidate, failedLookupLocations, host);
return resolvedFileName
? { resolvedModule: { resolvedFileName }, failedLookupLocations }
: { resolvedModule: undefined, failedLookupLocations };
@ -69,8 +69,8 @@ namespace ts {
}
}
function loadNodeModuleFromFile(candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string {
return forEach(supportedExtensions, tryLoad);
function loadNodeModuleFromFile(extensions: string[], candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string {
return forEach(extensions, tryLoad);
function tryLoad(ext: string): string {
const fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;
@ -84,7 +84,7 @@ namespace ts {
}
}
function loadNodeModuleFromDirectory(candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string {
function loadNodeModuleFromDirectory(extensions: string[], candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string {
const packageJsonPath = combinePaths(candidate, "package.json");
if (host.fileExists(packageJsonPath)) {
@ -100,7 +100,7 @@ namespace ts {
}
if (jsonContent.typings) {
const result = loadNodeModuleFromFile(normalizePath(combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host);
const result = loadNodeModuleFromFile(extensions, normalizePath(combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host);
if (result) {
return result;
}
@ -111,7 +111,7 @@ namespace ts {
failedLookupLocation.push(packageJsonPath);
}
return loadNodeModuleFromFile(combinePaths(candidate, "index"), failedLookupLocation, host);
return loadNodeModuleFromFile(extensions, combinePaths(candidate, "index"), failedLookupLocation, host);
}
function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
@ -122,12 +122,12 @@ namespace ts {
if (baseName !== "node_modules") {
const nodeModulesFolder = combinePaths(directory, "node_modules");
const candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName));
let result = loadNodeModuleFromFile(candidate, failedLookupLocations, host);
let result = loadNodeModuleFromFile(supportedExtensions, candidate, failedLookupLocations, host);
if (result) {
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
}
result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host);
result = loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, host);
if (result) {
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
}
@ -162,7 +162,7 @@ namespace ts {
const failedLookupLocations: string[] = [];
let referencedSourceFile: string;
let extensions = compilerOptions.allowNonTsExtensions ? supportedJsExtensions : supportedExtensions;
const extensions = compilerOptions.allowNonTsExtensions ? supportedJsExtensions : supportedExtensions;
while (true) {
searchName = normalizePath(combinePaths(searchPath, moduleName));
referencedSourceFile = forEach(extensions, extension => {
@ -689,7 +689,7 @@ namespace ts {
return;
}
let isJavaScriptFile = isSourceFileJavaScript(file);
const isJavaScriptFile = isSourceFileJavaScript(file);
let imports: LiteralExpression[];
for (const node of file.statements) {

View File

@ -1,4 +1,3 @@
/// <reference path="binder.ts" />
/// <reference path="sys.ts" />
/* @internal */

View File

@ -224,8 +224,8 @@ namespace FourSlash {
// Add input file which has matched file name with the given reference-file path.
// This is necessary when resolveReference flag is specified
private addMatchedInputFile(referenceFilePath: string, extensions: string[]) {
let inputFiles = this.inputFiles;
let languageServiceAdapterHost = this.languageServiceAdapterHost;
const inputFiles = this.inputFiles;
const languageServiceAdapterHost = this.languageServiceAdapterHost;
if (!extensions) {
tryAdd(referenceFilePath);
}
@ -234,7 +234,7 @@ namespace FourSlash {
}
function tryAdd(path: string) {
let inputFile = inputFiles[path];
const inputFile = inputFiles[path];
if (inputFile && !Harness.isLibraryFile(path)) {
languageServiceAdapterHost.addScript(path, inputFile);
return true;

View File

@ -371,7 +371,7 @@ namespace ts.server {
openRefCount = 0;
constructor(public projectService: ProjectService, public projectOptions?: ProjectOptions) {
if(projectOptions && projectOptions.files){
if (projectOptions && projectOptions.files) {
// If files are listed explicitly, allow all extensions
projectOptions.compilerOptions.allowNonTsExtensions = true;
}
@ -1321,7 +1321,7 @@ namespace ts.server {
this.setCompilerOptions(opt);
}
else {
var defaultOpts = ts.getDefaultCompilerOptions();
const defaultOpts = ts.getDefaultCompilerOptions();
defaultOpts.allowNonTsExtensions = true;
this.setCompilerOptions(defaultOpts);
}

View File

@ -95,8 +95,8 @@ module ts {
let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, packageJson, moduleFile));
assert.equal(resolution.resolvedModule.resolvedFileName, moduleFile.name);
assert.equal(!!resolution.resolvedModule.isExternalLibraryImport, false);
// expect three failed lookup location - attempt to load module as file with all supported extensions
assert.equal(resolution.failedLookupLocations.length, 3);
// expect five failed lookup location - attempt to load module as file with all supported extensions
assert.equal(resolution.failedLookupLocations.length, 5);
}
it("module name as directory - load from typings", () => {
@ -117,6 +117,8 @@ module ts {
"/a/b/foo.ts",
"/a/b/foo.tsx",
"/a/b/foo.d.ts",
"/a/b/foo.js",
"/a/b/foo.jsx",
"/a/b/foo/index.ts",
"/a/b/foo/index.tsx",
]);

View File

@ -263,21 +263,6 @@ http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) {
var browserPath: string;
if ((browser && browser === 'chrome')) {
<<<<<<< HEAD
const platform = os.platform();
let defaultChromePath: string;
switch(platform) {
case "win32":
defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
break;
case "linux":
defaultChromePath = "/opt/google/chrome/chrome";
break;
default:
console.log(`Default Chrome location for platform ${platform} is unknown`);
break;
}
=======
let defaultChromePath = "";
switch (os.platform()) {
case "win32":
@ -291,8 +276,6 @@ if ((browser && browser === 'chrome')) {
console.log(`default Chrome location is unknown for platform '${os.platform()}'`);
break;
}
>>>>>>> master
if (fs.existsSync(defaultChromePath)) {
browserPath = defaultChromePath;
} else {