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 3129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3140 } | 3140 } |
3141 } | 3141 } |
3142 | 3142 |
3143 /** | 3143 /** |
3144 * If the element associated with the given [type] is a generic function type | 3144 * If the element associated with the given [type] is a generic function type |
3145 * element, then make it a child of this element. Return the [type] as a | 3145 * element, then make it a child of this element. Return the [type] as a |
3146 * convenience. | 3146 * convenience. |
3147 */ | 3147 */ |
3148 DartType _checkElementOfType(DartType type) { | 3148 DartType _checkElementOfType(DartType type) { |
3149 Element element = type?.element; | 3149 Element element = type?.element; |
3150 if (element is GenericFunctionTypeElementImpl) { | 3150 if (element is GenericFunctionTypeElementImpl && |
| 3151 element.enclosingElement == null) { |
3151 element.enclosingElement = this; | 3152 element.enclosingElement = this; |
3152 } | 3153 } |
3153 return type; | 3154 return type; |
3154 } | 3155 } |
3155 | 3156 |
3156 /** | 3157 /** |
3157 * If the given [type] is a generic function type, then the element associated | 3158 * If the given [type] is a generic function type, then the element associated |
3158 * with the type is implicitly a child of this element and should be visted by | 3159 * with the type is implicitly a child of this element and should be visted by |
3159 * the given [visitor]. | 3160 * the given [visitor]. |
3160 */ | 3161 */ |
(...skipping 4024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7185 void set hasImplicitType(bool hasImplicitType) { | 7186 void set hasImplicitType(bool hasImplicitType) { |
7186 _assertNotResynthesized(_unlinkedVariable); | 7187 _assertNotResynthesized(_unlinkedVariable); |
7187 super.hasImplicitType = hasImplicitType; | 7188 super.hasImplicitType = hasImplicitType; |
7188 } | 7189 } |
7189 | 7190 |
7190 @override | 7191 @override |
7191 FunctionElement get initializer { | 7192 FunctionElement get initializer { |
7192 if (_unlinkedVariable != null && _initializer == null) { | 7193 if (_unlinkedVariable != null && _initializer == null) { |
7193 UnlinkedExecutable unlinkedInitializer = _unlinkedVariable.initializer; | 7194 UnlinkedExecutable unlinkedInitializer = _unlinkedVariable.initializer; |
7194 if (unlinkedInitializer != null) { | 7195 if (unlinkedInitializer != null) { |
7195 _initializer = new FunctionElementImpl.forSerialized( | 7196 _initializer = |
7196 unlinkedInitializer, this)..isSynthetic = true; | 7197 new FunctionElementImpl.forSerialized(unlinkedInitializer, this) |
| 7198 ..isSynthetic = true; |
7197 } else { | 7199 } else { |
7198 return null; | 7200 return null; |
7199 } | 7201 } |
7200 } | 7202 } |
7201 return super.initializer; | 7203 return super.initializer; |
7202 } | 7204 } |
7203 | 7205 |
7204 /** | 7206 /** |
7205 * Set the function representing this variable's initializer to the given | 7207 * Set the function representing this variable's initializer to the given |
7206 * [function]. | 7208 * [function]. |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7477 void set inheritsCovariant(bool value) { | 7479 void set inheritsCovariant(bool value) { |
7478 _assertNotResynthesized(_unlinkedParam); | 7480 _assertNotResynthesized(_unlinkedParam); |
7479 _inheritsCovariant = value; | 7481 _inheritsCovariant = value; |
7480 } | 7482 } |
7481 | 7483 |
7482 @override | 7484 @override |
7483 FunctionElement get initializer { | 7485 FunctionElement get initializer { |
7484 if (_unlinkedParam != null && _initializer == null) { | 7486 if (_unlinkedParam != null && _initializer == null) { |
7485 UnlinkedExecutable unlinkedInitializer = _unlinkedParam.initializer; | 7487 UnlinkedExecutable unlinkedInitializer = _unlinkedParam.initializer; |
7486 if (unlinkedInitializer != null) { | 7488 if (unlinkedInitializer != null) { |
7487 _initializer = new FunctionElementImpl.forSerialized( | 7489 _initializer = |
7488 unlinkedInitializer, this)..isSynthetic = true; | 7490 new FunctionElementImpl.forSerialized(unlinkedInitializer, this) |
| 7491 ..isSynthetic = true; |
7489 } else { | 7492 } else { |
7490 return null; | 7493 return null; |
7491 } | 7494 } |
7492 } | 7495 } |
7493 return super.initializer; | 7496 return super.initializer; |
7494 } | 7497 } |
7495 | 7498 |
7496 /** | 7499 /** |
7497 * Set the function representing this variable's initializer to the given | 7500 * Set the function representing this variable's initializer to the given |
7498 * [function]. | 7501 * [function]. |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9091 | 9094 |
9092 @override | 9095 @override |
9093 void visitElement(Element element) { | 9096 void visitElement(Element element) { |
9094 int offset = element.nameOffset; | 9097 int offset = element.nameOffset; |
9095 if (offset != -1) { | 9098 if (offset != -1) { |
9096 map[offset] = element; | 9099 map[offset] = element; |
9097 } | 9100 } |
9098 super.visitElement(element); | 9101 super.visitElement(element); |
9099 } | 9102 } |
9100 } | 9103 } |
OLD | NEW |