| 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.constant.evaluation; | 5 library analyzer.src.dart.constant.evaluation; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/context/declared_variables.dart'; | 9 import 'package:analyzer/context/declared_variables.dart'; |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 SimpleIdentifier name = initializer.constructorName; | 733 SimpleIdentifier name = initializer.constructorName; |
| 734 if (name != null) { | 734 if (name != null) { |
| 735 superName = name.name; | 735 superName = name.name; |
| 736 } | 736 } |
| 737 superArguments = initializer.argumentList.arguments; | 737 superArguments = initializer.argumentList.arguments; |
| 738 } else if (initializer is RedirectingConstructorInvocation) { | 738 } else if (initializer is RedirectingConstructorInvocation) { |
| 739 // This is a redirecting constructor, so just evaluate the constructor | 739 // This is a redirecting constructor, so just evaluate the constructor |
| 740 // it redirects to. | 740 // it redirects to. |
| 741 ConstructorElement constructor = initializer.staticElement; | 741 ConstructorElement constructor = initializer.staticElement; |
| 742 if (constructor != null && constructor.isConst) { | 742 if (constructor != null && constructor.isConst) { |
| 743 // Instantiate the constructor with the in-scope type arguments. |
| 744 constructor = ConstructorMember.from(constructor, definingClass); |
| 745 |
| 743 DartObjectImpl result = evaluateConstructorCall( | 746 DartObjectImpl result = evaluateConstructorCall( |
| 744 node, | 747 node, |
| 745 initializer.argumentList.arguments, | 748 initializer.argumentList.arguments, |
| 746 constructor, | 749 constructor, |
| 747 initializerVisitor, | 750 initializerVisitor, |
| 748 externalErrorReporter, | 751 externalErrorReporter, |
| 749 invocation: invocation); | 752 invocation: invocation); |
| 750 reportLocalErrorForRecordedExternalErrors(); | 753 reportLocalErrorForRecordedExternalErrors(); |
| 751 return result; | 754 return result; |
| 752 } | 755 } |
| (...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 } | 2130 } |
| 2128 | 2131 |
| 2129 @override | 2132 @override |
| 2130 String toString() { | 2133 String toString() { |
| 2131 if (value == null) { | 2134 if (value == null) { |
| 2132 return "error"; | 2135 return "error"; |
| 2133 } | 2136 } |
| 2134 return value.toString(); | 2137 return value.toString(); |
| 2135 } | 2138 } |
| 2136 } | 2139 } |
| OLD | NEW |