| 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/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
| 10 import 'package:analyzer/src/generated/utilities_dart.dart'; | 10 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 b.isFinal = variables.isFinal; | 817 b.isFinal = variables.isFinal; |
| 818 b.isConst = variables.isConst; | 818 b.isConst = variables.isConst; |
| 819 b.isStatic = isDeclaredStatic; | 819 b.isStatic = isDeclaredStatic; |
| 820 b.name = variable.name.name; | 820 b.name = variable.name.name; |
| 821 b.nameOffset = variable.name.offset; | 821 b.nameOffset = variable.name.offset; |
| 822 b.type = serializeTypeName(variables.type); | 822 b.type = serializeTypeName(variables.type); |
| 823 b.documentationComment = serializeDocumentation(documentationComment); | 823 b.documentationComment = serializeDocumentation(documentationComment); |
| 824 b.annotations = serializeAnnotations(annotations); | 824 b.annotations = serializeAnnotations(annotations); |
| 825 b.codeRange = serializeCodeRange(variables.parent); | 825 b.codeRange = serializeCodeRange(variables.parent); |
| 826 if (variable.isConst || | 826 if (variable.isConst || |
| 827 variable.isFinal && isField && !isDeclaredStatic) { | 827 variable.isFinal && isField && !isDeclaredStatic || |
| 828 variables.type == null) { |
| 828 Expression initializer = variable.initializer; | 829 Expression initializer = variable.initializer; |
| 829 if (initializer != null) { | 830 if (initializer != null) { |
| 830 b.constExpr = serializeConstExpr(initializer); | 831 b.constExpr = serializeConstExpr(initializer); |
| 831 } | 832 } |
| 832 } | 833 } |
| 833 if (variable.initializer != null && | 834 if (variable.initializer != null && |
| 834 (variables.isFinal || variables.isConst)) { | 835 (variables.isFinal || variables.isConst)) { |
| 835 b.propagatedTypeSlot = assignSlot(); | 836 b.propagatedTypeSlot = assignSlot(); |
| 836 } | 837 } |
| 837 bool isSemanticallyStatic = !isField || isDeclaredStatic; | 838 bool isSemanticallyStatic = !isField || isDeclaredStatic; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 /** | 1238 /** |
| 1238 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1239 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
| 1239 */ | 1240 */ |
| 1240 class _TypeParameterScope extends _Scope { | 1241 class _TypeParameterScope extends _Scope { |
| 1241 /** | 1242 /** |
| 1242 * Get the number of [_ScopedTypeParameter]s defined in this | 1243 * Get the number of [_ScopedTypeParameter]s defined in this |
| 1243 * [_TypeParameterScope]. | 1244 * [_TypeParameterScope]. |
| 1244 */ | 1245 */ |
| 1245 int get length => _definedNames.length; | 1246 int get length => _definedNames.length; |
| 1246 } | 1247 } |
| OLD | NEW |