| Index: runtime/vm/dart_api_impl.cc
|
| ===================================================================
|
| --- runtime/vm/dart_api_impl.cc (revision 17848)
|
| +++ runtime/vm/dart_api_impl.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| @@ -2030,7 +2030,6 @@
|
| }
|
|
|
|
|
| -// TODO(hpayer): value should always be smaller then 0xff. Add error handling.
|
| #define GET_LIST_ELEMENT_AS_BYTES(isolate, type, obj, native_array, offset, \
|
| length) \
|
| const type& array = type::Cast(obj); \
|
| @@ -2039,8 +2038,15 @@
|
| for (int i = 0; i < length; i++) { \
|
| element = array.At(offset + i); \
|
| if (!element.IsInteger()) { \
|
| - return Api::NewError("%s expects the argument 'list' to be " \
|
| - "a List of int", CURRENT_FUNC); \
|
| + Dart_Handle argument_error_class = \
|
| + Dart_GetClass( \
|
| + Dart_LookupLibrary(Dart_NewStringFromCString("dart:core")), \
|
| + Dart_NewStringFromCString("ArgumentError")); \
|
| + Dart_Handle args[1]; \
|
| + args[0] = Dart_NewStringFromCString("List contains non-int elements"); \
|
| + Dart_Handle exception = \
|
| + Dart_New(argument_error_class, Dart_Null(), 1, args); \
|
| + return Dart_ThrowException(exception); \
|
| } \
|
| const Integer& integer = Integer::Cast(element); \
|
| native_array[i] = static_cast<uint8_t>(integer.AsInt64Value() & 0xff); \
|
|
|