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

Side by Side Diff: runtime/vm/dart_entry.cc

Issue 12328019: - Improve the message for NoSuchMethodErrors that are (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/debugger_api_impl_test.cc » ('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) 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/dart_entry.h" 5 #include "vm/dart_entry.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 #include "vm/resolver.h" 10 #include "vm/resolver.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 void ArgumentsDescriptor::InitOnce() { 320 void ArgumentsDescriptor::InitOnce() {
321 for (int i = 0; i < kCachedDescriptorCount; i++) { 321 for (int i = 0; i < kCachedDescriptorCount; i++) {
322 cached_args_descriptors_[i] = ArgumentsDescriptor::NewNonCached(i, false); 322 cached_args_descriptors_[i] = ArgumentsDescriptor::NewNonCached(i, false);
323 } 323 }
324 } 324 }
325 325
326 326
327 RawObject* DartLibraryCalls::ExceptionCreate(const Library& lib, 327 RawObject* DartLibraryCalls::ExceptionCreate(const Library& lib,
328 const String& class_name, 328 const String& class_name,
329 const String& constructor_name,
329 const Array& arguments) { 330 const Array& arguments) {
330 const Class& cls = Class::Handle(lib.LookupClassAllowPrivate(class_name)); 331 const Class& cls = Class::Handle(lib.LookupClassAllowPrivate(class_name));
331 ASSERT(!cls.IsNull()); 332 ASSERT(!cls.IsNull());
332 // For now, we only support a non-parameterized or raw type. 333 // For now, we only support a non-parameterized or raw type.
333 const int kNumExtraArgs = 2; // implicit rcvr and construction phase args. 334 const int kNumExtraArgs = 2; // implicit rcvr and construction phase args.
334 const Instance& exception_object = Instance::Handle(Instance::New(cls)); 335 const Instance& exception_object = Instance::Handle(Instance::New(cls));
335 const Array& constructor_arguments = 336 const Array& constructor_arguments =
336 Array::Handle(Array::New(arguments.Length() + kNumExtraArgs)); 337 Array::Handle(Array::New(arguments.Length() + kNumExtraArgs));
337 constructor_arguments.SetAt(0, exception_object); 338 constructor_arguments.SetAt(0, exception_object);
338 constructor_arguments.SetAt( 339 constructor_arguments.SetAt(
339 1, Smi::Handle(Smi::New(Function::kCtorPhaseAll))); 340 1, Smi::Handle(Smi::New(Function::kCtorPhaseAll)));
340 Object& obj = Object::Handle(); 341 Object& obj = Object::Handle();
341 for (intptr_t i = 0; i < arguments.Length(); i++) { 342 for (intptr_t i = 0; i < arguments.Length(); i++) {
342 obj = arguments.At(i); 343 obj = arguments.At(i);
343 constructor_arguments.SetAt((i + kNumExtraArgs), obj); 344 constructor_arguments.SetAt((i + kNumExtraArgs), obj);
344 } 345 }
345 346
346 String& constructor_name = String::Handle( 347 const String& function_name = String::Handle(
347 String::Concat(class_name, Symbols::Dot())); 348 String::Concat(class_name, constructor_name));
348 Function& constructor = 349 const Function& constructor =
349 Function::Handle(cls.LookupConstructor(constructor_name)); 350 Function::Handle(cls.LookupConstructorAllowPrivate(function_name));
350 ASSERT(!constructor.IsNull()); 351 ASSERT(!constructor.IsNull());
351 const Object& retval = 352 const Object& retval =
352 Object::Handle(DartEntry::InvokeStatic(constructor, constructor_arguments)); 353 Object::Handle(DartEntry::InvokeStatic(constructor, constructor_arguments));
353 ASSERT(retval.IsNull() || retval.IsError()); 354 ASSERT(retval.IsNull() || retval.IsError());
354 if (retval.IsError()) { 355 if (retval.IsError()) {
355 return retval.raw(); 356 return retval.raw();
356 } 357 }
357 return exception_object.raw(); 358 return exception_object.raw();
358 } 359 }
359 360
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 String::Handle(Field::GetterName(Symbols::_id())))); 510 String::Handle(Field::GetterName(Symbols::_id()))));
510 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); 511 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name));
511 ASSERT(!func.IsNull()); 512 ASSERT(!func.IsNull());
512 const Array& args = Array::Handle(Array::New(1)); 513 const Array& args = Array::Handle(Array::New(1));
513 args.SetAt(0, port); 514 args.SetAt(0, port);
514 return DartEntry::InvokeDynamic(func, args); 515 return DartEntry::InvokeDynamic(func, args);
515 } 516 }
516 517
517 518
518 } // namespace dart 519 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698