| 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 2777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2788 func_name = func.name(); | 2788 func_name = func.name(); |
| 2789 bool is_setter = Field::IsSetterName(func_name); | 2789 bool is_setter = Field::IsSetterName(func_name); |
| 2790 func_name = IdentifierPrettyName(isolate, func_name); | 2790 func_name = IdentifierPrettyName(isolate, func_name); |
| 2791 if (is_setter) { | 2791 if (is_setter) { |
| 2792 func_name = AddExternalSetterSuffix(func_name); | 2792 func_name = AddExternalSetterSuffix(func_name); |
| 2793 } | 2793 } |
| 2794 return Api::NewHandle(isolate, func_name.raw()); | 2794 return Api::NewHandle(isolate, func_name.raw()); |
| 2795 } | 2795 } |
| 2796 | 2796 |
| 2797 | 2797 |
| 2798 DART_EXPORT Dart_Handle Dart_FunctionEnclosingClassOrLibrary( | 2798 DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function) { |
| 2799 Dart_Handle function) { | |
| 2800 Isolate* isolate = Isolate::Current(); | 2799 Isolate* isolate = Isolate::Current(); |
| 2801 DARTSCOPE(isolate); | 2800 DARTSCOPE(isolate); |
| 2802 const Function& func = Api::UnwrapFunctionHandle(isolate, function); | 2801 const Function& func = Api::UnwrapFunctionHandle(isolate, function); |
| 2803 if (func.IsNull()) { | 2802 if (func.IsNull()) { |
| 2804 RETURN_TYPE_ERROR(isolate, function, Function); | 2803 RETURN_TYPE_ERROR(isolate, function, Function); |
| 2805 } | 2804 } |
| 2805 if (func.IsNonImplicitClosureFunction()) { |
| 2806 RawFunction* parent_function = func.parent_function(); |
| 2807 return Api::NewHandle(isolate, parent_function); |
| 2808 } |
| 2806 const Class& owner = Class::Handle(func.owner()); | 2809 const Class& owner = Class::Handle(func.owner()); |
| 2807 ASSERT(!owner.IsNull()); | 2810 ASSERT(!owner.IsNull()); |
| 2808 if (owner.IsTopLevel()) { | 2811 if (owner.IsTopLevel()) { |
| 2809 // Top-level functions are implemented as members of a hidden class. We hide | 2812 // Top-level functions are implemented as members of a hidden class. We hide |
| 2810 // that class here and instead answer the library. | 2813 // that class here and instead answer the library. |
| 2811 #if defined(DEBUG) | 2814 #if defined(DEBUG) |
| 2812 const Library& lib = Library::Handle(owner.library()); | 2815 const Library& lib = Library::Handle(owner.library()); |
| 2813 if (lib.IsNull()) { | 2816 if (lib.IsNull()) { |
| 2814 ASSERT(owner.IsDynamicClass() || owner.IsVoidClass()); | 2817 ASSERT(owner.IsDynamicClass() || owner.IsVoidClass()); |
| 2815 } | 2818 } |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4201 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { | 4204 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { |
| 4202 Dart::set_perf_events_writer(function); | 4205 Dart::set_perf_events_writer(function); |
| 4203 } | 4206 } |
| 4204 | 4207 |
| 4205 | 4208 |
| 4206 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { | 4209 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { |
| 4207 Dart::set_flow_graph_writer(function); | 4210 Dart::set_flow_graph_writer(function); |
| 4208 } | 4211 } |
| 4209 | 4212 |
| 4210 } // namespace dart | 4213 } // namespace dart |
| OLD | NEW |