| 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 /** | 5 /** |
| 6 * The [ConstantHandler] keeps track of compile-time constants, | 6 * The [ConstantHandler] keeps track of compile-time constants, |
| 7 * initializations of global and static fields, and default values of | 7 * initializations of global and static fields, and default values of |
| 8 * optional parameters. | 8 * optional parameters. |
| 9 */ | 9 */ |
| 10 class ConstantHandler extends CompilerTask { | 10 class ConstantHandler extends CompilerTask { |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 */ | 792 */ |
| 793 void evaluateConstructorFieldValues(List<Constant> arguments) { | 793 void evaluateConstructorFieldValues(List<Constant> arguments) { |
| 794 compiler.withCurrentElement(constructor, () { | 794 compiler.withCurrentElement(constructor, () { |
| 795 assignArgumentsToParameters(arguments); | 795 assignArgumentsToParameters(arguments); |
| 796 evaluateConstructorInitializers(); | 796 evaluateConstructorInitializers(); |
| 797 }); | 797 }); |
| 798 } | 798 } |
| 799 | 799 |
| 800 List<Constant> buildJsNewArguments(ClassElement classElement) { | 800 List<Constant> buildJsNewArguments(ClassElement classElement) { |
| 801 List<Constant> jsNewArguments = <Constant>[]; | 801 List<Constant> jsNewArguments = <Constant>[]; |
| 802 classElement.forEachInstanceField( | 802 classElement.implementation.forEachInstanceField( |
| 803 includeBackendMembers: true, | 803 includeBackendMembers: true, |
| 804 includeSuperMembers: true, | 804 includeSuperMembers: true, |
| 805 f: (ClassElement enclosing, Element field) { | 805 f: (ClassElement enclosing, Element field) { |
| 806 Constant fieldValue = fieldValues[field]; | 806 Constant fieldValue = fieldValues[field]; |
| 807 if (fieldValue === null) { | 807 if (fieldValue === null) { |
| 808 // Use the default value. | 808 // Use the default value. |
| 809 fieldValue = compiler.compileConstant(field); | 809 fieldValue = compiler.compileConstant(field); |
| 810 } | 810 } |
| 811 jsNewArguments.add(fieldValue); | 811 jsNewArguments.add(fieldValue); |
| 812 }); | 812 }); |
| 813 return jsNewArguments; | 813 return jsNewArguments; |
| 814 } | 814 } |
| 815 } | 815 } |
| OLD | NEW |