| 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/dart/element/type.dart' show DartType; | 10 import 'package:analyzer/dart/element/type.dart' show DartType; |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 b.nameOffset = variable.name.offset; | 987 b.nameOffset = variable.name.offset; |
| 988 b.type = serializeTypeName(variables.type); | 988 b.type = serializeTypeName(variables.type); |
| 989 b.documentationComment = serializeDocumentation(documentationComment); | 989 b.documentationComment = serializeDocumentation(documentationComment); |
| 990 b.annotations = serializeAnnotations(annotations); | 990 b.annotations = serializeAnnotations(annotations); |
| 991 b.codeRange = serializeCodeRange(variables.parent); | 991 b.codeRange = serializeCodeRange(variables.parent); |
| 992 bool serializeBodyExpr = variable.isConst || | 992 bool serializeBodyExpr = variable.isConst || |
| 993 variable.isFinal && isField && !isDeclaredStatic || | 993 variable.isFinal && isField && !isDeclaredStatic || |
| 994 variables.type == null; | 994 variables.type == null; |
| 995 b.initializer = | 995 b.initializer = |
| 996 serializeInitializerFunction(variable.initializer, serializeBodyExpr); | 996 serializeInitializerFunction(variable.initializer, serializeBodyExpr); |
| 997 if (isField && !isDeclaredStatic && !variables.isFinal) { |
| 998 b.inheritsCovariantSlot = assignSlot(); |
| 999 } |
| 997 if (variable.initializer != null && | 1000 if (variable.initializer != null && |
| 998 (variables.isFinal || variables.isConst)) { | 1001 (variables.isFinal || variables.isConst)) { |
| 999 b.propagatedTypeSlot = assignSlot(); | 1002 b.propagatedTypeSlot = assignSlot(); |
| 1000 } | 1003 } |
| 1001 bool isSemanticallyStatic = !isField || isDeclaredStatic; | 1004 bool isSemanticallyStatic = !isField || isDeclaredStatic; |
| 1002 if (variables.type == null && | 1005 if (variables.type == null && |
| 1003 (variable.initializer != null || !isSemanticallyStatic)) { | 1006 (variable.initializer != null || !isSemanticallyStatic)) { |
| 1004 b.inferredTypeSlot = assignSlot(); | 1007 b.inferredTypeSlot = assignSlot(); |
| 1005 } | 1008 } |
| 1006 b.visibleOffset = scopeNode?.offset; | 1009 b.visibleOffset = scopeNode?.offset; |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 /** | 1426 /** |
| 1424 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1427 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
| 1425 */ | 1428 */ |
| 1426 class _TypeParameterScope extends _Scope { | 1429 class _TypeParameterScope extends _Scope { |
| 1427 /** | 1430 /** |
| 1428 * Get the number of [_ScopedTypeParameter]s defined in this | 1431 * Get the number of [_ScopedTypeParameter]s defined in this |
| 1429 * [_TypeParameterScope]. | 1432 * [_TypeParameterScope]. |
| 1430 */ | 1433 */ |
| 1431 int get length => _definedNames.length; | 1434 int get length => _definedNames.length; |
| 1432 } | 1435 } |
| OLD | NEW |