Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13845,7 +13845,11 @@ namespace ts {
}
break;
}


if (introducesArgumentsExoticObject(location)) {
copySymbol(argumentsSymbol, meaning);
}

memberFlags = location.flags;
location = location.parent;
}
Expand Down
19 changes: 18 additions & 1 deletion src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,10 @@ namespace ts {
}

export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) {
let commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) ? concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos), getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : getLeadingCommentRangesOfNode(node, sourceFileOfNode);
let commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) ?
concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos),
getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) :
getLeadingCommentRangesOfNode(node, sourceFileOfNode);
return filter(commentRanges, isJsDocComment);

function isJsDocComment(comment: CommentRange) {
Expand Down Expand Up @@ -638,6 +641,20 @@ namespace ts {
return false;
}

export function introducesArgumentsExoticObject(node: Node) {
switch (node.kind) {
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
return true;
}
return false;
}

export function isFunctionBlock(node: Node) {
return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent);
}
Expand Down
22 changes: 22 additions & 0 deletions tests/cases/fourslash/completionInsideFunctionContainsArguments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference path='fourslash.ts'/>

////function testArguments() {/*1*/}
/////*2*/
////function testNestedArguments() {
//// function nestedfunction(){/*3*/}
////}
////function f() {
//// let g = () => /*4*/
////}
////let g = () => /*5*/

goTo.marker('1');
verify.completionListContains("arguments");
goTo.marker('2');
verify.not.completionListContains("arguments");
goTo.marker('3');
verify.completionListContains("arguments");
goTo.marker('4');
verify.completionListContains("arguments");
goTo.marker('5');
verify.not.completionListContains("arguments");