@@ -432,10 +432,6 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) {
432432 return JustVoid ();
433433}
434434
435- static MaybeLocal<String> Uint32ToName (Local<Context> context, uint32_t index) {
436- return Uint32::New (Isolate::GetCurrent (), index)->ToString (context);
437- }
438-
439435static void Clear (const FunctionCallbackInfo<Value>& info) {
440436 Storage* storage;
441437 ASSIGN_OR_RETURN_UNWRAP (&storage, info.This ());
@@ -631,67 +627,37 @@ static Intercepted StorageDefiner(Local<Name> property,
631627static Intercepted IndexedGetter (uint32_t index,
632628 const PropertyCallbackInfo<Value>& info) {
633629 Environment* env = Environment::GetCurrent (info);
634- Local<Name> name;
635- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
636- // There was an error converting the index to a name.
637- // We aren't going to return a result but let's indicate
638- // that we intercepted the operation.
639- return Intercepted::kYes ;
640- }
630+ Local<Name> name = Uint32ToString (env->context (), index);
641631 return StorageGetter (name, info);
642632}
643633
644634static Intercepted IndexedSetter (uint32_t index,
645635 Local<Value> value,
646636 const PropertyCallbackInfo<void >& info) {
647637 Environment* env = Environment::GetCurrent (info);
648- Local<Name> name;
649- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
650- // There was an error converting the index to a name.
651- // We aren't going to return a result but let's indicate
652- // that we intercepted the operation.
653- return Intercepted::kYes ;
654- }
638+ Local<Name> name = Uint32ToString (env->context (), index);
655639 return StorageSetter (name, value, info);
656640}
657641
658642static Intercepted IndexedQuery (uint32_t index,
659643 const PropertyCallbackInfo<Integer>& info) {
660644 Environment* env = Environment::GetCurrent (info);
661- Local<Name> name;
662- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
663- // There was an error converting the index to a name.
664- // We aren't going to return a result but let's indicate
665- // that we intercepted the operation.
666- return Intercepted::kYes ;
667- }
645+ Local<Name> name = Uint32ToString (env->context (), index);
668646 return StorageQuery (name, info);
669647}
670648
671649static Intercepted IndexedDeleter (uint32_t index,
672650 const PropertyCallbackInfo<Boolean>& info) {
673651 Environment* env = Environment::GetCurrent (info);
674- Local<Name> name;
675- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
676- // There was an error converting the index to a name.
677- // We aren't going to return a result but let's indicate
678- // that we intercepted the operation.
679- return Intercepted::kYes ;
680- }
652+ Local<Name> name = Uint32ToString (env->context (), index);
681653 return StorageDeleter (name, info);
682654}
683655
684656static Intercepted IndexedDefiner (uint32_t index,
685657 const PropertyDescriptor& desc,
686658 const PropertyCallbackInfo<void >& info) {
687659 Environment* env = Environment::GetCurrent (info);
688- Local<Name> name;
689- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
690- // There was an error converting the index to a name.
691- // We aren't going to return a result but let's indicate
692- // that we intercepted the operation.
693- return Intercepted::kYes ;
694- }
660+ Local<Name> name = Uint32ToString (env->context (), index);
695661 return StorageDefiner (name, desc, info);
696662}
697663
0 commit comments