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

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

Issue 9317099: Improve repoorting of NoSuchMethod: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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
« corelib/src/exceptions.dart ('K') | « corelib/src/exceptions.dart ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 10
(...skipping 22 matching lines...) Expand all
33 // found. 33 // found.
34 Class& instance_class = Class::Handle(instance.clazz()); 34 Class& instance_class = Class::Handle(instance.clazz());
35 Function& function = 35 Function& function =
36 Function::Handle(instance_class.LookupDynamicFunction(function_name)); 36 Function::Handle(instance_class.LookupDynamicFunction(function_name));
37 while (function.IsNull()) { 37 while (function.IsNull()) {
38 instance_class = instance_class.SuperClass(); 38 instance_class = instance_class.SuperClass();
39 if (instance_class.IsNull()) break; 39 if (instance_class.IsNull()) break;
40 function = instance_class.LookupDynamicFunction(function_name); 40 function = instance_class.LookupDynamicFunction(function_name);
41 } 41 }
42 if (!function.IsNull()) { 42 if (!function.IsNull()) {
43 String& tmp = String::Handle(); 43 const int total_num_parameters =
44 String& extra_message = String::Handle();
45 tmp = String::NewSymbol("\nFound '");
46 extra_message = String::Concat(tmp, function_name);
47 tmp = String::NewSymbol("(");
48 extra_message = String::Concat(extra_message, tmp);
49 const int total_num_paramaters =
50 function.num_fixed_parameters() + function.num_optional_parameters(); 44 function.num_fixed_parameters() + function.num_optional_parameters();
51 // 0 is the receiver ('this'), skip it. 45 const Array& array = Array::Handle(Array::New(total_num_parameters - 1));
52 for (int i = 1; i < total_num_paramaters; i++) { 46 // Skip receiver.
53 if (i > 1) { 47 for (int i = 1; i < total_num_parameters; i++) {
54 tmp = String::NewSymbol(", "); 48 array.SetAt(i - 1, String::Handle(function.ParameterNameAt(i)));
55 extra_message = String::Concat(extra_message, tmp);
56 }
57 tmp = function.ParameterNameAt(i);
58 extra_message = String::Concat(extra_message, tmp);
59 } 49 }
60 tmp = String::NewSymbol(")'"); 50 dart_arguments.Add(&array);
61 extra_message = String::Concat(extra_message, tmp);
62 dart_arguments.Add(&extra_message);
63 } 51 }
64 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); 52 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
65 } 53 }
66 54
67 } // namespace dart 55 } // namespace dart
OLDNEW
« corelib/src/exceptions.dart ('K') | « corelib/src/exceptions.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698