| 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 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 2716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2727 CURRENT_FUNC); | 2727 CURRENT_FUNC); |
| 2728 } | 2728 } |
| 2729 | 2729 |
| 2730 #if defined(DEBUG) | 2730 #if defined(DEBUG) |
| 2731 if (!func.IsNull()) { | 2731 if (!func.IsNull()) { |
| 2732 // We only provide access to a subset of function kinds. | 2732 // We only provide access to a subset of function kinds. |
| 2733 RawFunction::Kind func_kind = func.kind(); | 2733 RawFunction::Kind func_kind = func.kind(); |
| 2734 ASSERT(func_kind == RawFunction::kFunction || | 2734 ASSERT(func_kind == RawFunction::kFunction || |
| 2735 func_kind == RawFunction::kGetterFunction || | 2735 func_kind == RawFunction::kGetterFunction || |
| 2736 func_kind == RawFunction::kSetterFunction || | 2736 func_kind == RawFunction::kSetterFunction || |
| 2737 func_kind == RawFunction::kConstructor || | 2737 func_kind == RawFunction::kConstructor); |
| 2738 func_kind == RawFunction::kAbstract); | |
| 2739 } | 2738 } |
| 2740 #endif | 2739 #endif |
| 2741 return Api::NewHandle(isolate, func.raw()); | 2740 return Api::NewHandle(isolate, func.raw()); |
| 2742 } | 2741 } |
| 2743 | 2742 |
| 2744 | 2743 |
| 2745 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle) { | 2744 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle) { |
| 2746 return Api::ClassId(handle) == kFunction; | 2745 return Api::ClassId(handle) == kFunction; |
| 2747 } | 2746 } |
| 2748 | 2747 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2769 bool* is_abstract) { | 2768 bool* is_abstract) { |
| 2770 Isolate* isolate = Isolate::Current(); | 2769 Isolate* isolate = Isolate::Current(); |
| 2771 DARTSCOPE(isolate); | 2770 DARTSCOPE(isolate); |
| 2772 if (is_abstract == NULL) { | 2771 if (is_abstract == NULL) { |
| 2773 RETURN_NULL_ERROR(is_abstract); | 2772 RETURN_NULL_ERROR(is_abstract); |
| 2774 } | 2773 } |
| 2775 const Function& func = Api::UnwrapFunctionHandle(isolate, function); | 2774 const Function& func = Api::UnwrapFunctionHandle(isolate, function); |
| 2776 if (func.IsNull()) { | 2775 if (func.IsNull()) { |
| 2777 RETURN_TYPE_ERROR(isolate, function, Function); | 2776 RETURN_TYPE_ERROR(isolate, function, Function); |
| 2778 } | 2777 } |
| 2779 *is_abstract = (func.kind() == RawFunction::kAbstract); | 2778 *is_abstract = func.is_abstract(); |
| 2780 return Api::Success(isolate); | 2779 return Api::Success(isolate); |
| 2781 } | 2780 } |
| 2782 | 2781 |
| 2783 | 2782 |
| 2784 DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, | 2783 DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, |
| 2785 bool* is_static) { | 2784 bool* is_static) { |
| 2786 Isolate* isolate = Isolate::Current(); | 2785 Isolate* isolate = Isolate::Current(); |
| 2787 DARTSCOPE(isolate); | 2786 DARTSCOPE(isolate); |
| 2788 if (is_static == NULL) { | 2787 if (is_static == NULL) { |
| 2789 RETURN_NULL_ERROR(is_static); | 2788 RETURN_NULL_ERROR(is_static); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2817 bool* is_getter) { | 2816 bool* is_getter) { |
| 2818 Isolate* isolate = Isolate::Current(); | 2817 Isolate* isolate = Isolate::Current(); |
| 2819 DARTSCOPE(isolate); | 2818 DARTSCOPE(isolate); |
| 2820 if (is_getter == NULL) { | 2819 if (is_getter == NULL) { |
| 2821 RETURN_NULL_ERROR(is_getter); | 2820 RETURN_NULL_ERROR(is_getter); |
| 2822 } | 2821 } |
| 2823 const Function& func = Api::UnwrapFunctionHandle(isolate, function); | 2822 const Function& func = Api::UnwrapFunctionHandle(isolate, function); |
| 2824 if (func.IsNull()) { | 2823 if (func.IsNull()) { |
| 2825 RETURN_TYPE_ERROR(isolate, function, Function); | 2824 RETURN_TYPE_ERROR(isolate, function, Function); |
| 2826 } | 2825 } |
| 2827 // TODO(turnidge): It would be nice if I could just use func.kind() | 2826 *is_getter = (func.kind() == RawFunction::kGetterFunction); |
| 2828 // to check for a getter function here, but unfortunately the only | |
| 2829 // way to distinguish abstract getter functions is to use the name | |
| 2830 // itself. Consider adding a RawFunction::kAbstractGetter type. | |
| 2831 const String& func_name = String::Handle(isolate, func.name()); | |
| 2832 *is_getter = Field::IsGetterName(func_name); | |
| 2833 | |
| 2834 return Api::Success(isolate); | 2827 return Api::Success(isolate); |
| 2835 } | 2828 } |
| 2836 | 2829 |
| 2837 | 2830 |
| 2838 DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function, | 2831 DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function, |
| 2839 bool* is_setter) { | 2832 bool* is_setter) { |
| 2840 Isolate* isolate = Isolate::Current(); | 2833 Isolate* isolate = Isolate::Current(); |
| 2841 DARTSCOPE(isolate); | 2834 DARTSCOPE(isolate); |
| 2842 if (is_setter == NULL) { | 2835 if (is_setter == NULL) { |
| 2843 RETURN_NULL_ERROR(is_setter); | 2836 RETURN_NULL_ERROR(is_setter); |
| 2844 } | 2837 } |
| 2845 const Function& func = Api::UnwrapFunctionHandle(isolate, function); | 2838 const Function& func = Api::UnwrapFunctionHandle(isolate, function); |
| 2846 if (func.IsNull()) { | 2839 if (func.IsNull()) { |
| 2847 RETURN_TYPE_ERROR(isolate, function, Function); | 2840 RETURN_TYPE_ERROR(isolate, function, Function); |
| 2848 } | 2841 } |
| 2849 // TODO(turnidge): It would be nice if I could just use func.kind() | 2842 *is_setter = (func.kind() == RawFunction::kSetterFunction); |
| 2850 // to check for a setter function here, but unfortunately the only | |
| 2851 // way to distinguish abstract setter functions is to use the name | |
| 2852 // itself. Consider adding a RawFunction::kAbstractSetter type. | |
| 2853 const String& func_name = String::Handle(isolate, func.name()); | |
| 2854 *is_setter = Field::IsSetterName(func_name); | |
| 2855 | |
| 2856 return Api::Success(isolate); | 2843 return Api::Success(isolate); |
| 2857 } | 2844 } |
| 2858 | 2845 |
| 2859 | 2846 |
| 2860 DART_EXPORT Dart_Handle Dart_FunctionParameterCounts( | 2847 DART_EXPORT Dart_Handle Dart_FunctionParameterCounts( |
| 2861 Dart_Handle function, | 2848 Dart_Handle function, |
| 2862 int64_t* fixed_param_count, | 2849 int64_t* fixed_param_count, |
| 2863 int64_t* opt_param_count) { | 2850 int64_t* opt_param_count) { |
| 2864 Isolate* isolate = Isolate::Current(); | 2851 Isolate* isolate = Isolate::Current(); |
| 2865 DARTSCOPE(isolate); | 2852 DARTSCOPE(isolate); |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4148 *buffer_size = 0; | 4135 *buffer_size = 0; |
| 4149 } | 4136 } |
| 4150 } | 4137 } |
| 4151 | 4138 |
| 4152 | 4139 |
| 4153 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { | 4140 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { |
| 4154 Dart::set_flow_graph_writer(function); | 4141 Dart::set_flow_graph_writer(function); |
| 4155 } | 4142 } |
| 4156 | 4143 |
| 4157 } // namespace dart | 4144 } // namespace dart |
| OLD | NEW |