mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into oneEmitter
This commit is contained in:
+21
-8
@@ -5606,18 +5606,31 @@ namespace ts {
|
||||
return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
|
||||
}
|
||||
|
||||
function isMatchingSignature(source: Signature, target: Signature, partialMatch: boolean) {
|
||||
// A source signature matches a target signature if the two signatures have the same number of required,
|
||||
// optional, and rest parameters.
|
||||
if (source.parameters.length === target.parameters.length &&
|
||||
source.minArgumentCount === target.minArgumentCount &&
|
||||
source.hasRestParameter === target.hasRestParameter) {
|
||||
return true;
|
||||
}
|
||||
// A source signature partially matches a target signature if the target signature has no fewer required
|
||||
// parameters and no more overall parameters than the source signature (where a signature with a rest
|
||||
// parameter is always considered to have more overall parameters than one without).
|
||||
if (partialMatch && source.minArgumentCount <= target.minArgumentCount && (
|
||||
source.hasRestParameter && !target.hasRestParameter ||
|
||||
source.hasRestParameter === target.hasRestParameter && source.parameters.length >= target.parameters.length)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function compareSignatures(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary {
|
||||
if (source === target) {
|
||||
return Ternary.True;
|
||||
}
|
||||
if (source.parameters.length !== target.parameters.length ||
|
||||
source.minArgumentCount !== target.minArgumentCount ||
|
||||
source.hasRestParameter !== target.hasRestParameter) {
|
||||
if (!partialMatch ||
|
||||
source.parameters.length < target.parameters.length && !source.hasRestParameter ||
|
||||
source.minArgumentCount > target.minArgumentCount) {
|
||||
return Ternary.False;
|
||||
}
|
||||
if (!(isMatchingSignature(source, target, partialMatch))) {
|
||||
return Ternary.False;
|
||||
}
|
||||
let result = Ternary.True;
|
||||
if (source.typeParameters && target.typeParameters) {
|
||||
|
||||
@@ -1032,7 +1032,7 @@ namespace ts {
|
||||
public createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim {
|
||||
try {
|
||||
if (this.documentRegistry === undefined) {
|
||||
this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
||||
this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory());
|
||||
}
|
||||
var hostAdapter = new LanguageServiceShimHostAdapter(host);
|
||||
var languageService = createLanguageService(hostAdapter, this.documentRegistry);
|
||||
@@ -1068,7 +1068,7 @@ namespace ts {
|
||||
public close(): void {
|
||||
// Forget all the registered shims
|
||||
this._shims = [];
|
||||
this.documentRegistry = createDocumentRegistry();
|
||||
this.documentRegistry = undefined;
|
||||
}
|
||||
|
||||
public registerShim(shim: Shim): void {
|
||||
|
||||
Reference in New Issue
Block a user