Index: runtime/lib/string.cc |
diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc |
index 19222eb8c1d9db2bc6cc71d0c13fd35806462aa8..ce7731fde28884313fde54104e3508dfedca00fc 100644 |
--- a/runtime/lib/string.cc |
+++ b/runtime/lib/string.cc |
@@ -237,16 +237,12 @@ static int32_t StringValueAt(const String& str, const Integer& index) { |
const Smi& smi = Smi::Cast(index); |
intptr_t index = smi.Value(); |
if ((index < 0) || (index >= str.Length())) { |
- const Array& args = Array::Handle(Array::New(1)); |
- args.SetAt(0, smi); |
- Exceptions::ThrowByType(Exceptions::kRange, args); |
+ Exceptions::ThrowRangeError(smi); |
} |
return str.CharAt(index); |
} else { |
// An index larger than Smi is always illegal. |
- const Array& args = Array::Handle(Array::New(1)); |
- args.SetAt(0, index); |
- Exceptions::ThrowByType(Exceptions::kRange, args); |
+ Exceptions::ThrowRangeError(index); |
return 0; |
} |
} |
@@ -336,9 +332,7 @@ DEFINE_NATIVE_ENTRY(StringBuffer_createStringFromUint16Array, 3) { |
intptr_t array_length = codeUnits.Length(); |
intptr_t length_value = length.Value(); |
if (length_value < 0 || length_value > array_length) { |
- const Array& args = Array::Handle(Array::New(1)); |
- args.SetAt(0, length); |
- Exceptions::ThrowByType(Exceptions::kRange, args); |
+ Exceptions::ThrowRangeError(length); |
} |
const String& result = isLatin1.value() |
? String::Handle(OneByteString::New(length_value, Heap::kNew)) |