(node, checkMode)
| 71641 | return getTypeOfSymbol(symbol); |
| 71642 | } |
| 71643 | function checkIdentifier(node, checkMode) { |
| 71644 | if (ts.isThisInTypeQuery(node)) { |
| 71645 | return checkThisExpression(node); |
| 71646 | } |
| 71647 | var symbol = getResolvedSymbol(node); |
| 71648 | if (symbol === unknownSymbol) { |
| 71649 | return errorType; |
| 71650 | } |
| 71651 | // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. |
| 71652 | // Although in down-level emit of arrow function, we emit it using function expression which means that |
| 71653 | // arguments objects will be bound to the inner object; emitting arrow function natively in ES6, arguments objects |
| 71654 | // will be bound to non-arrow function that contain this arrow function. This results in inconsistent behavior. |
| 71655 | // To avoid that we will give an error to users if they use arguments objects in arrow function so that they |
| 71656 | // can explicitly bound arguments objects |
| 71657 | if (symbol === argumentsSymbol) { |
| 71658 | if (isInPropertyInitializerOrClassStaticBlock(node)) { |
| 71659 | error(node, ts.Diagnostics.arguments_cannot_be_referenced_in_property_initializers); |
| 71660 | return errorType; |
| 71661 | } |
| 71662 | var container = ts.getContainingFunction(node); |
| 71663 | if (languageVersion < 2 /* ScriptTarget.ES2015 */) { |
| 71664 | if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { |
| 71665 | error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); |
| 71666 | } |
| 71667 | else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { |
| 71668 | error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); |
| 71669 | } |
| 71670 | } |
| 71671 | getNodeLinks(container).flags |= 8192 /* NodeCheckFlags.CaptureArguments */; |
| 71672 | return getTypeOfSymbol(symbol); |
| 71673 | } |
| 71674 | // We should only mark aliases as referenced if there isn't a local value declaration |
| 71675 | // for the symbol. Also, don't mark any property access expression LHS - checkPropertyAccessExpression will handle that |
| 71676 | if (!(node.parent && ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node)) { |
| 71677 | markAliasReferenced(symbol, node); |
| 71678 | } |
| 71679 | var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); |
| 71680 | var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node); |
| 71681 | if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) { |
| 71682 | addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText); |
| 71683 | } |
| 71684 | var declaration = localOrExportSymbol.valueDeclaration; |
| 71685 | if (declaration && localOrExportSymbol.flags & 32 /* SymbolFlags.Class */) { |
| 71686 | // Due to the emit for class decorators, any reference to the class from inside of the class body |
| 71687 | // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind |
| 71688 | // behavior of class names in ES6. |
| 71689 | if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ |
| 71690 | && ts.nodeIsDecorated(declaration)) { |
| 71691 | var container = ts.getContainingClass(node); |
| 71692 | while (container !== undefined) { |
| 71693 | if (container === declaration && container.name !== node) { |
| 71694 | getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; |
| 71695 | getNodeLinks(node).flags |= 33554432 /* NodeCheckFlags.ConstructorReferenceInClass */; |
| 71696 | break; |
| 71697 | } |
| 71698 | container = ts.getContainingClass(container); |
| 71699 | } |
| 71700 | } |
no test coverage detected
searching dependent graphs…