Skip to content

Commit 9b3fccd

Browse files
author
Yui T
committed
Address code review; Use for..of and use if-statement
1 parent 513b45d commit 9b3fccd

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/compiler/emitter.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -4706,14 +4706,11 @@ module ts {
47064706
}
47074707

47084708
function emitMemberFunctionsForES6AndHigher(node: ClassDeclaration) {
4709-
forEach(node.members, member => {
4710-
if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
4711-
if (!(<MethodDeclaration>member).body) {
4712-
return emitPinnedOrTripleSlashComments(member);
4713-
}
4714-
4709+
for (let member of node.members) {
4710+
if ((member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && !(<MethodDeclaration>member).body) {
4711+
emitPinnedOrTripleSlashComments(member);
47154712
}
4716-
if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature || member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) {
4713+
else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature || member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) {
47174714
writeLine();
47184715
emitLeadingComments(member);
47194716
emitStart(member);
@@ -4732,7 +4729,7 @@ module ts {
47324729
emitEnd(member);
47334730
emitTrailingComments(member);
47344731
}
4735-
});
4732+
}
47364733
}
47374734

47384735
function emitConstructor(node: ClassDeclaration, baseTypeNode: TypeReferenceNode) {
@@ -4822,7 +4819,12 @@ module ts {
48224819
if (baseTypeNode) {
48234820
writeLine();
48244821
emitStart(baseTypeNode);
4825-
languageVersion < ScriptTarget.ES6 ? write("_super.apply(this, arguments);") : write("super(...args);");
4822+
if (languageVersion < ScriptTarget.ES6) {
4823+
write("_super.apply(this, arguments);");
4824+
}
4825+
else {
4826+
write("super(...args);");
4827+
}
48264828
emitEnd(baseTypeNode);
48274829
}
48284830
}

0 commit comments

Comments
 (0)