| 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.resolver.scope; | 5 library analyzer.src.dart.resolver.scope; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 */ | 317 */ |
| 318 LabelScope(this._outerScope, this._label, this.node, this.element); | 318 LabelScope(this._outerScope, this._label, this.node, this.element); |
| 319 | 319 |
| 320 /** | 320 /** |
| 321 * Return the LabelScope which defines [targetLabel], or `null` if it is not | 321 * Return the LabelScope which defines [targetLabel], or `null` if it is not |
| 322 * defined in this scope. | 322 * defined in this scope. |
| 323 */ | 323 */ |
| 324 LabelScope lookup(String targetLabel) { | 324 LabelScope lookup(String targetLabel) { |
| 325 if (_label == targetLabel) { | 325 if (_label == targetLabel) { |
| 326 return this; | 326 return this; |
| 327 } else if (_outerScope != null) { | |
| 328 return _outerScope.lookup(targetLabel); | |
| 329 } else { | |
| 330 return null; | |
| 331 } | 327 } |
| 328 return _outerScope?.lookup(targetLabel); |
| 332 } | 329 } |
| 333 } | 330 } |
| 334 | 331 |
| 335 /** | 332 /** |
| 336 * The scope containing all of the names available from imported libraries. | 333 * The scope containing all of the names available from imported libraries. |
| 337 */ | 334 */ |
| 338 class LibraryImportScope extends Scope { | 335 class LibraryImportScope extends Scope { |
| 339 /** | 336 /** |
| 340 * The element representing the library in which this scope is enclosed. | 337 * The element representing the library in which this scope is enclosed. |
| 341 */ | 338 */ |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 | 1200 |
| 1204 /** | 1201 /** |
| 1205 * Define the type parameters declared by the [classElement]. | 1202 * Define the type parameters declared by the [classElement]. |
| 1206 */ | 1203 */ |
| 1207 void _defineTypeParameters(ClassElement classElement) { | 1204 void _defineTypeParameters(ClassElement classElement) { |
| 1208 for (TypeParameterElement typeParameter in classElement.typeParameters) { | 1205 for (TypeParameterElement typeParameter in classElement.typeParameters) { |
| 1209 define(typeParameter); | 1206 define(typeParameter); |
| 1210 } | 1207 } |
| 1211 } | 1208 } |
| 1212 } | 1209 } |
| OLD | NEW |