Emit readonly in declaration files

This commit is contained in:
Anders Hejlsberg
2016-01-28 10:39:54 -08:00
parent 0981719bed
commit 3019017093

View File

@@ -648,6 +648,9 @@ namespace ts {
if (node.flags & NodeFlags.Static) {
write("static ");
}
if (node.flags & NodeFlags.Readonly) {
write("readonly ");
}
if (node.flags & NodeFlags.Abstract) {
write("abstract ");
}
@@ -1342,15 +1345,17 @@ namespace ts {
const prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
// Construct signature or constructor type write new Signature
if (node.kind === SyntaxKind.ConstructSignature || node.kind === SyntaxKind.ConstructorType) {
write("new ");
}
emitTypeParameters(node.typeParameters);
if (node.kind === SyntaxKind.IndexSignature) {
// Index signature can have readonly modifier
emitClassMemberDeclarationFlags(node);
write("[");
}
else {
// Construct signature or constructor type write new Signature
if (node.kind === SyntaxKind.ConstructSignature || node.kind === SyntaxKind.ConstructorType) {
write("new ");
}
emitTypeParameters(node.typeParameters);
write("(");
}