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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/error.dart ('k') | runtime/lib/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/invocation_mirror_patch.dart
===================================================================
--- runtime/lib/invocation_mirror_patch.dart (revision 15938)
+++ runtime/lib/invocation_mirror_patch.dart (working copy)
@@ -7,16 +7,51 @@
static final int GETTER = 1;
static final int SETTER = 2;
+ // TODO(regis): Compute lazily the value of these fields, and save the
+ // arguments passed into _allocateInvocationMirror.
+
final String memberName;
final List positionalArguments;
- final Map<String,dynamic> namedArguments = null;
+ final Map<String, dynamic> namedArguments;
final int _type;
- _InvocationMirror(this.memberName, this._type, this.positionalArguments);
+ _InvocationMirror(this.memberName,
+ this._type,
+ this.positionalArguments,
+ this.namedArguments);
- static _allocateInvocationMirror(name, arguments) {
- return new _InvocationMirror(name, METHOD, arguments);
+ static _allocateInvocationMirror(String name,
+ List argumentsDescriptor,
+ List arguments) {
+ var memberName;
+ var type;
+ if (name.startsWith("get:")) {
+ type = GETTER;
+ memberName = name.substring(4);
+ } else if (name.startsWith("set:")) {
+ type = SETTER;
+ memberName = name.substring(4).concat("=");
+ } else {
+ type = METHOD;
+ memberName = name;
+ }
+ // Exclude receiver.
+ int numArguments = argumentsDescriptor[0] - 1;
+ int numPositionalArguments = argumentsDescriptor[1] - 1;
+ int numNamedArguments = numArguments - numPositionalArguments;
+ List positionalArguments = arguments.getRange(1, numPositionalArguments);
+ Map<String, dynamic> namedArguments;
+ if (numNamedArguments > 0) {
+ namedArguments = new Map<String, dynamic>();
+ for (int i = 0; i < numNamedArguments; i++) {
+ String arg_name = argumentsDescriptor[2 + 2*i];
+ var arg_value = arguments[argumentsDescriptor[3 + 2*i]];
+ namedArguments[arg_name] = arg_value;
+ }
+ }
+ return new _InvocationMirror(memberName, type,
+ positionalArguments, namedArguments);
}
bool get isMethod => _type == METHOD;
« no previous file with comments | « runtime/lib/error.dart ('k') | runtime/lib/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698