| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 4151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4162 super.uriOffset = uriOffset; | 4162 super.uriOffset = uriOffset; |
| 4163 } | 4163 } |
| 4164 | 4164 |
| 4165 @override | 4165 @override |
| 4166 /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) => | 4166 /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) => |
| 4167 visitor.visitExportElement(this); | 4167 visitor.visitExportElement(this); |
| 4168 | 4168 |
| 4169 @override | 4169 @override |
| 4170 void appendTo(StringBuffer buffer) { | 4170 void appendTo(StringBuffer buffer) { |
| 4171 buffer.write("export "); | 4171 buffer.write("export "); |
| 4172 (exportedLibrary as LibraryElementImpl).appendTo(buffer); | 4172 LibraryElementImpl.getImpl(exportedLibrary).appendTo(buffer); |
| 4173 } | 4173 } |
| 4174 } | 4174 } |
| 4175 | 4175 |
| 4176 /** | 4176 /** |
| 4177 * A concrete implementation of a [FieldElement]. | 4177 * A concrete implementation of a [FieldElement]. |
| 4178 */ | 4178 */ |
| 4179 class FieldElementImpl extends PropertyInducingElementImpl | 4179 class FieldElementImpl extends PropertyInducingElementImpl |
| 4180 implements FieldElement { | 4180 implements FieldElement { |
| 4181 /** | 4181 /** |
| 4182 * Initialize a newly created synthetic field element to have the given [name] | 4182 * Initialize a newly created synthetic field element to have the given [name] |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5119 super.uriOffset = uriOffset; | 5119 super.uriOffset = uriOffset; |
| 5120 } | 5120 } |
| 5121 | 5121 |
| 5122 @override | 5122 @override |
| 5123 /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) => | 5123 /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) => |
| 5124 visitor.visitImportElement(this); | 5124 visitor.visitImportElement(this); |
| 5125 | 5125 |
| 5126 @override | 5126 @override |
| 5127 void appendTo(StringBuffer buffer) { | 5127 void appendTo(StringBuffer buffer) { |
| 5128 buffer.write("import "); | 5128 buffer.write("import "); |
| 5129 (importedLibrary as LibraryElementImpl).appendTo(buffer); | 5129 LibraryElementImpl.getImpl(importedLibrary).appendTo(buffer); |
| 5130 } | 5130 } |
| 5131 | 5131 |
| 5132 @override | 5132 @override |
| 5133 void visitChildren(ElementVisitor visitor) { | 5133 void visitChildren(ElementVisitor visitor) { |
| 5134 super.visitChildren(visitor); | 5134 super.visitChildren(visitor); |
| 5135 prefix?.accept(visitor); | 5135 prefix?.accept(visitor); |
| 5136 } | 5136 } |
| 5137 | 5137 |
| 5138 static List<NamespaceCombinator> _buildCombinators( | 5138 static List<NamespaceCombinator> _buildCombinators( |
| 5139 List<UnlinkedCombinator> unlinkedCombinators) { | 5139 List<UnlinkedCombinator> unlinkedCombinators) { |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5930 @override | 5930 @override |
| 5931 void visitChildren(ElementVisitor visitor) { | 5931 void visitChildren(ElementVisitor visitor) { |
| 5932 super.visitChildren(visitor); | 5932 super.visitChildren(visitor); |
| 5933 _definingCompilationUnit?.accept(visitor); | 5933 _definingCompilationUnit?.accept(visitor); |
| 5934 safelyVisitChildren(exports, visitor); | 5934 safelyVisitChildren(exports, visitor); |
| 5935 safelyVisitChildren(imports, visitor); | 5935 safelyVisitChildren(imports, visitor); |
| 5936 safelyVisitChildren(_parts, visitor); | 5936 safelyVisitChildren(_parts, visitor); |
| 5937 } | 5937 } |
| 5938 | 5938 |
| 5939 /** | 5939 /** |
| 5940 * Return the [LibraryElementImpl] of the given [element]. |
| 5941 */ |
| 5942 static LibraryElementImpl getImpl(LibraryElement element) { |
| 5943 if (element is LibraryElementHandle) { |
| 5944 return getImpl(element.actualElement); |
| 5945 } |
| 5946 return element as LibraryElementImpl; |
| 5947 } |
| 5948 |
| 5949 /** |
| 5940 * Return `true` if the [library] has the given [capability]. | 5950 * Return `true` if the [library] has the given [capability]. |
| 5941 */ | 5951 */ |
| 5942 static bool hasResolutionCapability( | 5952 static bool hasResolutionCapability( |
| 5943 LibraryElement library, LibraryResolutionCapability capability) { | 5953 LibraryElement library, LibraryResolutionCapability capability) { |
| 5944 return library is LibraryElementImpl && | 5954 return library is LibraryElementImpl && |
| 5945 BooleanArray.get(library._resolutionCapabilities, capability.index); | 5955 BooleanArray.get(library._resolutionCapabilities, capability.index); |
| 5946 } | 5956 } |
| 5947 } | 5957 } |
| 5948 | 5958 |
| 5949 /** | 5959 /** |
| (...skipping 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8509 | 8519 |
| 8510 @override | 8520 @override |
| 8511 void visitElement(Element element) { | 8521 void visitElement(Element element) { |
| 8512 int offset = element.nameOffset; | 8522 int offset = element.nameOffset; |
| 8513 if (offset != -1) { | 8523 if (offset != -1) { |
| 8514 map[offset] = element; | 8524 map[offset] = element; |
| 8515 } | 8525 } |
| 8516 super.visitElement(element); | 8526 super.visitElement(element); |
| 8517 } | 8527 } |
| 8518 } | 8528 } |
| OLD | NEW |