| 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 // We've already checked that the argument can be assigned to the | 740 // We've already checked that the argument can be assigned to the |
| 741 // parameter; we also need to check that it can be assigned to | 741 // parameter; we also need to check that it can be assigned to |
| 742 // the field. | 742 // the field. |
| 743 if (!runtimeTypeMatch(argumentValue, fieldType)) { | 743 if (!runtimeTypeMatch(argumentValue, fieldType)) { |
| 744 errorReporter.reportErrorForNode( | 744 errorReporter.reportErrorForNode( |
| 745 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE
_MISMATCH, | 745 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE
_MISMATCH, |
| 746 errorTarget, [argumentValue.type, fieldType]); | 746 errorTarget, [argumentValue.type, fieldType]); |
| 747 } | 747 } |
| 748 } | 748 } |
| 749 String fieldName = field.name; | 749 String fieldName = field.name; |
| 750 if (fieldMap.containsKey(fieldName)) { |
| 751 errorReporter.reportErrorForNode( |
| 752 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node); |
| 753 } |
| 750 fieldMap[fieldName] = argumentValue; | 754 fieldMap[fieldName] = argumentValue; |
| 751 } | 755 } |
| 752 } else { | 756 } else { |
| 753 String name = baseParameter.name; | 757 String name = baseParameter.name; |
| 754 parameterMap[name] = argumentValue; | 758 parameterMap[name] = argumentValue; |
| 755 } | 759 } |
| 756 } | 760 } |
| 757 } | 761 } |
| 758 ConstantVisitor initializerVisitor = new ConstantVisitor( | 762 ConstantVisitor initializerVisitor = new ConstantVisitor( |
| 759 this, errorReporter, lexicalEnvironment: parameterMap); | 763 this, errorReporter, lexicalEnvironment: parameterMap); |
| 760 String superName = null; | 764 String superName = null; |
| 761 NodeList<Expression> superArguments = null; | 765 NodeList<Expression> superArguments = null; |
| 762 for (ConstructorInitializer initializer in initializers) { | 766 for (ConstructorInitializer initializer in initializers) { |
| 763 if (initializer is ConstructorFieldInitializer) { | 767 if (initializer is ConstructorFieldInitializer) { |
| 764 ConstructorFieldInitializer constructorFieldInitializer = initializer; | 768 ConstructorFieldInitializer constructorFieldInitializer = initializer; |
| 765 Expression initializerExpression = | 769 Expression initializerExpression = |
| 766 constructorFieldInitializer.expression; | 770 constructorFieldInitializer.expression; |
| 767 DartObjectImpl evaluationResult = | 771 DartObjectImpl evaluationResult = |
| 768 initializerExpression.accept(initializerVisitor); | 772 initializerExpression.accept(initializerVisitor); |
| 769 if (evaluationResult != null) { | 773 if (evaluationResult != null) { |
| 770 String fieldName = constructorFieldInitializer.fieldName.name; | 774 String fieldName = constructorFieldInitializer.fieldName.name; |
| 775 if (fieldMap.containsKey(fieldName)) { |
| 776 errorReporter.reportErrorForNode( |
| 777 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node); |
| 778 } |
| 771 fieldMap[fieldName] = evaluationResult; | 779 fieldMap[fieldName] = evaluationResult; |
| 772 PropertyAccessorElement getter = definingClass.getGetter(fieldName); | 780 PropertyAccessorElement getter = definingClass.getGetter(fieldName); |
| 773 if (getter != null) { | 781 if (getter != null) { |
| 774 PropertyInducingElement field = getter.variable; | 782 PropertyInducingElement field = getter.variable; |
| 775 if (!runtimeTypeMatch(evaluationResult, field.type)) { | 783 if (!runtimeTypeMatch(evaluationResult, field.type)) { |
| 776 errorReporter.reportErrorForNode( | 784 errorReporter.reportErrorForNode( |
| 777 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_M
ISMATCH, | 785 CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_M
ISMATCH, |
| 778 node, [evaluationResult.type, fieldName, field.type]); | 786 node, [evaluationResult.type, fieldName, field.type]); |
| 779 } | 787 } |
| 780 } | 788 } |
| (...skipping 4461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5242 return BoolState.from(_element == rightElement); | 5250 return BoolState.from(_element == rightElement); |
| 5243 } else if (rightOperand is DynamicState) { | 5251 } else if (rightOperand is DynamicState) { |
| 5244 return BoolState.UNKNOWN_VALUE; | 5252 return BoolState.UNKNOWN_VALUE; |
| 5245 } | 5253 } |
| 5246 return BoolState.FALSE_STATE; | 5254 return BoolState.FALSE_STATE; |
| 5247 } | 5255 } |
| 5248 | 5256 |
| 5249 @override | 5257 @override |
| 5250 String toString() => _element == null ? "-unknown-" : _element.name; | 5258 String toString() => _element == null ? "-unknown-" : _element.name; |
| 5251 } | 5259 } |
| OLD | NEW |