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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 [argumentValue.type, fieldType]); | 647 [argumentValue.type, fieldType]); |
648 } | 648 } |
649 } | 649 } |
650 String fieldName = field.name; | 650 String fieldName = field.name; |
651 if (fieldMap.containsKey(fieldName)) { | 651 if (fieldMap.containsKey(fieldName)) { |
652 errorReporter.reportErrorForNode( | 652 errorReporter.reportErrorForNode( |
653 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node); | 653 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node); |
654 } | 654 } |
655 fieldMap[fieldName] = argumentValue; | 655 fieldMap[fieldName] = argumentValue; |
656 } | 656 } |
657 } else { | |
658 String name = baseParameter.name; | |
659 parameterMap[name] = argumentValue; | |
660 } | 657 } |
| 658 String name = baseParameter.name; |
| 659 parameterMap[name] = argumentValue; |
661 } | 660 } |
662 } | 661 } |
663 ConstantVisitor initializerVisitor = new ConstantVisitor( | 662 ConstantVisitor initializerVisitor = new ConstantVisitor( |
664 this, errorReporter, | 663 this, errorReporter, |
665 lexicalEnvironment: parameterMap); | 664 lexicalEnvironment: parameterMap); |
666 String superName = null; | 665 String superName = null; |
667 NodeList<Expression> superArguments = null; | 666 NodeList<Expression> superArguments = null; |
668 for (ConstructorInitializer initializer in initializers) { | 667 for (ConstructorInitializer initializer in initializers) { |
669 if (initializer is ConstructorFieldInitializer) { | 668 if (initializer is ConstructorFieldInitializer) { |
670 Expression initializerExpression = initializer.expression; | 669 Expression initializerExpression = initializer.expression; |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2079 } | 2078 } |
2080 | 2079 |
2081 @override | 2080 @override |
2082 String toString() { | 2081 String toString() { |
2083 if (value == null) { | 2082 if (value == null) { |
2084 return "error"; | 2083 return "error"; |
2085 } | 2084 } |
2086 return value.toString(); | 2085 return value.toString(); |
2087 } | 2086 } |
2088 } | 2087 } |
OLD | NEW |