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

Side by Side Diff: runtime/lib/invocation_mirror_patch.dart

Issue 11523002: Pass the proper invocation mirror argument to noSuchMethod. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
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 class _InvocationMirror implements InvocationMirror { 5 class _InvocationMirror implements InvocationMirror {
6 static final int METHOD = 0; 6 static final int METHOD = 0;
7 static final int GETTER = 1; 7 static final int GETTER = 1;
8 static final int SETTER = 2; 8 static final int SETTER = 2;
9 9
10 // TODO(regis): For efficiency, make these fields caches of getters and keep
11 // the internal representation as an array of positional arguments and an
12 // arguments descriptor.
srdjan 2012/12/10 23:55:39 Maybe change comment, something like: Compute laz
regis 2012/12/11 00:11:04 Done.
13
10 final String memberName; 14 final String memberName;
11 final List positionalArguments; 15 final List positionalArguments;
12 final Map<String,dynamic> namedArguments = null; 16 final Map<String, dynamic> namedArguments;
13 17
14 final int _type; 18 final int _type;
15 19
16 _InvocationMirror(this.memberName, this._type, this.positionalArguments); 20 _InvocationMirror(this.memberName,
21 this._type,
22 this.positionalArguments,
23 this.namedArguments);
17 24
18 static _allocateInvocationMirror(name, arguments) { 25 static _allocateInvocationMirror(name, argumentsDescriptor, arguments) {
srdjan 2012/12/10 23:55:39 Add types (result and arguments).
regis 2012/12/11 00:11:04 The types were omitted on purpose, since this is a
19 return new _InvocationMirror(name, METHOD, arguments); 26 var memberName;
27 var type;
28 if (name.startsWith("get:")) {
29 type = GETTER;
30 memberName = name.substring(4);
31 } else if (name.startsWith("set:")) {
32 type = SETTER;
33 memberName = name.substring(4).concat("=");
34 } else {
35 type = METHOD;
36 memberName = name;
37 }
38 // Exclude receiver.
39 int numArguments = argumentsDescriptor[0] - 1;
40 int numPositionalArguments = argumentsDescriptor[1] - 1;
41 int numNamedArguments = numArguments - numPositionalArguments;
42 List positionalArguments = arguments.getRange(1, numPositionalArguments);
43 Map<String, dynamic> namedArguments;
44 if (numNamedArguments > 0) {
45 namedArguments = new Map<String, dynamic>();
46 for (int i = 0; i < numNamedArguments; i++) {
47 String arg_name = argumentsDescriptor[2 + 2*i];
48 var arg_value = arguments[argumentsDescriptor[3 + 2*i]];
49 namedArguments[arg_name] = arg_value;
50 }
51 }
52 return new _InvocationMirror(memberName, type,
53 positionalArguments, namedArguments);
20 } 54 }
21 55
22 bool get isMethod => _type == METHOD; 56 bool get isMethod => _type == METHOD;
23 bool get isAccessor => _type != METHOD; 57 bool get isAccessor => _type != METHOD;
24 bool get isGetter => _type == GETTER; 58 bool get isGetter => _type == GETTER;
25 bool get isSetter => _type == SETTER; 59 bool get isSetter => _type == SETTER;
26 60
27 invokeOn(Object receiver) { 61 invokeOn(Object receiver) {
28 throw new UnsupportedError("invokeOn not implemented yet"); 62 throw new UnsupportedError("invokeOn not implemented yet");
29 } 63 }
30 } 64 }
31 65
OLDNEW
« no previous file with comments | « runtime/lib/error.dart ('k') | runtime/lib/object.cc » ('j') | runtime/lib/object_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698