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