Skip to content

Commit 150cecb

Browse files
committed
PR Feedback
1 parent 60e1ae0 commit 150cecb

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/compiler/binder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,8 +2174,8 @@ namespace ts {
21742174
// A GetAccessor or SetAccessor is ES5 syntax.
21752175
excludeFlags = TransformFlags.MethodOrAccessorExcludes;
21762176

2177-
// A GetAccessor or SetAccessor is TypeScript syntax if it is either abstract,
2178-
// or has a decorator.
2177+
// A GetAccessor or SetAccessor is TypeScript syntax if it has async or abstract
2178+
// modifiers, or has a decorator.
21792179
if ((<AccessorDeclaration>node).body === undefined
21802180
|| hasModifier(node, ModifierFlags.Async | ModifierFlags.Abstract)
21812181
|| subtreeFlags & TransformFlags.ContainsDecorators) {

src/compiler/factory.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,9 +1176,6 @@ namespace ts {
11761176
const right = getMutableClone(node.right, emitOptions && clone(emitOptions));
11771177
return createPropertyAccess(left, right, /*location*/ node, emitOptions && clone(emitOptions));
11781178
}
1179-
else if (isIdentifier(node)) {
1180-
return getMutableClone(node, emitOptions && clone(emitOptions));
1181-
}
11821179
else {
11831180
return getMutableClone(node, emitOptions && clone(emitOptions));
11841181
}

src/compiler/transformers/ts.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ namespace ts {
228228
if (hasModifier(node, ModifierFlags.Ambient) && isStatement(node)) {
229229
// TypeScript ambient declarations are elided, but some comments may be preserved.
230230
// See the implementation of `getLeadingComments` in comments.ts for more details.
231-
return isStatement(node)
232-
? createNotEmittedStatement(node)
233-
: undefined;
231+
return createNotEmittedStatement(node);
234232
}
235233

236234
switch (node.kind) {
@@ -430,16 +428,19 @@ namespace ts {
430428

431429
const constructor = getFirstConstructorWithBody(node);
432430
if (constructor) {
433-
for (const parameter of constructor.parameters) {
434-
if (parameter.decorators && parameter.decorators.length > 0) {
435-
return true;
436-
}
437-
}
431+
return forEach(constructor.parameters, shouldEmitDecorateCallForParameter);
438432
}
439433

440434
return false;
441435
}
442436

437+
/**
438+
* Tests whether we should emit a __decorate call for a parameter declaration.
439+
*/
440+
function shouldEmitDecorateCallForParameter(parameter: ParameterDeclaration) {
441+
return parameter.decorators !== undefined && parameter.decorators.length > 0;
442+
}
443+
443444
/**
444445
* Transforms a class declaration with TypeScript syntax into compatible ES6.
445446
*

0 commit comments

Comments
 (0)