OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 summary_resynthesizer; | 5 library summary_resynthesizer; |
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/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 if (serializedParameter.isInitializingFormal) { | 2325 if (serializedParameter.isInitializingFormal) { |
2326 FieldFormalParameterElementImpl initializingParameter; | 2326 FieldFormalParameterElementImpl initializingParameter; |
2327 if (serializedParameter.kind == UnlinkedParamKind.required) { | 2327 if (serializedParameter.kind == UnlinkedParamKind.required) { |
2328 initializingParameter = new FieldFormalParameterElementImpl( | 2328 initializingParameter = new FieldFormalParameterElementImpl( |
2329 serializedParameter.name, nameOffset); | 2329 serializedParameter.name, nameOffset); |
2330 } else { | 2330 } else { |
2331 DefaultFieldFormalParameterElementImpl defaultParameter = | 2331 DefaultFieldFormalParameterElementImpl defaultParameter = |
2332 new DefaultFieldFormalParameterElementImpl( | 2332 new DefaultFieldFormalParameterElementImpl( |
2333 serializedParameter.name, nameOffset); | 2333 serializedParameter.name, nameOffset); |
2334 initializingParameter = defaultParameter; | 2334 initializingParameter = defaultParameter; |
2335 if (serializedParameter.defaultValue != null) { | 2335 if (serializedParameter.initializer?.bodyExpr != null) { |
2336 defaultParameter.constantInitializer = _buildConstExpression( | 2336 defaultParameter.constantInitializer = _buildConstExpression( |
2337 enclosingElement, serializedParameter.defaultValue); | 2337 enclosingElement, serializedParameter.initializer.bodyExpr); |
2338 defaultParameter.defaultValueCode = | 2338 defaultParameter.defaultValueCode = |
2339 serializedParameter.defaultValueCode; | 2339 serializedParameter.defaultValueCode; |
2340 } | 2340 } |
2341 } | 2341 } |
2342 parameterElement = initializingParameter; | 2342 parameterElement = initializingParameter; |
2343 initializingParameter.field = fields[serializedParameter.name]; | 2343 initializingParameter.field = fields[serializedParameter.name]; |
2344 } else { | 2344 } else { |
2345 if (serializedParameter.kind == UnlinkedParamKind.required) { | 2345 if (serializedParameter.kind == UnlinkedParamKind.required) { |
2346 parameterElement = new ParameterElementImpl.forSerialized( | 2346 parameterElement = new ParameterElementImpl.forSerialized( |
2347 serializedParameter, enclosingElement); | 2347 serializedParameter, enclosingElement); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2962 static String _getElementIdentifier(String name, ReferenceKind kind) { | 2962 static String _getElementIdentifier(String name, ReferenceKind kind) { |
2963 if (kind == ReferenceKind.topLevelPropertyAccessor || | 2963 if (kind == ReferenceKind.topLevelPropertyAccessor || |
2964 kind == ReferenceKind.propertyAccessor) { | 2964 kind == ReferenceKind.propertyAccessor) { |
2965 if (!name.endsWith('=')) { | 2965 if (!name.endsWith('=')) { |
2966 return name + '?'; | 2966 return name + '?'; |
2967 } | 2967 } |
2968 } | 2968 } |
2969 return name; | 2969 return name; |
2970 } | 2970 } |
2971 } | 2971 } |
OLD | NEW |