mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Emit non-getter/setter member function
This commit is contained in:
+25
-1
@@ -4407,7 +4407,9 @@ module ts {
|
||||
emitComputedPropertyName(<ComputedPropertyName>memberName);
|
||||
}
|
||||
else {
|
||||
write(".");
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
write(".");
|
||||
}
|
||||
emitNodeWithoutSourceMap(memberName);
|
||||
}
|
||||
}
|
||||
@@ -4509,6 +4511,27 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
function emitMemberFunctionsAboveES6(node: ClassDeclaration) {
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
|
||||
if (!(<MethodDeclaration>member).body) {
|
||||
return emitPinnedOrTripleSlashComments(member);
|
||||
}
|
||||
|
||||
writeLine();
|
||||
emitLeadingComments(member);
|
||||
emitStart(member);
|
||||
if (member.flags & NodeFlags.Static) {
|
||||
write("static ");
|
||||
}
|
||||
emitMemberAccessForPropertyName((<MethodDeclaration>member).name);
|
||||
emitSignatureAndBody(<MethodDeclaration>member);
|
||||
emitEnd(member);
|
||||
emitTrailingComments(member);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function emitConstructorOfClass(node: ClassDeclaration, baseTypeNode: TypeReferenceNode) {
|
||||
var saveTempCount = tempCount;
|
||||
var saveTempVariables = tempVariables;
|
||||
@@ -4624,6 +4647,7 @@ module ts {
|
||||
scopeEmitStart(node);
|
||||
writeLine();
|
||||
emitConstructorOfClass(node, baseTypeNode);
|
||||
emitMemberFunctionsAboveES6(node);
|
||||
writeLine();
|
||||
scopeEmitEnd();
|
||||
decreaseIndent();
|
||||
|
||||
Reference in New Issue
Block a user