| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 List<MethodElement> methods = classElement.methods; | 107 List<MethodElement> methods = classElement.methods; |
| 108 int methodLength = methods.length; | 108 int methodLength = methods.length; |
| 109 for (int i = 0; i < methodLength; i++) { | 109 for (int i = 0; i < methodLength; i++) { |
| 110 define(methods[i]); | 110 define(methods[i]); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * The scope defined for the initializers in a constructor. |
| 117 */ |
| 118 class ConstructorInitializerScope extends EnclosedScope { |
| 119 /** |
| 120 * Initialize a newly created scope, enclosed within the [enclosingScope]. |
| 121 */ |
| 122 ConstructorInitializerScope(Scope enclosingScope, ConstructorElement element) |
| 123 : super(enclosingScope) { |
| 124 _initializeFieldFormalParameters(element); |
| 125 } |
| 126 |
| 127 /** |
| 128 * Initialize the local scope with all of the field formal parameters. |
| 129 */ |
| 130 void _initializeFieldFormalParameters(ConstructorElement element) { |
| 131 for (ParameterElement parameter in element.parameters) { |
| 132 if (parameter is FieldFormalParameterElement) { |
| 133 define(parameter); |
| 134 } |
| 135 } |
| 136 } |
| 137 } |
| 138 |
| 139 /** |
| 116 * A scope that is lexically enclosed in another scope. | 140 * A scope that is lexically enclosed in another scope. |
| 117 */ | 141 */ |
| 118 class EnclosedScope extends Scope { | 142 class EnclosedScope extends Scope { |
| 119 /** | 143 /** |
| 120 * The scope in which this scope is lexically enclosed. | 144 * The scope in which this scope is lexically enclosed. |
| 121 */ | 145 */ |
| 122 @override | 146 @override |
| 123 final Scope enclosingScope; | 147 final Scope enclosingScope; |
| 124 | 148 |
| 125 /** | 149 /** |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 | 1169 |
| 1146 /** | 1170 /** |
| 1147 * Define the type parameters declared by the [classElement]. | 1171 * Define the type parameters declared by the [classElement]. |
| 1148 */ | 1172 */ |
| 1149 void _defineTypeParameters(ClassElement classElement) { | 1173 void _defineTypeParameters(ClassElement classElement) { |
| 1150 for (TypeParameterElement typeParameter in classElement.typeParameters) { | 1174 for (TypeParameterElement typeParameter in classElement.typeParameters) { |
| 1151 define(typeParameter); | 1175 define(typeParameter); |
| 1152 } | 1176 } |
| 1153 } | 1177 } |
| 1154 } | 1178 } |
| OLD | NEW |