Address PR comments

1. Test name.originalKeywordKind: SyntaxKind instead of name.text: string.
2. Revert regression in comment placement when emitting methods as function properties.
This commit is contained in:
Nathan Shively-Sanders
2016-04-20 09:04:34 -07:00
parent 9797c9c512
commit c55de357b7
3 changed files with 5 additions and 6 deletions

View File

@@ -2267,8 +2267,8 @@ namespace ts {
transformFlags |= TransformFlags.AssertTypeScript;
}
// If the parameter's name is 'this, then it is TypeScript syntax.
if ((node.name as Identifier).text === "this") {
// If the parameter's name is 'this', then it is TypeScript syntax.
if (node.name && (node.name as Identifier).originalKeywordKind === SyntaxKind.ThisKeyword) {
transformFlags |= TransformFlags.AssertTypeScript;
}

View File

@@ -2115,12 +2115,12 @@ namespace ts {
* This function will be called when one of the following conditions are met:
* - The node has an accessibility modifier.
* - The node has a questionToken.
* - The node's text is "this".
* - The node's kind is ThisKeyword.
*
* @param node The parameter declaration node.
*/
function visitParameter(node: ParameterDeclaration) {
if ((node.name as Identifier).text === "this") {
if (node.name && (node.name as Identifier).originalKeywordKind === SyntaxKind.ThisKeyword) {
return undefined;
}
const clone = getMutableClone(node);

View File

@@ -243,8 +243,7 @@ function implicitThis(n) {
var impl = {
a: 12,
explicitVoid2: function () { return _this.a; },
explicitVoid1: // ok, this: any because it refers to some outer object (window?)
function () { return 12; },
explicitVoid1: function () { return 12; },
explicitStructural: function () {
return this.a;
},