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

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

Issue 8528050: Fix throwing ObjectNotClosure instead of null exception if closure is null. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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) 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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/code_index_table.h" 7 #include "vm/code_index_table.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 765
766 // Report that an object is not a closure. 766 // Report that an object is not a closure.
767 // Arg0: non-closure object. 767 // Arg0: non-closure object.
768 // Arg1: arguments array. 768 // Arg1: arguments array.
769 DEFINE_RUNTIME_ENTRY(ReportObjectNotClosure, 2) { 769 DEFINE_RUNTIME_ENTRY(ReportObjectNotClosure, 2) {
770 ASSERT(arguments.Count() == 770 ASSERT(arguments.Count() ==
771 kReportObjectNotClosureRuntimeEntry.argument_count()); 771 kReportObjectNotClosureRuntimeEntry.argument_count());
772 const Instance& bad_closure = Instance::CheckedHandle(arguments.At(0)); 772 const Instance& bad_closure = Instance::CheckedHandle(arguments.At(0));
773 if (bad_closure.IsNull()) { 773 if (bad_closure.IsNull()) {
774 GrowableArray<const Object*> args; 774 GrowableArray<const Object*> args;
775 Exceptions::ThrowByType(Exceptions::kNullPointer, args); 775 Exceptions::ThrowByType(Exceptions::kObjectNotClosure, args);
776 } 776 }
777 // const Array& arguments = Array::CheckedHandle(arguments.At(1)); 777 // const Array& arguments = Array::CheckedHandle(arguments.At(1));
778 OS::PrintErr("object '%s' is not a closure\n", bad_closure.ToCString()); 778 OS::PrintErr("object '%s' is not a closure\n", bad_closure.ToCString());
779 GrowableArray<const Object*> args; 779 GrowableArray<const Object*> args;
780 Exceptions::ThrowByType(Exceptions::kObjectNotClosure, args); 780 Exceptions::ThrowByType(Exceptions::kObjectNotClosure, args);
781 } 781 }
siva 2011/11/15 02:46:06 There is another method in this file caled Resolve
srdjan 2011/11/15 17:43:04 Done.
782 782
783 783
784 DEFINE_RUNTIME_ENTRY(ClosureArgumentMismatch, 0) { 784 DEFINE_RUNTIME_ENTRY(ClosureArgumentMismatch, 0) {
785 ASSERT(arguments.Count() == 785 ASSERT(arguments.Count() ==
786 kClosureArgumentMismatchRuntimeEntry.argument_count()); 786 kClosureArgumentMismatchRuntimeEntry.argument_count());
787 GrowableArray<const Object*> args; 787 GrowableArray<const Object*> args;
788 Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args); 788 Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args);
789 } 789 }
790 790
791 791
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 } 997 }
998 } 998 }
999 } 999 }
1000 // The cache is null terminated, therefore the loop above should never 1000 // The cache is null terminated, therefore the loop above should never
1001 // terminate by itself. 1001 // terminate by itself.
1002 UNREACHABLE(); 1002 UNREACHABLE();
1003 return Code::null(); 1003 return Code::null();
1004 } 1004 }
1005 1005
1006 } // namespace dart 1006 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698