@@ -1346,50 +1346,37 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
1346
1346
const std::vector<PropInfo>& templates = info->persistent_templates ;
1347
1347
size_t i = 0 ; // index to the array
1348
1348
size_t id = 0 ;
1349
- #define V (PropertyName, TypeName ) \
1349
+ #define SetProperty (PropertyName, TypeName, vector, type, from ) \
1350
1350
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]; \
1353
1353
DCHECK_EQ (d.name , #PropertyName); \
1354
1354
MaybeLocal<TypeName> maybe_field = \
1355
- isolate_ ->GetDataFromSnapshotOnce <TypeName>(d.index ); \
1355
+ from ->GetDataFromSnapshotOnce <TypeName>(d.index ); \
1356
1356
Local<TypeName> field; \
1357
1357
if (!maybe_field.ToLocal (&field)) { \
1358
1358
fprintf (stderr, \
1359
- " Failed to deserialize environment template " #PropertyName \
1359
+ " Failed to deserialize environment " #type " " #PropertyName \
1360
1360
" \n " ); \
1361
1361
} \
1362
1362
set_##PropertyName (field); \
1363
1363
i++; \
1364
1364
} \
1365
1365
} while (0 ); \
1366
1366
id++;
1367
+ #define V (PropertyName, TypeName ) SetProperty(PropertyName, TypeName, \
1368
+ templates, template , isolate_)
1367
1369
ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES (V);
1368
1370
#undef V
1369
1371
1370
1372
i = 0 ; // index to the array
1371
1373
id = 0 ;
1372
1374
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)
1391
1377
ENVIRONMENT_STRONG_PERSISTENT_VALUES (V);
1392
1378
#undef V
1379
+ #undef SetProperty
1393
1380
1394
1381
MaybeLocal<Context> maybe_ctx_from_snapshot =
1395
1382
ctx->GetDataFromSnapshotOnce <Context>(info->context );
0 commit comments