ArrowFunction has no own 'arguments'

Fixes: #28621
This commit is contained in:
Klaus Meinhardt
2018-11-20 23:07:01 +01:00
parent 94d7e30393
commit 635780db07
34 changed files with 155 additions and 73 deletions

View File

@@ -1419,12 +1419,18 @@ namespace ts {
}
}
break;
case SyntaxKind.ArrowFunction:
// when targeting ES6 or higher there is no 'arguments' in an arrow function
// for lower compile targets the resolved symbol is used to emit an error
if (compilerOptions.target! >= ScriptTarget.ES2015) {
break;
}
// falls through
case SyntaxKind.MethodDeclaration:
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ArrowFunction:
if (meaning & SymbolFlags.Variable && name === "arguments") {
result = argumentsSymbol;
break loop;