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

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

Issue 14652008: Fix error reporting when calling static methods and closures withh mismatched arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 4451 matching lines...) Expand 10 before | Expand all | Expand 10 after
4462 4462
4463 4463
4464 RawString* Function::QualifiedUserVisibleName() const { 4464 RawString* Function::QualifiedUserVisibleName() const {
4465 String& tmp = String::Handle(); 4465 String& tmp = String::Handle();
4466 const Class& cls = Class::Handle(Owner()); 4466 const Class& cls = Class::Handle(Owner());
4467 4467
4468 if (IsClosureFunction()) { 4468 if (IsClosureFunction()) {
4469 if (IsLocalFunction()) { 4469 if (IsLocalFunction()) {
4470 const Function& parent = Function::Handle(parent_function()); 4470 const Function& parent = Function::Handle(parent_function());
4471 tmp = parent.QualifiedUserVisibleName(); 4471 tmp = parent.QualifiedUserVisibleName();
4472 if (UserVisibleName() != Symbols::AnonymousClosure().raw()) {
4473 return tmp.raw();
4474 }
srdjan 2013/04/30 21:46:52 Removed this because it hides closures from nested
4472 } else { 4475 } else {
4473 return UserVisibleName(); 4476 return UserVisibleName();
4474 } 4477 }
4475 } else { 4478 } else {
4476 if (cls.IsTopLevel()) { 4479 if (cls.IsTopLevel()) {
4477 return UserVisibleName(); 4480 return UserVisibleName();
4478 } else { 4481 } else {
4479 tmp = cls.UserVisibleName(); 4482 tmp = cls.UserVisibleName();
4480 } 4483 }
4481 } 4484 }
(...skipping 7875 matching lines...) Expand 10 before | Expand all | Expand 10 after
12357 12360
12358 void Array::MakeImmutable() const { 12361 void Array::MakeImmutable() const {
12359 NoGCScope no_gc; 12362 NoGCScope no_gc;
12360 uword tags = raw_ptr()->tags_; 12363 uword tags = raw_ptr()->tags_;
12361 tags = RawObject::ClassIdTag::update(kImmutableArrayCid, tags); 12364 tags = RawObject::ClassIdTag::update(kImmutableArrayCid, tags);
12362 raw_ptr()->tags_ = tags; 12365 raw_ptr()->tags_ = tags;
12363 } 12366 }
12364 12367
12365 12368
12366 const char* Array::ToCString() const { 12369 const char* Array::ToCString() const {
12367 return "Array"; 12370 if (IsNull()) {
12371 return "Array NULL";
12372 }
12373 const char* format = "Array len:%"Pd"";
12374 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
12375 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
12376 OS::SNPrint(chars, len, format, Length());
12377 return chars;
12368 } 12378 }
12369 12379
12370 12380
12371 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { 12381 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) {
12372 const Array& result = Array::Handle(Array::New(new_length, space)); 12382 const Array& result = Array::Handle(Array::New(new_length, space));
12373 intptr_t len = 0; 12383 intptr_t len = 0;
12374 if (!source.IsNull()) { 12384 if (!source.IsNull()) {
12375 len = source.Length(); 12385 len = source.Length();
12376 result.SetTypeArguments( 12386 result.SetTypeArguments(
12377 AbstractTypeArguments::Handle(source.GetTypeArguments())); 12387 AbstractTypeArguments::Handle(source.GetTypeArguments()));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
12422 12432
12423 RawImmutableArray* ImmutableArray::New(intptr_t len, 12433 RawImmutableArray* ImmutableArray::New(intptr_t len,
12424 Heap::Space space) { 12434 Heap::Space space) {
12425 ASSERT(Isolate::Current()->object_store()->immutable_array_class() != 12435 ASSERT(Isolate::Current()->object_store()->immutable_array_class() !=
12426 Class::null()); 12436 Class::null());
12427 return reinterpret_cast<RawImmutableArray*>(Array::New(kClassId, len, space)); 12437 return reinterpret_cast<RawImmutableArray*>(Array::New(kClassId, len, space));
12428 } 12438 }
12429 12439
12430 12440
12431 const char* ImmutableArray::ToCString() const { 12441 const char* ImmutableArray::ToCString() const {
12432 return "ImmutableArray"; 12442 if (IsNull()) {
12443 return "ImmutableArray NULL";
12444 }
12445 const char* format = "ImmutableArray len:%"Pd"";
12446 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
12447 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
12448 OS::SNPrint(chars, len, format, Length());
12449 return chars;
12433 } 12450 }
12434 12451
12435 12452
12436 void GrowableObjectArray::Add(const Object& value, Heap::Space space) const { 12453 void GrowableObjectArray::Add(const Object& value, Heap::Space space) const {
12437 ASSERT(!IsNull()); 12454 ASSERT(!IsNull());
12438 if (Length() == Capacity()) { 12455 if (Length() == Capacity()) {
12439 // TODO(Issue 2500): Need a better growth strategy. 12456 // TODO(Issue 2500): Need a better growth strategy.
12440 intptr_t new_capacity = (Capacity() == 0) ? 4 : Capacity() * 2; 12457 intptr_t new_capacity = (Capacity() == 0) ? 4 : Capacity() * 2;
12441 if (new_capacity <= Capacity()) { 12458 if (new_capacity <= Capacity()) {
12442 // Use the preallocated out of memory exception to avoid calling 12459 // Use the preallocated out of memory exception to avoid calling
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
12533 NoGCScope no_gc; 12550 NoGCScope no_gc;
12534 result ^= raw; 12551 result ^= raw;
12535 result.SetLength(0); 12552 result.SetLength(0);
12536 result.SetData(array); 12553 result.SetData(array);
12537 } 12554 }
12538 return result.raw(); 12555 return result.raw();
12539 } 12556 }
12540 12557
12541 12558
12542 const char* GrowableObjectArray::ToCString() const { 12559 const char* GrowableObjectArray::ToCString() const {
12543 return "GrowableObjectArray"; 12560 if (IsNull()) {
12561 return "GrowableObjectArray NULL";
12562 }
12563 const char* format = "GrowableObjectArray len:%"Pd"";
12564 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
12565 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
12566 OS::SNPrint(chars, len, format, Length());
12567 return chars;
12544 } 12568 }
12545 12569
12546 12570
12547 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, 12571 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3,
12548 Heap::Space space) { 12572 Heap::Space space) {
12549 ASSERT(Isolate::Current()->object_store()->float32x4_class() != 12573 ASSERT(Isolate::Current()->object_store()->float32x4_class() !=
12550 Class::null()); 12574 Class::null());
12551 Float32x4& result = Float32x4::Handle(); 12575 Float32x4& result = Float32x4::Handle();
12552 { 12576 {
12553 RawObject* raw = Object::Allocate(Float32x4::kClassId, 12577 RawObject* raw = Object::Allocate(Float32x4::kClassId,
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
13204 } 13228 }
13205 return result.raw(); 13229 return result.raw();
13206 } 13230 }
13207 13231
13208 13232
13209 const char* WeakProperty::ToCString() const { 13233 const char* WeakProperty::ToCString() const {
13210 return "_WeakProperty"; 13234 return "_WeakProperty";
13211 } 13235 }
13212 13236
13213 } // namespace dart 13237 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698