@@ -1356,50 +1356,37 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
13561356 const std::vector<PropInfo>& templates = info->persistent_templates ;
13571357 size_t i = 0 ; // index to the array
13581358 size_t id = 0 ;
1359- #define V (PropertyName, TypeName ) \
1359+ #define SetProperty (PropertyName, TypeName, vector, type, from ) \
13601360 do { \
1361- if (templates .size () > i && id == templates [i].id ) { \
1362- const PropInfo& d = templates [i]; \
1361+ if (vector .size () > i && id == vector [i].id ) { \
1362+ const PropInfo& d = vector [i]; \
13631363 DCHECK_EQ (d.name , #PropertyName); \
13641364 MaybeLocal<TypeName> maybe_field = \
1365- isolate_ ->GetDataFromSnapshotOnce <TypeName>(d.index ); \
1365+ from ->GetDataFromSnapshotOnce <TypeName>(d.index ); \
13661366 Local<TypeName> field; \
13671367 if (!maybe_field.ToLocal (&field)) { \
13681368 fprintf (stderr, \
1369- " Failed to deserialize environment template " #PropertyName \
1369+ " Failed to deserialize environment " #type " " #PropertyName \
13701370 " \n " ); \
13711371 } \
13721372 set_##PropertyName (field); \
13731373 i++; \
13741374 } \
13751375 } while (0 ); \
13761376 id++;
1377+ #define V (PropertyName, TypeName ) SetProperty(PropertyName, TypeName, \
1378+ templates, template , isolate_)
13771379 ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES (V);
13781380#undef V
13791381
13801382 i = 0 ; // index to the array
13811383 id = 0 ;
13821384 const std::vector<PropInfo>& values = info->persistent_values ;
1383- #define V (PropertyName, TypeName ) \
1384- do { \
1385- if (values.size () > i && id == values[i].id ) { \
1386- const PropInfo& d = values[i]; \
1387- DCHECK_EQ (d.name , #PropertyName); \
1388- MaybeLocal<TypeName> maybe_field = \
1389- ctx->GetDataFromSnapshotOnce <TypeName>(d.index ); \
1390- Local<TypeName> field; \
1391- if (!maybe_field.ToLocal (&field)) { \
1392- fprintf (stderr, \
1393- " Failed to deserialize environment value " #PropertyName \
1394- " \n " ); \
1395- } \
1396- set_##PropertyName (field); \
1397- i++; \
1398- } \
1399- } while (0 ); \
1400- id++;
1385+ #define V (PropertyName, TypeName ) SetProperty(PropertyName, TypeName, \
1386+ values, value, ctx)
14011387 ENVIRONMENT_STRONG_PERSISTENT_VALUES (V);
14021388#undef V
1389+ #undef SetProperty
14031390
14041391 MaybeLocal<Context> maybe_ctx_from_snapshot =
14051392 ctx->GetDataFromSnapshotOnce <Context>(info->context );
0 commit comments