@@ -1346,50 +1346,37 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
13461346 const std::vector<PropInfo>& templates = info->persistent_templates ;
13471347 size_t i = 0 ; // index to the array
13481348 size_t id = 0 ;
1349- #define V (PropertyName, TypeName ) \
1349+ #define SetProperty (PropertyName, TypeName, vector, type, from ) \
13501350 do { \
1351- if (templates .size () > i && id == templates [i].id ) { \
1352- const PropInfo& d = templates [i]; \
1351+ if (vector .size () > i && id == vector [i].id ) { \
1352+ const PropInfo& d = vector [i]; \
13531353 DCHECK_EQ (d.name , #PropertyName); \
13541354 MaybeLocal<TypeName> maybe_field = \
1355- isolate_ ->GetDataFromSnapshotOnce <TypeName>(d.index ); \
1355+ from ->GetDataFromSnapshotOnce <TypeName>(d.index ); \
13561356 Local<TypeName> field; \
13571357 if (!maybe_field.ToLocal (&field)) { \
13581358 fprintf (stderr, \
1359- " Failed to deserialize environment template " #PropertyName \
1359+ " Failed to deserialize environment " #type " " #PropertyName \
13601360 " \n " ); \
13611361 } \
13621362 set_##PropertyName (field); \
13631363 i++; \
13641364 } \
13651365 } while (0 ); \
13661366 id++;
1367+ #define V (PropertyName, TypeName ) SetProperty(PropertyName, TypeName, \
1368+ templates, template , isolate_)
13671369 ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES (V);
13681370#undef V
13691371
13701372 i = 0 ; // index to the array
13711373 id = 0 ;
13721374 const std::vector<PropInfo>& values = info->persistent_values ;
1373- #define V (PropertyName, TypeName ) \
1374- do { \
1375- if (values.size () > i && id == values[i].id ) { \
1376- const PropInfo& d = values[i]; \
1377- DCHECK_EQ (d.name , #PropertyName); \
1378- MaybeLocal<TypeName> maybe_field = \
1379- ctx->GetDataFromSnapshotOnce <TypeName>(d.index ); \
1380- Local<TypeName> field; \
1381- if (!maybe_field.ToLocal (&field)) { \
1382- fprintf (stderr, \
1383- " Failed to deserialize environment value " #PropertyName \
1384- " \n " ); \
1385- } \
1386- set_##PropertyName (field); \
1387- i++; \
1388- } \
1389- } while (0 ); \
1390- id++;
1375+ #define V (PropertyName, TypeName ) SetProperty(PropertyName, TypeName, \
1376+ values, value, ctx)
13911377 ENVIRONMENT_STRONG_PERSISTENT_VALUES (V);
13921378#undef V
1379+ #undef SetProperty
13931380
13941381 MaybeLocal<Context> maybe_ctx_from_snapshot =
13951382 ctx->GetDataFromSnapshotOnce <Context>(info->context );
0 commit comments