@@ -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 ) \
@@ -436,10 +435,6 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) {
436435 return JustVoid ();
437436}
438437
439- static MaybeLocal<String> Uint32ToName (Local<Context> context, uint32_t index) {
440- return Uint32::New (context->GetIsolate (), index)->ToString (context);
441- }
442-
443438static void Clear (const FunctionCallbackInfo<Value>& info) {
444439 Storage* storage;
445440 ASSIGN_OR_RETURN_UNWRAP (&storage, info.This ());
@@ -635,67 +630,37 @@ static Intercepted StorageDefiner(Local<Name> property,
635630static Intercepted IndexedGetter (uint32_t index,
636631 const PropertyCallbackInfo<Value>& info) {
637632 Environment* env = Environment::GetCurrent (info);
638- Local<Name> name;
639- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
640- // There was an error converting the index to a name.
641- // We aren't going to return a result but let's indicate
642- // that we intercepted the operation.
643- return Intercepted::kYes ;
644- }
633+ Local<Name> name = Uint32ToString (env->context (), index);
645634 return StorageGetter (name, info);
646635}
647636
648637static Intercepted IndexedSetter (uint32_t index,
649638 Local<Value> value,
650639 const PropertyCallbackInfo<void >& info) {
651640 Environment* env = Environment::GetCurrent (info);
652- Local<Name> name;
653- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
654- // There was an error converting the index to a name.
655- // We aren't going to return a result but let's indicate
656- // that we intercepted the operation.
657- return Intercepted::kYes ;
658- }
641+ Local<Name> name = Uint32ToString (env->context (), index);
659642 return StorageSetter (name, value, info);
660643}
661644
662645static Intercepted IndexedQuery (uint32_t index,
663646 const PropertyCallbackInfo<Integer>& info) {
664647 Environment* env = Environment::GetCurrent (info);
665- Local<Name> name;
666- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
667- // There was an error converting the index to a name.
668- // We aren't going to return a result but let's indicate
669- // that we intercepted the operation.
670- return Intercepted::kYes ;
671- }
648+ Local<Name> name = Uint32ToString (env->context (), index);
672649 return StorageQuery (name, info);
673650}
674651
675652static Intercepted IndexedDeleter (uint32_t index,
676653 const PropertyCallbackInfo<Boolean>& info) {
677654 Environment* env = Environment::GetCurrent (info);
678- Local<Name> name;
679- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
680- // There was an error converting the index to a name.
681- // We aren't going to return a result but let's indicate
682- // that we intercepted the operation.
683- return Intercepted::kYes ;
684- }
655+ Local<Name> name = Uint32ToString (env->context (), index);
685656 return StorageDeleter (name, info);
686657}
687658
688659static Intercepted IndexedDefiner (uint32_t index,
689660 const PropertyDescriptor& desc,
690661 const PropertyCallbackInfo<void >& info) {
691662 Environment* env = Environment::GetCurrent (info);
692- Local<Name> name;
693- if (!Uint32ToName (env->context (), index).ToLocal (&name)) {
694- // There was an error converting the index to a name.
695- // We aren't going to return a result but let's indicate
696- // that we intercepted the operation.
697- return Intercepted::kYes ;
698- }
663+ Local<Name> name = Uint32ToString (env->context (), index);
699664 return StorageDefiner (name, desc, info);
700665}
701666
0 commit comments