OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 _js_helper; | 5 library _js_helper; |
6 | 6 |
7 import 'dart:_js_embedded_names' show | 7 import 'dart:_js_embedded_names' show |
8 DEFERRED_LIBRARY_URIS, | 8 DEFERRED_LIBRARY_URIS, |
9 DEFERRED_LIBRARY_HASHES, | 9 DEFERRED_LIBRARY_HASHES, |
10 GET_TYPE_FROM_NAME, | 10 GET_TYPE_FROM_NAME, |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 | 607 |
608 List<int> parameterMetadataAnnotations(int parameter) { | 608 List<int> parameterMetadataAnnotations(int parameter) { |
609 if (!JS_GET_FLAG('MUST_RETAIN_METADATA')) { | 609 if (!JS_GET_FLAG('MUST_RETAIN_METADATA')) { |
610 throw new StateError('metadata has not been preserved'); | 610 throw new StateError('metadata has not been preserved'); |
611 } else { | 611 } else { |
612 return JS('', '#[2 * # + # + # + 1]', data, parameter, | 612 return JS('', '#[2 * # + # + # + 1]', data, parameter, |
613 optionalParameterCount, FIRST_DEFAULT_ARGUMENT); | 613 optionalParameterCount, FIRST_DEFAULT_ARGUMENT); |
614 } | 614 } |
615 } | 615 } |
616 | 616 |
| 617 bool isFieldInitializerParameter(int parameter) { |
| 618 if (!JS_GET_FLAG('MUST_RETAIN_METADATA')) { |
| 619 throw new StateError('metadata has not been preserved'); |
| 620 } else { |
| 621 return JS('bool', '#[2 * # + 2*# + # + # + 1]', data, parameter, |
| 622 optionalParameterCount, requiredParameterCount, FIRST_DEFAULT_ARGUMENT
); |
| 623 } |
| 624 } |
| 625 |
617 int defaultValue(int parameter) { | 626 int defaultValue(int parameter) { |
618 if (parameter < requiredParameterCount) return null; | 627 if (parameter < requiredParameterCount) return null; |
619 return JS('int', '#[# + # - #]', data, | 628 return JS('int', '#[# + # - #]', data, |
620 FIRST_DEFAULT_ARGUMENT, parameter, requiredParameterCount); | 629 FIRST_DEFAULT_ARGUMENT, parameter, requiredParameterCount); |
621 } | 630 } |
622 | 631 |
623 /// Returns the default value of the [parameter]th entry of the list of | 632 /// Returns the default value of the [parameter]th entry of the list of |
624 /// parameters sorted by name. | 633 /// parameters sorted by name. |
625 int defaultValueInOrder(int parameter) { | 634 int defaultValueInOrder(int parameter) { |
626 if (parameter < requiredParameterCount) return null; | 635 if (parameter < requiredParameterCount) return null; |
(...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3961 throw new MainError("No top-level function named 'main'."); | 3970 throw new MainError("No top-level function named 'main'."); |
3962 } | 3971 } |
3963 | 3972 |
3964 void badMain() { | 3973 void badMain() { |
3965 throw new MainError("'main' is not a function."); | 3974 throw new MainError("'main' is not a function."); |
3966 } | 3975 } |
3967 | 3976 |
3968 void mainHasTooManyParameters() { | 3977 void mainHasTooManyParameters() { |
3969 throw new MainError("'main' expects too many parameters."); | 3978 throw new MainError("'main' expects too many parameters."); |
3970 } | 3979 } |
OLD | NEW |