Chromium Code Reviews| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.constant; | 8 library engine.constant; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 String superName = null; | 768 String superName = null; |
| 769 NodeList<Expression> superArguments = null; | 769 NodeList<Expression> superArguments = null; |
| 770 for (ConstructorInitializer initializer in initializers) { | 770 for (ConstructorInitializer initializer in initializers) { |
| 771 if (initializer is ConstructorFieldInitializer) { | 771 if (initializer is ConstructorFieldInitializer) { |
| 772 ConstructorFieldInitializer constructorFieldInitializer = initializer; | 772 ConstructorFieldInitializer constructorFieldInitializer = initializer; |
| 773 Expression initializerExpression = constructorFieldInitializer.expressio n; | 773 Expression initializerExpression = constructorFieldInitializer.expressio n; |
| 774 DartObjectImpl evaluationResult = initializerExpression.accept(initializ erVisitor); | 774 DartObjectImpl evaluationResult = initializerExpression.accept(initializ erVisitor); |
| 775 if (evaluationResult != null) { | 775 if (evaluationResult != null) { |
| 776 String fieldName = constructorFieldInitializer.fieldName.name; | 776 String fieldName = constructorFieldInitializer.fieldName.name; |
| 777 fieldMap[fieldName] = evaluationResult; | 777 fieldMap[fieldName] = evaluationResult; |
| 778 PropertyAccessorElement getter = definingClass.getGetter(fieldName); | |
|
Brian Wilkerson
2014/10/12 20:20:42
Seems like we should need to check for "getter !=
Paul Berry
2014/10/13 15:55:33
That's a good point. I'll add tests for these cas
| |
| 779 PropertyInducingElement field = getter.variable; | |
| 780 if (!evaluationResult.isNull && | |
| 781 !evaluationResult.type.isSubtypeOf(field.type)) { | |
| 782 errorReporter.reportErrorForNode( | |
| 783 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MIS MATCH, | |
| 784 node, [evaluationResult.type, fieldName, field.type]); | |
| 785 } | |
| 778 } | 786 } |
| 779 } else if (initializer is SuperConstructorInvocation) { | 787 } else if (initializer is SuperConstructorInvocation) { |
| 780 SuperConstructorInvocation superConstructorInvocation = initializer; | 788 SuperConstructorInvocation superConstructorInvocation = initializer; |
| 781 SimpleIdentifier name = superConstructorInvocation.constructorName; | 789 SimpleIdentifier name = superConstructorInvocation.constructorName; |
| 782 if (name != null) { | 790 if (name != null) { |
| 783 superName = name.name; | 791 superName = name.name; |
| 784 } | 792 } |
| 785 superArguments = superConstructorInvocation.argumentList.arguments; | 793 superArguments = superConstructorInvocation.argumentList.arguments; |
| 786 } | 794 } |
| 787 } | 795 } |
| (...skipping 3846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4634 | 4642 |
| 4635 @override | 4643 @override |
| 4636 String get typeName => "Type"; | 4644 String get typeName => "Type"; |
| 4637 | 4645 |
| 4638 @override | 4646 @override |
| 4639 int get hashCode => _element == null ? 0 : _element.hashCode; | 4647 int get hashCode => _element == null ? 0 : _element.hashCode; |
| 4640 | 4648 |
| 4641 @override | 4649 @override |
| 4642 String toString() => _element == null ? "-unknown-" : _element.name; | 4650 String toString() => _element == null ? "-unknown-" : _element.name; |
| 4643 } | 4651 } |
| OLD | NEW |