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

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

Issue 114713002: VM: Support calling through getters in InstanceMirror.delegate. Implement without accessing private… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync Created 7 years 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/lib/corelib_sources.gypi ('k') | runtime/lib/invocation_mirror_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #include "vm/bootstrap_natives.h"
6
7 #include "vm/compiler.h"
8 #include "vm/dart_entry.h"
9 #include "vm/exceptions.h"
10 #include "vm/native_entry.h"
11 #include "vm/object_store.h"
12 #include "vm/resolver.h"
13 #include "vm/symbols.h"
14
15 namespace dart {
16
17 DEFINE_NATIVE_ENTRY(InvocationMirror_invoke, 4) {
18 const Instance& receiver = Instance::CheckedHandle(arguments->NativeArgAt(0));
19 const String& fun_name = String::CheckedHandle(arguments->NativeArgAt(1));
20 const Array& fun_args_desc = Array::CheckedHandle(arguments->NativeArgAt(2));
21 const Array& fun_arguments = Array::CheckedHandle(arguments->NativeArgAt(3));
22
23 // Allocate a fixed-length array duplicating the original function arguments
24 // and replace the receiver.
25 const int num_arguments = fun_arguments.Length();
26 const Array& invoke_arguments = Array::Handle(Array::New(num_arguments));
27 invoke_arguments.SetAt(0, receiver);
28 Object& arg = Object::Handle();
29 for (int i = 1; i < num_arguments; i++) {
30 arg = fun_arguments.At(i);
31 invoke_arguments.SetAt(i, arg);
32 }
33 // Resolve dynamic function given by name.
34 const ArgumentsDescriptor args_desc(fun_args_desc);
35 const Function& function = Function::Handle(
36 Resolver::ResolveDynamic(receiver,
37 fun_name,
38 args_desc));
39 Object& result = Object::Handle();
40 if (function.IsNull()) {
41 result = DartEntry::InvokeNoSuchMethod(receiver,
42 fun_name,
43 invoke_arguments,
44 fun_args_desc);
45 } else {
46 result = DartEntry::InvokeFunction(function,
47 invoke_arguments,
48 fun_args_desc);
49 }
50 if (result.IsError()) {
51 Exceptions::PropagateError(Error::Cast(result));
52 }
53 return result.raw();
54 }
55
56 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/corelib_sources.gypi ('k') | runtime/lib/invocation_mirror_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698