mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Merge branch 'master' into fixTimeMeasurement
This commit is contained in:
@@ -4057,11 +4057,25 @@ module ts {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function sortAMDModules(amdModules: {name: string; path: string}[]) {
|
||||
// AMD modules with declared variable names go first
|
||||
return amdModules.sort((moduleA, moduleB) => {
|
||||
if (moduleA.name === moduleB.name) {
|
||||
return 0;
|
||||
} else if (!moduleA.name) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function emitAMDModule(node: SourceFile, startIndex: number) {
|
||||
var imports = getExternalImportDeclarations(node);
|
||||
writeLine();
|
||||
write("define(");
|
||||
sortAMDModules(node.amdDependencies);
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
@@ -4071,7 +4085,7 @@ module ts {
|
||||
emitLiteral(<LiteralExpression>getExternalModuleImportDeclarationExpression(imp));
|
||||
});
|
||||
forEach(node.amdDependencies, amdDependency => {
|
||||
var text = "\"" + amdDependency + "\"";
|
||||
var text = "\"" + amdDependency.path + "\"";
|
||||
write(", ");
|
||||
write(text);
|
||||
});
|
||||
@@ -4080,6 +4094,12 @@ module ts {
|
||||
write(", ");
|
||||
emit(imp.name);
|
||||
});
|
||||
forEach(node.amdDependencies, amdDependency => {
|
||||
if (amdDependency.name) {
|
||||
write(", ");
|
||||
write(amdDependency.name);
|
||||
}
|
||||
});
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
|
||||
@@ -4749,7 +4749,7 @@ module ts {
|
||||
function processReferenceComments(sourceFile: SourceFile): void {
|
||||
var triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, sourceText);
|
||||
var referencedFiles: FileReference[] = [];
|
||||
var amdDependencies: string[] = [];
|
||||
var amdDependencies: {path: string; name: string}[] = [];
|
||||
var amdModuleName: string;
|
||||
|
||||
// Keep scanning all the leading trivia in the file until we get to something that
|
||||
@@ -4789,10 +4789,17 @@ module ts {
|
||||
amdModuleName = amdModuleNameMatchResult[2];
|
||||
}
|
||||
|
||||
var amdDependencyRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*('|")(.+?)\1/gim;
|
||||
var amdDependencyRegEx = /^\/\/\/\s*<amd-dependency\s/gim;
|
||||
var pathRegex = /\spath\s*=\s*('|")(.+?)\1/gim;
|
||||
var nameRegex = /\sname\s*=\s*('|")(.+?)\1/gim;
|
||||
var amdDependencyMatchResult = amdDependencyRegEx.exec(comment);
|
||||
if (amdDependencyMatchResult) {
|
||||
amdDependencies.push(amdDependencyMatchResult[2]);
|
||||
var pathMatchResult = pathRegex.exec(comment);
|
||||
var nameMatchResult = nameRegex.exec(comment);
|
||||
if (pathMatchResult) {
|
||||
var amdDependency = {path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined };
|
||||
amdDependencies.push(amdDependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -887,7 +887,7 @@ module ts {
|
||||
fileName: string;
|
||||
text: string;
|
||||
|
||||
amdDependencies: string[];
|
||||
amdDependencies: {path: string; name: string}[];
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
|
||||
|
||||
@@ -725,7 +725,7 @@ module ts {
|
||||
public statements: NodeArray<Statement>;
|
||||
public endOfFileToken: Node;
|
||||
|
||||
public amdDependencies: string[];
|
||||
public amdDependencies: {name: string; path: string}[];
|
||||
public amdModuleName: string;
|
||||
public referencedFiles: FileReference[];
|
||||
|
||||
|
||||
@@ -295,8 +295,8 @@ module ts.SignatureHelp {
|
||||
var tagExpression = <TaggedTemplateExpression>templateExpression.parent;
|
||||
Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression);
|
||||
|
||||
// If we're just after a template tail, don't show signature help.
|
||||
if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !(<LiteralExpression>node).isUnterminated) {
|
||||
// If we're just after a template tail, don't show signature help.
|
||||
if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(<LiteralExpression>node, position)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user