| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 serialization.summarize_ast; | 5 library serialization.summarize_ast; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/visitor.dart'; | 8 import 'package:analyzer/dart/ast/visitor.dart'; |
| 9 import 'package:analyzer/src/generated/scanner.dart'; | 9 import 'package:analyzer/src/generated/scanner.dart'; |
| 10 import 'package:analyzer/src/generated/utilities_dart.dart'; | 10 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 int assignTypeSlot() => ++numSlots; | 296 int assignTypeSlot() => ++numSlots; |
| 297 | 297 |
| 298 /** | 298 /** |
| 299 * Build a [_Scope] object containing the names defined within the body of a | 299 * Build a [_Scope] object containing the names defined within the body of a |
| 300 * class declaration. | 300 * class declaration. |
| 301 */ | 301 */ |
| 302 _Scope buildClassMemberScope( | 302 _Scope buildClassMemberScope( |
| 303 String className, NodeList<ClassMember> members) { | 303 String className, NodeList<ClassMember> members) { |
| 304 _Scope scope = new _Scope(); | 304 _Scope scope = new _Scope(); |
| 305 for (ClassMember member in members) { | 305 for (ClassMember member in members) { |
| 306 // TODO(paulbery): consider replacing these if-tests with dynamic method | |
| 307 // dispatch. | |
| 308 if (member is MethodDeclaration) { | 306 if (member is MethodDeclaration) { |
| 309 if (member.isSetter || member.isOperator) { | 307 if (member.isSetter || member.isOperator) { |
| 310 // We don't have to handle setters or operators because the only | 308 // We don't have to handle setters or operators because the only |
| 311 // things we look up are type names and identifiers. | 309 // things we look up are type names and identifiers. |
| 312 } else { | 310 } else { |
| 313 scope[member.name.name] = new _ScopedClassMember(className); | 311 scope[member.name.name] = new _ScopedClassMember(className); |
| 314 } | 312 } |
| 315 } else if (member is FieldDeclaration) { | 313 } else if (member is FieldDeclaration) { |
| 316 for (VariableDeclaration field in member.fields.variables) { | 314 for (VariableDeclaration field in member.fields.variables) { |
| 317 // A field declaration introduces two names, one with a trailing `=`. | 315 // A field declaration introduces two names, one with a trailing `=`. |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 /** | 1020 /** |
| 1023 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1021 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
| 1024 */ | 1022 */ |
| 1025 class _TypeParameterScope extends _Scope { | 1023 class _TypeParameterScope extends _Scope { |
| 1026 /** | 1024 /** |
| 1027 * Get the number of [_ScopedTypeParameter]s defined in this | 1025 * Get the number of [_ScopedTypeParameter]s defined in this |
| 1028 * [_TypeParameterScope]. | 1026 * [_TypeParameterScope]. |
| 1029 */ | 1027 */ |
| 1030 int get length => _definedNames.length; | 1028 int get length => _definedNames.length; |
| 1031 } | 1029 } |
| OLD | NEW |