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

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

Issue 11415028: Remove NullPointerException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed VM bugs. Created 8 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/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 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 139
140 DEFINE_NATIVE_ENTRY(Strings_concatAll, 1) { 140 DEFINE_NATIVE_ENTRY(Strings_concatAll, 1) {
141 GET_NATIVE_ARGUMENT(Array, strings, arguments->NativeArgAt(0)); 141 GET_NATIVE_ARGUMENT(Array, strings, arguments->NativeArgAt(0));
142 ASSERT(!strings.IsNull()); 142 ASSERT(!strings.IsNull());
143 // Check that the array contains strings. 143 // Check that the array contains strings.
144 Instance& elem = Instance::Handle(); 144 Instance& elem = Instance::Handle();
145 for (intptr_t i = 0; i < strings.Length(); i++) { 145 for (intptr_t i = 0; i < strings.Length(); i++) {
146 elem ^= strings.At(i); 146 elem ^= strings.At(i);
147 if (elem.IsNull()) {
148 GrowableArray<const Object*> args;
149 Exceptions::ThrowByType(Exceptions::kNullPointer, args);
150 }
151 if (!elem.IsString()) { 147 if (!elem.IsString()) {
152 GrowableArray<const Object*> args; 148 GrowableArray<const Object*> args;
153 args.Add(&elem); 149 args.Add(&elem);
154 Exceptions::ThrowByType(Exceptions::kArgument, args); 150 Exceptions::ThrowByType(Exceptions::kArgument, args);
155 } 151 }
156 } 152 }
157 return String::ConcatAll(strings); 153 return String::ConcatAll(strings);
158 } 154 }
159 155
160 } // namespace dart 156 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698