@@ -41,7 +41,6 @@ using v8::PropertyCallbackInfo;
4141using v8::PropertyDescriptor;
4242using v8::PropertyHandlerFlags;
4343using v8::String;
44- using v8::Uint32;
4544using v8::Value;
4645
4746#define THROW_SQLITE_ERROR (env, r ) \
@@ -432,10 +431,6 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) {
432431 return JustVoid ();
433432}
434433
435- static MaybeLocal<String> Uint32ToName (Local<Context> context, uint32_t index) {
436- return Uint32::New (Isolate::GetCurrent (), index)->ToString (context);
437- }
438-
439434static void Clear (const FunctionCallbackInfo<Value>& info) {
440435 Storage* storage;
441436 ASSIGN_OR_RETURN_UNWRAP (&storage, info.This ());
@@ -631,67 +626,37 @@ static Intercepted StorageDefiner(Local<Name> property,
631626static Intercepted IndexedGetter (uint32_t index,
632627 const PropertyCallbackInfo<Value>& info) {
633628 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- }
629+ Local<Name> name = Uint32ToString (env->context (), index);
641630 return StorageGetter (name, info);
642631}
643632
644633static Intercepted IndexedSetter (uint32_t index,
645634 Local<Value> value,
646635 const PropertyCallbackInfo<void >& info) {
647636 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- }
637+ Local<Name> name = Uint32ToString (env->context (), index);
655638 return StorageSetter (name, value, info);
656639}
657640
658641static Intercepted IndexedQuery (uint32_t index,
659642 const PropertyCallbackInfo<Integer>& info) {
660643 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- }
644+ Local<Name> name = Uint32ToString (env->context (), index);
668645 return StorageQuery (name, info);
669646}
670647
671648static Intercepted IndexedDeleter (uint32_t index,
672649 const PropertyCallbackInfo<Boolean>& info) {
673650 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- }
651+ Local<Name> name = Uint32ToString (env->context (), index);
681652 return StorageDeleter (name, info);
682653}
683654
684655static Intercepted IndexedDefiner (uint32_t index,
685656 const PropertyDescriptor& desc,
686657 const PropertyCallbackInfo<void >& info) {
687658 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- }
659+ Local<Name> name = Uint32ToString (env->context (), index);
695660 return StorageDefiner (name, desc, info);
696661}
697662
0 commit comments