Fix external names of class exports and similar; Support a few more kinds in TSDBuilder, see #74

This commit is contained in:
dcodeIO
2018-04-15 00:34:19 +02:00
parent 78a679759a
commit 81223977d0
15 changed files with 713 additions and 202 deletions

View File

@ -557,19 +557,22 @@ export class Signature {
return thisReturnType == targetReturnType || thisReturnType.isAssignableTo(targetReturnType);
}
/** Converts a signature to a function type string. */
static makeSignatureString(parameterTypes: Type[] | null, returnType: Type, thisType: Type | null = null): string {
var sb = [];
if (thisType) sb.push(thisType.toSignatureString());
if (parameterTypes) {
for (let i = 0, k = parameterTypes.length; i < k; ++i) {
sb.push(parameterTypes[i].toSignatureString());
}
}
sb.push(returnType.toSignatureString());
return sb.join("");
}
/** Converts this signature to a function type string. */
toSignatureString(): string {
var sb = [];
var thisType = this.thisType;
if (thisType) {
sb.push(thisType.toSignatureString());
}
var parameterTypes = this.parameterTypes;
for (let i = 0, k = parameterTypes.length; i < k; ++i) {
sb.push(parameterTypes[i].toSignatureString());
}
sb.push(this.returnType.toSignatureString());
return sb.join("");
return Signature.makeSignatureString(this.parameterTypes, this.returnType, this.thisType);
}
/** Converts this signature to a string. */