| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    50             [existing.displayName]); |    50             [existing.displayName]); | 
|    51       } |    51       } | 
|    52     } |    52     } | 
|    53     return super.getErrorForDuplicate(existing, duplicate); |    53     return super.getErrorForDuplicate(existing, duplicate); | 
|    54   } |    54   } | 
|    55  |    55  | 
|    56   /** |    56   /** | 
|    57    * Define the instance members defined by the given [classElement]. |    57    * Define the instance members defined by the given [classElement]. | 
|    58    */ |    58    */ | 
|    59   void _defineMembers(ClassElement classElement) { |    59   void _defineMembers(ClassElement classElement) { | 
|    60     for (PropertyAccessorElement accessor in classElement.accessors) { |    60     List<PropertyAccessorElement> accessors = classElement.accessors; | 
|    61       define(accessor); |    61     int accessorLength = accessors.length; | 
 |    62     for (int i = 0; i < accessorLength; i++) { | 
 |    63       define(accessors[i]); | 
|    62     } |    64     } | 
|    63     for (MethodElement method in classElement.methods) { |    65     List<MethodElement> methods = classElement.methods; | 
|    64       define(method); |    66     int methodLength = methods.length; | 
 |    67     for (int i = 0; i < methodLength; i++) { | 
 |    68       define(methods[i]); | 
|    65     } |    69     } | 
|    66   } |    70   } | 
|    67 } |    71 } | 
|    68  |    72  | 
|    69 /** |    73 /** | 
|    70  * A scope that is lexically enclosed in another scope. |    74  * A scope that is lexically enclosed in another scope. | 
|    71  */ |    75  */ | 
|    72 class EnclosedScope extends Scope { |    76 class EnclosedScope extends Scope { | 
|    73   /** |    77   /** | 
|    74    * The scope in which this scope is lexically enclosed. |    78    * The scope in which this scope is lexically enclosed. | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   167   /** |   171   /** | 
|   168    * Define the parameters for the given function in the scope that encloses |   172    * Define the parameters for the given function in the scope that encloses | 
|   169    * this function. |   173    * this function. | 
|   170    */ |   174    */ | 
|   171   void defineParameters() { |   175   void defineParameters() { | 
|   172     if (_parametersDefined) { |   176     if (_parametersDefined) { | 
|   173       return; |   177       return; | 
|   174     } |   178     } | 
|   175     _parametersDefined = true; |   179     _parametersDefined = true; | 
|   176     Scope parameterScope = enclosingScope; |   180     Scope parameterScope = enclosingScope; | 
|   177     for (ParameterElement parameter in _functionElement.parameters) { |   181     List<ParameterElement> parameters = _functionElement.parameters; | 
 |   182     int length = parameters.length; | 
 |   183     for (int i = 0; i < length; i++) { | 
 |   184       ParameterElement parameter = parameters[i]; | 
|   178       if (!parameter.isInitializingFormal) { |   185       if (!parameter.isInitializingFormal) { | 
|   179         parameterScope.define(parameter); |   186         parameterScope.define(parameter); | 
|   180       } |   187       } | 
|   181     } |   188     } | 
|   182   } |   189   } | 
|   183  |   190  | 
|   184   /** |   191   /** | 
|   185    * Define the type parameters for the function. |   192    * Define the type parameters for the function. | 
|   186    */ |   193    */ | 
|   187   void _defineTypeParameters() { |   194   void _defineTypeParameters() { | 
|   188     Scope typeParameterScope = enclosingScope.enclosingScope; |   195     Scope typeParameterScope = enclosingScope.enclosingScope; | 
|   189     for (TypeParameterElement typeParameter |   196     List<TypeParameterElement> typeParameters = _functionElement.typeParameters; | 
|   190         in _functionElement.typeParameters) { |   197     int length = typeParameters.length; | 
 |   198     for (int i = 0; i < length; i++) { | 
 |   199       TypeParameterElement typeParameter = typeParameters[i]; | 
|   191       typeParameterScope.define(typeParameter); |   200       typeParameterScope.define(typeParameter); | 
|   192     } |   201     } | 
|   193   } |   202   } | 
|   194 } |   203 } | 
|   195  |   204  | 
|   196 /** |   205 /** | 
|   197  * The scope defined by a function type alias. |   206  * The scope defined by a function type alias. | 
|   198  */ |   207  */ | 
|   199 class FunctionTypeScope extends EnclosedScope { |   208 class FunctionTypeScope extends EnclosedScope { | 
|   200   final FunctionTypeAliasElement _typeElement; |   209   final FunctionTypeAliasElement _typeElement; | 
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1200  |  1209  | 
|  1201   /** |  1210   /** | 
|  1202    * Define the type parameters declared by the [classElement]. |  1211    * Define the type parameters declared by the [classElement]. | 
|  1203    */ |  1212    */ | 
|  1204   void _defineTypeParameters(ClassElement classElement) { |  1213   void _defineTypeParameters(ClassElement classElement) { | 
|  1205     for (TypeParameterElement typeParameter in classElement.typeParameters) { |  1214     for (TypeParameterElement typeParameter in classElement.typeParameters) { | 
|  1206       define(typeParameter); |  1215       define(typeParameter); | 
|  1207     } |  1216     } | 
|  1208   } |  1217   } | 
|  1209 } |  1218 } | 
| OLD | NEW |