| 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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 b.annotations = serializeAnnotations(annotations); | 894 b.annotations = serializeAnnotations(annotations); |
| 895 b.codeRange = serializeCodeRange(variables.parent); | 895 b.codeRange = serializeCodeRange(variables.parent); |
| 896 Map<int, int> localClosureIndexMap = _withLocalClosureIndexMap(() { | 896 Map<int, int> localClosureIndexMap = _withLocalClosureIndexMap(() { |
| 897 b.initializer = serializeInitializerFunction(variable.initializer); | 897 b.initializer = serializeInitializerFunction(variable.initializer); |
| 898 }); | 898 }); |
| 899 if (variable.isConst || | 899 if (variable.isConst || |
| 900 variable.isFinal && isField && !isDeclaredStatic || | 900 variable.isFinal && isField && !isDeclaredStatic || |
| 901 variables.type == null) { | 901 variables.type == null) { |
| 902 Expression initializer = variable.initializer; | 902 Expression initializer = variable.initializer; |
| 903 if (initializer != null) { | 903 if (initializer != null) { |
| 904 b.constExpr = serializeConstExpr(localClosureIndexMap, initializer); | 904 b.initializer.bodyExpr = |
| 905 serializeConstExpr(localClosureIndexMap, initializer); |
| 905 } | 906 } |
| 906 } | 907 } |
| 907 if (variable.initializer != null && | 908 if (variable.initializer != null && |
| 908 (variables.isFinal || variables.isConst)) { | 909 (variables.isFinal || variables.isConst)) { |
| 909 b.propagatedTypeSlot = assignSlot(); | 910 b.propagatedTypeSlot = assignSlot(); |
| 910 } | 911 } |
| 911 bool isSemanticallyStatic = !isField || isDeclaredStatic; | 912 bool isSemanticallyStatic = !isField || isDeclaredStatic; |
| 912 if (variables.type == null && | 913 if (variables.type == null && |
| 913 (variable.initializer != null || !isSemanticallyStatic)) { | 914 (variable.initializer != null || !isSemanticallyStatic)) { |
| 914 b.inferredTypeSlot = assignSlot(); | 915 b.inferredTypeSlot = assignSlot(); |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 /** | 1343 /** |
| 1343 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1344 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
| 1344 */ | 1345 */ |
| 1345 class _TypeParameterScope extends _Scope { | 1346 class _TypeParameterScope extends _Scope { |
| 1346 /** | 1347 /** |
| 1347 * Get the number of [_ScopedTypeParameter]s defined in this | 1348 * Get the number of [_ScopedTypeParameter]s defined in this |
| 1348 * [_TypeParameterScope]. | 1349 * [_TypeParameterScope]. |
| 1349 */ | 1350 */ |
| 1350 int get length => _definedNames.length; | 1351 int get length => _definedNames.length; |
| 1351 } | 1352 } |
| OLD | NEW |