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 dart2js.js_emitter.program_builder; | 5 library dart2js.js_emitter.program_builder; |
6 | 6 |
7 import '../../closure.dart' show ClosureFieldElement; | 7 import '../../closure.dart' show ClosureFieldElement; |
8 import '../../common.dart'; | 8 import '../../common.dart'; |
9 import '../../common/names.dart' show Names, Selectors; | 9 import '../../common/names.dart' show Names, Selectors; |
10 import '../../compiler.dart' show Compiler; | 10 import '../../compiler.dart' show Compiler; |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 return _buildStaticMethod(element); | 683 return _buildStaticMethod(element); |
684 } | 684 } |
685 } | 685 } |
686 | 686 |
687 /* Map | List */ _computeParameterDefaultValues(FunctionSignature signature) { | 687 /* Map | List */ _computeParameterDefaultValues(FunctionSignature signature) { |
688 var /* Map | List */ optionalParameterDefaultValues; | 688 var /* Map | List */ optionalParameterDefaultValues; |
689 if (signature.optionalParametersAreNamed) { | 689 if (signature.optionalParametersAreNamed) { |
690 optionalParameterDefaultValues = new Map<String, ConstantValue>(); | 690 optionalParameterDefaultValues = new Map<String, ConstantValue>(); |
691 signature.forEachOptionalParameter((ParameterElement parameter) { | 691 signature.forEachOptionalParameter((ParameterElement parameter) { |
692 ConstantValue def = | 692 ConstantValue def = |
693 backend.constants.getConstantValueForVariable(parameter); | 693 backend.constants.getConstantValue(parameter.constant); |
694 optionalParameterDefaultValues[parameter.name] = def; | 694 optionalParameterDefaultValues[parameter.name] = def; |
695 }); | 695 }); |
696 } else { | 696 } else { |
697 optionalParameterDefaultValues = <ConstantValue>[]; | 697 optionalParameterDefaultValues = <ConstantValue>[]; |
698 signature.forEachOptionalParameter((ParameterElement parameter) { | 698 signature.forEachOptionalParameter((ParameterElement parameter) { |
699 ConstantValue def = | 699 ConstantValue def = |
700 backend.constants.getConstantValueForVariable(parameter); | 700 backend.constants.getConstantValue(parameter.constant); |
701 optionalParameterDefaultValues.add(def); | 701 optionalParameterDefaultValues.add(def); |
702 }); | 702 }); |
703 } | 703 } |
704 return optionalParameterDefaultValues; | 704 return optionalParameterDefaultValues; |
705 } | 705 } |
706 | 706 |
707 DartMethod _buildMethod(MethodElement element) { | 707 DartMethod _buildMethod(MethodElement element) { |
708 js.Name name = namer.methodPropertyName(element); | 708 js.Name name = namer.methodPropertyName(element); |
709 js.Expression code = backend.generatedCode[element]; | 709 js.Expression code = backend.generatedCode[element]; |
710 | 710 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 Constant constant = new Constant(name, holder, constantValue); | 975 Constant constant = new Constant(name, holder, constantValue); |
976 _constants[constantValue] = constant; | 976 _constants[constantValue] = constant; |
977 } | 977 } |
978 } | 978 } |
979 | 979 |
980 Holder _registerStaticStateHolder() { | 980 Holder _registerStaticStateHolder() { |
981 return _registry.registerHolder(namer.staticStateHolder, | 981 return _registry.registerHolder(namer.staticStateHolder, |
982 isStaticStateHolder: true); | 982 isStaticStateHolder: true); |
983 } | 983 } |
984 } | 984 } |
OLD | NEW |