mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Apply suggested fixes to arguments PR
This commit is contained in:
parent
2b3da9a49e
commit
6f42e4164b
@ -13809,7 +13809,7 @@ namespace ts {
|
||||
if (location.locals && !isGlobalSourceFile(location)) {
|
||||
copySymbols(location.locals, meaning);
|
||||
}
|
||||
|
||||
|
||||
switch (location.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
if (!isExternalModule(<SourceFile>location)) {
|
||||
@ -13845,9 +13845,11 @@ namespace ts {
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isFunctionLike(location)) {
|
||||
|
||||
if (introducesArgumentsExoticObject(location)) {
|
||||
copySymbol(argumentsSymbol, meaning);
|
||||
}
|
||||
|
||||
memberFlags = location.flags;
|
||||
location = location.parent;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -5,10 +5,18 @@
|
||||
////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");
|
||||
verify.completionListContains("arguments");
|
||||
goTo.marker('4');
|
||||
verify.completionListContains("arguments");
|
||||
goTo.marker('5');
|
||||
verify.not.completionListContains("arguments");
|
||||
Loading…
x
Reference in New Issue
Block a user