| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 /** | 1820 /** |
| 1821 * Initialize using the given serialized information. | 1821 * Initialize using the given serialized information. |
| 1822 */ | 1822 */ |
| 1823 DefaultParameterElementImpl.forSerialized( | 1823 DefaultParameterElementImpl.forSerialized( |
| 1824 UnlinkedParam unlinkedParam, ElementImpl enclosingElement) | 1824 UnlinkedParam unlinkedParam, ElementImpl enclosingElement) |
| 1825 : super.forSerialized(unlinkedParam, enclosingElement); | 1825 : super.forSerialized(unlinkedParam, enclosingElement); |
| 1826 | 1826 |
| 1827 @override | 1827 @override |
| 1828 Expression get constantInitializer { | 1828 Expression get constantInitializer { |
| 1829 if (_unlinkedParam != null) { | 1829 if (_unlinkedParam != null) { |
| 1830 UnlinkedConst defaultValue = _unlinkedParam.defaultValue; | 1830 UnlinkedConst defaultValue = _unlinkedParam.initializer?.bodyExpr; |
| 1831 if (defaultValue == null) { | 1831 if (defaultValue == null) { |
| 1832 return null; | 1832 return null; |
| 1833 } | 1833 } |
| 1834 return super.constantInitializer ??= enclosingUnit.resynthesizerContext | 1834 return super.constantInitializer ??= enclosingUnit.resynthesizerContext |
| 1835 .buildExpression(this, defaultValue); | 1835 .buildExpression(this, defaultValue); |
| 1836 } | 1836 } |
| 1837 return super.constantInitializer; | 1837 return super.constantInitializer; |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 @override | 1840 @override |
| (...skipping 3900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5741 | 5741 |
| 5742 @override | 5742 @override |
| 5743 void set const3(bool isConst) { | 5743 void set const3(bool isConst) { |
| 5744 assert(_unlinkedParam == null); | 5744 assert(_unlinkedParam == null); |
| 5745 super.const3 = isConst; | 5745 super.const3 = isConst; |
| 5746 } | 5746 } |
| 5747 | 5747 |
| 5748 @override | 5748 @override |
| 5749 String get defaultValueCode { | 5749 String get defaultValueCode { |
| 5750 if (_unlinkedParam != null) { | 5750 if (_unlinkedParam != null) { |
| 5751 if (_unlinkedParam.defaultValue == null) { | 5751 if (_unlinkedParam.initializer?.bodyExpr == null) { |
| 5752 return null; | 5752 return null; |
| 5753 } | 5753 } |
| 5754 return _unlinkedParam.defaultValueCode; | 5754 return _unlinkedParam.defaultValueCode; |
| 5755 } | 5755 } |
| 5756 return _defaultValueCode; | 5756 return _defaultValueCode; |
| 5757 } | 5757 } |
| 5758 | 5758 |
| 5759 /** | 5759 /** |
| 5760 * Set Dart code of the default value. | 5760 * Set Dart code of the default value. |
| 5761 */ | 5761 */ |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6922 | 6922 |
| 6923 @override | 6923 @override |
| 6924 void visitElement(Element element) { | 6924 void visitElement(Element element) { |
| 6925 int offset = element.nameOffset; | 6925 int offset = element.nameOffset; |
| 6926 if (offset != -1) { | 6926 if (offset != -1) { |
| 6927 map[offset] = element; | 6927 map[offset] = element; |
| 6928 } | 6928 } |
| 6929 super.visitElement(element); | 6929 super.visitElement(element); |
| 6930 } | 6930 } |
| 6931 } | 6931 } |
| OLD | NEW |