OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart2js; | 5 part of dart2js; |
6 | 6 |
7 /** | 7 /** |
8 * The [ConstantHandler] keeps track of compile-time constants, | 8 * The [ConstantHandler] keeps track of compile-time constants, |
9 * initializations of global and static fields, and default values of | 9 * initializations of global and static fields, and default values of |
10 * optional parameters. | 10 * optional parameters. |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 } | 737 } |
738 | 738 |
739 class TryCompileTimeConstantEvaluator extends CompileTimeConstantEvaluator { | 739 class TryCompileTimeConstantEvaluator extends CompileTimeConstantEvaluator { |
740 TryCompileTimeConstantEvaluator(ConstantHandler handler, | 740 TryCompileTimeConstantEvaluator(ConstantHandler handler, |
741 TreeElements elements, | 741 TreeElements elements, |
742 Compiler compiler) | 742 Compiler compiler) |
743 : super(handler, elements, compiler, isConst: true); | 743 : super(handler, elements, compiler, isConst: true); |
744 | 744 |
745 error(Node node) { | 745 error(Node node) { |
746 // Just fail without reporting it anywhere. | 746 // Just fail without reporting it anywhere. |
747 throw new CompileTimeConstantError(MessageKind.NOT_A_COMPILE_TIME_CONSTANT); | 747 throw new CompileTimeConstantError( |
| 748 MessageKind.NOT_A_COMPILE_TIME_CONSTANT, const {}, |
| 749 compiler.terseDiagnostics); |
748 } | 750 } |
749 } | 751 } |
750 | 752 |
751 class ConstructorEvaluator extends CompileTimeConstantEvaluator { | 753 class ConstructorEvaluator extends CompileTimeConstantEvaluator { |
752 final FunctionElement constructor; | 754 final FunctionElement constructor; |
753 final Map<Element, Constant> definitions; | 755 final Map<Element, Constant> definitions; |
754 final Map<Element, Constant> fieldValues; | 756 final Map<Element, Constant> fieldValues; |
755 | 757 |
756 /** | 758 /** |
757 * Documentation wanted -- johnniwinther | 759 * Documentation wanted -- johnniwinther |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 if (fieldValue == null) { | 930 if (fieldValue == null) { |
929 // Use the default value. | 931 // Use the default value. |
930 fieldValue = handler.compileConstant(field); | 932 fieldValue = handler.compileConstant(field); |
931 } | 933 } |
932 jsNewArguments.add(fieldValue); | 934 jsNewArguments.add(fieldValue); |
933 }, | 935 }, |
934 includeSuperAndInjectedMembers: true); | 936 includeSuperAndInjectedMembers: true); |
935 return jsNewArguments; | 937 return jsNewArguments; |
936 } | 938 } |
937 } | 939 } |
OLD | NEW |