OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 Object& index_object = Object::Handle(isolate); | 25 Object& index_object = Object::Handle(isolate); |
26 for (intptr_t i = 0; i < array_len; i++) { | 26 for (intptr_t i = 0; i < array_len; i++) { |
27 index_object = a.At(i); | 27 index_object = a.At(i); |
28 if (!index_object.IsSmi()) { | 28 if (!index_object.IsSmi()) { |
29 const Array& args = Array::Handle(Array::New(1)); | 29 const Array& args = Array::Handle(Array::New(1)); |
30 args.SetAt(0, index_object); | 30 args.SetAt(0, index_object); |
31 Exceptions::ThrowByType(Exceptions::kArgument, args); | 31 Exceptions::ThrowByType(Exceptions::kArgument, args); |
32 } | 32 } |
33 intptr_t value = Smi::Cast(index_object).Value(); | 33 intptr_t value = Smi::Cast(index_object).Value(); |
34 if (Utf::IsOutOfRange(value)) { | 34 if (Utf::IsOutOfRange(value)) { |
35 const Array& args = Array::Handle(Object::empty_array()); | 35 Exceptions::ThrowByType(Exceptions::kArgument, Object::empty_array()); |
36 Exceptions::ThrowByType(Exceptions::kArgument, args); | |
37 } else { | 36 } else { |
38 if (!Utf::IsLatin1(value)) { | 37 if (!Utf::IsLatin1(value)) { |
39 is_one_byte_string = false; | 38 is_one_byte_string = false; |
40 if (Utf::IsSupplementary(value)) { | 39 if (Utf::IsSupplementary(value)) { |
41 utf16_len += 1; | 40 utf16_len += 1; |
42 } | 41 } |
43 } | 42 } |
44 } | 43 } |
45 utf32_array[i] = value; | 44 utf32_array[i] = value; |
46 } | 45 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (!elem.IsString()) { | 192 if (!elem.IsString()) { |
194 const Array& args = Array::Handle(Array::New(1)); | 193 const Array& args = Array::Handle(Array::New(1)); |
195 args.SetAt(0, elem); | 194 args.SetAt(0, elem); |
196 Exceptions::ThrowByType(Exceptions::kArgument, args); | 195 Exceptions::ThrowByType(Exceptions::kArgument, args); |
197 } | 196 } |
198 } | 197 } |
199 return String::ConcatAll(strings); | 198 return String::ConcatAll(strings); |
200 } | 199 } |
201 | 200 |
202 } // namespace dart | 201 } // namespace dart |
OLD | NEW |