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

Side by Side Diff: runtime/lib/mirrors.cc

Issue 196513004: Clean up ClosureMirror.invoke(#call, ...). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: adapt to alternate implementation of closure.call Created 6 years, 9 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 | « no previous file | runtime/lib/mirrors_impl.dart » ('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 "lib/invocation_mirror.h" 5 #include "lib/invocation_mirror.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 1543
1544 DEFINE_NATIVE_ENTRY(InstanceMirror_computeType, 1) { 1544 DEFINE_NATIVE_ENTRY(InstanceMirror_computeType, 1) {
1545 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); 1545 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0));
1546 const Type& type = Type::Handle(instance.GetType()); 1546 const Type& type = Type::Handle(instance.GetType());
1547 // The static type of null is specified to be the bottom type, however, the 1547 // The static type of null is specified to be the bottom type, however, the
1548 // runtime type of null is the Null type, which we correctly return here. 1548 // runtime type of null is the Null type, which we correctly return here.
1549 return type.Canonicalize(); 1549 return type.Canonicalize();
1550 } 1550 }
1551 1551
1552 1552
1553 DEFINE_NATIVE_ENTRY(ClosureMirror_apply, 2) {
1554 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(0));
1555 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(1));
1556
1557 const Array& args_descriptor =
1558 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names));
1559
1560 const Object& result =
1561 Object::Handle(DartEntry::InvokeClosure(args, args_descriptor));
1562 if (result.IsError()) {
1563 ThrowInvokeError(Error::Cast(result));
1564 UNREACHABLE();
1565 }
1566 return result.raw();
1567 }
1568
1569
1570 DEFINE_NATIVE_ENTRY(ClosureMirror_find_in_context, 2) { 1553 DEFINE_NATIVE_ENTRY(ClosureMirror_find_in_context, 2) {
1571 if (!FLAG_support_find_in_context) { 1554 if (!FLAG_support_find_in_context) {
1572 return Object::empty_array().raw(); 1555 return Object::empty_array().raw();
1573 } 1556 }
1574 1557
1575 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0)); 1558 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
1576 GET_NON_NULL_NATIVE_ARGUMENT(Array, lookup_parts, arguments->NativeArgAt(1)); 1559 GET_NON_NULL_NATIVE_ARGUMENT(Array, lookup_parts, arguments->NativeArgAt(1));
1577 ASSERT(lookup_parts.Length() >= 1 && lookup_parts.Length() <= 3); 1560 ASSERT(lookup_parts.Length() >= 1 && lookup_parts.Length() <= 3);
1578 1561
1579 if (!closure.IsClosure()) { 1562 if (!closure.IsClosure()) {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 } 2195 }
2213 2196
2214 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { 2197 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) {
2215 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); 2198 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0));
2216 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); 2199 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1));
2217 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); 2200 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw();
2218 } 2201 }
2219 2202
2220 2203
2221 } // namespace dart 2204 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698