Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 10800065: Added ClosureMirror to dart:mirrors. Added Dart_ClosureFunction to the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2385 DART_EXPORT bool Dart_IsClosure(Dart_Handle object) { 2385 DART_EXPORT bool Dart_IsClosure(Dart_Handle object) {
2386 // We can't use a fast class index check here because there are many 2386 // We can't use a fast class index check here because there are many
2387 // different signature classes for closures. 2387 // different signature classes for closures.
2388 Isolate* isolate = Isolate::Current(); 2388 Isolate* isolate = Isolate::Current();
2389 DARTSCOPE(isolate); 2389 DARTSCOPE(isolate);
2390 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); 2390 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
2391 return obj.IsClosure(); 2391 return obj.IsClosure();
2392 } 2392 }
2393 2393
2394 2394
2395 DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) {
2396 Isolate* isolate = Isolate::Current();
2397 DARTSCOPE(isolate);
2398 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(closure));
2399 if (obj.IsNull()) {
2400 return Api::NewError("Null object passed to Dart_ClosureFunction");
2401 }
2402 if (!obj.IsClosure()) {
2403 return Api::NewError("Invalid closure passed to Dart_ClosureFunction");
2404 }
2405 ASSERT(ClassFinalizer::AllClassesFinalized());
2406
2407 const Closure& closure_obj = Closure::Cast(obj);
2408 RawFunction* rf = closure_obj.function();
2409 return Api::NewHandle(isolate, rf);
2410 }
2411
2412
2395 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, 2413 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure,
2396 int number_of_arguments, 2414 int number_of_arguments,
2397 Dart_Handle* arguments) { 2415 Dart_Handle* arguments) {
2398 Isolate* isolate = Isolate::Current(); 2416 Isolate* isolate = Isolate::Current();
2399 DARTSCOPE(isolate); 2417 DARTSCOPE(isolate);
2400 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(closure)); 2418 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(closure));
2401 if (obj.IsNull()) { 2419 if (obj.IsNull()) {
2402 return Api::NewError("Null object passed in to invoke closure"); 2420 return Api::NewError("Null object passed in to invoke closure");
2403 } 2421 }
2404 if (!obj.IsClosure()) { 2422 if (!obj.IsClosure()) {
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
4150 *buffer_size = 0; 4168 *buffer_size = 0;
4151 } 4169 }
4152 } 4170 }
4153 4171
4154 4172
4155 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) { 4173 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function) {
4156 Dart::set_flow_graph_writer(function); 4174 Dart::set_flow_graph_writer(function);
4157 } 4175 }
4158 4176
4159 } // namespace dart 4177 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698