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

Unified Diff: runtime/lib/array.cc

Issue 8387035: FIx issue 261: throw exception if index if idnexed oeprators if lists Array and GrowableArray is ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/growable_array.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/array.cc
===================================================================
--- runtime/lib/array.cc (revision 957)
+++ runtime/lib/array.cc (working copy)
@@ -64,7 +64,14 @@
DEFINE_NATIVE_ENTRY(ObjectArray_setIndexed, 3) {
const Array& array = Array::CheckedHandle(arguments->At(0));
- const Smi& index = Smi::CheckedHandle(arguments->At(1));
+ const Instance& index_instance = Instance::CheckedHandle(arguments->At(1));
+ if (!index_instance.IsSmi()) {
+ GrowableArray<const Object*> args;
+ args.Add(&index_instance);
+ Exceptions::ThrowByType(Exceptions::kIllegalArgument, args);
+ }
+ Smi& index = Smi::Handle();
+ index ^= index_instance.raw();
const Instance& value = Instance::CheckedHandle(arguments->At(2));
if (array.IsNull() || index.IsNull()) {
// TODO(asiva): Need to handle error cases.
« no previous file with comments | « no previous file | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698