| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:analyzer/dart/ast/ast.dart'; | 5 import 'package:analyzer/dart/ast/ast.dart'; |
| 6 import 'package:analyzer/dart/ast/token.dart'; | 6 import 'package:analyzer/dart/ast/token.dart'; |
| 7 import 'package:analyzer/dart/ast/visitor.dart'; | 7 import 'package:analyzer/dart/ast/visitor.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
| 10 import 'package:analyzer/src/dart/element/member.dart'; | 10 import 'package:analyzer/src/dart/element/member.dart'; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 /** | 345 /** |
| 346 * Record that [element] has a relation of the given [kind] at the given | 346 * Record that [element] has a relation of the given [kind] at the given |
| 347 * [offset] and [length]. The flag [isQualified] is `true` if the relation | 347 * [offset] and [length]. The flag [isQualified] is `true` if the relation |
| 348 * has an explicit or implicit qualifier, so [element] cannot be shadowed by | 348 * has an explicit or implicit qualifier, so [element] cannot be shadowed by |
| 349 * a local declaration. | 349 * a local declaration. |
| 350 */ | 350 */ |
| 351 void recordRelationOffset(Element element, IndexRelationKind kind, int offset, | 351 void recordRelationOffset(Element element, IndexRelationKind kind, int offset, |
| 352 int length, bool isQualified) { | 352 int length, bool isQualified) { |
| 353 // Ignore elements that can't be referenced outside of the unit. | 353 // Ignore elements that can't be referenced outside of the unit. |
| 354 if (element == null || | 354 ElementKind elementKind = element?.kind; |
| 355 element is FunctionElement && | 355 if (elementKind == null || |
| 356 elementKind == ElementKind.DYNAMIC || |
| 357 elementKind == ElementKind.LABEL || |
| 358 elementKind == ElementKind.LOCAL_VARIABLE || |
| 359 elementKind == ElementKind.PREFIX || |
| 360 elementKind == ElementKind.TYPE_PARAMETER || |
| 361 elementKind == ElementKind.FUNCTION && |
| 362 element is FunctionElement && |
| 356 element.enclosingElement is ExecutableElement || | 363 element.enclosingElement is ExecutableElement || |
| 357 element is LabelElement || | 364 elementKind == ElementKind.PARAMETER && |
| 358 element is LocalVariableElement || | 365 element is ParameterElement && |
| 359 element is ParameterElement && | |
| 360 element.parameterKind != ParameterKind.NAMED || | 366 element.parameterKind != ParameterKind.NAMED || |
| 361 element is PrefixElement || | 367 false) { |
| 362 element is TypeParameterElement) { | |
| 363 return; | 368 return; |
| 364 } | 369 } |
| 365 // Add the relation. | 370 // Add the relation. |
| 366 assembler.addElementRelation(element, kind, offset, length, isQualified); | 371 assembler.addElementRelation(element, kind, offset, length, isQualified); |
| 367 } | 372 } |
| 368 | 373 |
| 369 /** | 374 /** |
| 370 * Record that [element] has a relation of the given [kind] at the location | 375 * Record that [element] has a relation of the given [kind] at the location |
| 371 * of the given [token]. | 376 * of the given [token]. |
| 372 */ | 377 */ |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 usedNameOffsets: nameRelations.map((r) => r.offset).toList(), | 797 usedNameOffsets: nameRelations.map((r) => r.offset).toList(), |
| 793 usedNameIsQualifiedFlags: | 798 usedNameIsQualifiedFlags: |
| 794 nameRelations.map((r) => r.isQualified).toList()); | 799 nameRelations.map((r) => r.isQualified).toList()); |
| 795 } | 800 } |
| 796 | 801 |
| 797 void defineName(String name, IndexNameKind kind, int offset) { | 802 void defineName(String name, IndexNameKind kind, int offset) { |
| 798 _StringInfo nameInfo = pkg._getStringInfo(name); | 803 _StringInfo nameInfo = pkg._getStringInfo(name); |
| 799 definedNames.add(new _DefinedNameInfo(nameInfo, kind, offset)); | 804 definedNames.add(new _DefinedNameInfo(nameInfo, kind, offset)); |
| 800 } | 805 } |
| 801 } | 806 } |
| OLD | NEW |