Skip to content

Commit c82fab0

Browse files
committed
perf(ast/estree): remove pointless assignments from raw transfer deserializers (#15305)
Small perf optimization to raw transfer. Shorten deserializers by not assigning `null` to fields which were already initialized as `null`.
1 parent 7f079ab commit c82fab0

File tree

10 files changed

+6
-122
lines changed

10 files changed

+6
-122
lines changed

apps/oxlint/src-js/generated/deserialize.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ function deserializeIdentifierName(pos) {
200200
});
201201
node.decorators = [];
202202
node.optional = false;
203-
node.typeAnnotation = null;
204203
parent = previousParent;
205204
return node;
206205
}
@@ -223,7 +222,6 @@ function deserializeIdentifierReference(pos) {
223222
});
224223
node.decorators = [];
225224
node.optional = false;
226-
node.typeAnnotation = null;
227225
parent = previousParent;
228226
return node;
229227
}
@@ -246,7 +244,6 @@ function deserializeBindingIdentifier(pos) {
246244
});
247245
node.decorators = [];
248246
node.optional = false;
249-
node.typeAnnotation = null;
250247
parent = previousParent;
251248
return node;
252249
}
@@ -269,7 +266,6 @@ function deserializeLabelIdentifier(pos) {
269266
});
270267
node.decorators = [];
271268
node.optional = false;
272-
node.typeAnnotation = null;
273269
parent = previousParent;
274270
return node;
275271
}
@@ -1107,7 +1103,6 @@ function deserializeArrayAssignmentTarget(pos) {
11071103
node.decorators = [];
11081104
node.elements = elements;
11091105
node.optional = false;
1110-
node.typeAnnotation = null;
11111106
parent = previousParent;
11121107
return node;
11131108
}
@@ -1134,7 +1129,6 @@ function deserializeObjectAssignmentTarget(pos) {
11341129
node.decorators = [];
11351130
node.properties = properties;
11361131
node.optional = false;
1137-
node.typeAnnotation = null;
11381132
parent = previousParent;
11391133
return node;
11401134
}
@@ -1159,8 +1153,6 @@ function deserializeAssignmentTargetRest(pos) {
11591153
node.decorators = [];
11601154
node.argument = deserializeAssignmentTarget(pos + 8);
11611155
node.optional = false;
1162-
node.typeAnnotation = null;
1163-
node.value = null;
11641156
parent = previousParent;
11651157
return node;
11661158
}
@@ -1215,7 +1207,6 @@ function deserializeAssignmentTargetWithDefault(pos) {
12151207
node.left = deserializeAssignmentTarget(pos + 8);
12161208
node.right = deserializeExpression(pos + 24);
12171209
node.optional = false;
1218-
node.typeAnnotation = null;
12191210
parent = previousParent;
12201211
return node;
12211212
}
@@ -1645,7 +1636,6 @@ function deserializeExpressionStatement(pos) {
16451636
parent,
16461637
});
16471638
node.expression = deserializeExpression(pos + 8);
1648-
node.directive = null;
16491639
parent = previousParent;
16501640
return node;
16511641
}
@@ -2164,7 +2154,6 @@ function deserializeAssignmentPattern(pos) {
21642154
node.left = deserializeBindingPattern(pos + 8);
21652155
node.right = deserializeExpression(pos + 40);
21662156
node.optional = false;
2167-
node.typeAnnotation = null;
21682157
parent = previousParent;
21692158
return node;
21702159
}
@@ -2191,7 +2180,6 @@ function deserializeObjectPattern(pos) {
21912180
node.decorators = [];
21922181
node.properties = properties;
21932182
node.optional = false;
2194-
node.typeAnnotation = null;
21952183
parent = previousParent;
21962184
return node;
21972185
}
@@ -2246,7 +2234,6 @@ function deserializeArrayPattern(pos) {
22462234
node.decorators = [];
22472235
node.elements = elements;
22482236
node.optional = false;
2249-
node.typeAnnotation = null;
22502237
parent = previousParent;
22512238
return node;
22522239
}
@@ -2271,8 +2258,6 @@ function deserializeBindingRestElement(pos) {
22712258
node.decorators = [];
22722259
node.argument = deserializeBindingPattern(pos + 8);
22732260
node.optional = false;
2274-
node.typeAnnotation = null;
2275-
node.value = null;
22762261
parent = previousParent;
22772262
return node;
22782263
}
@@ -2442,7 +2427,6 @@ function deserializeArrowFunctionExpression(pos) {
24422427
node.params = deserializeBoxFormalParameters(pos + 16);
24432428
node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 24);
24442429
node.body = body;
2445-
node.id = null;
24462430
node.generator = false;
24472431
parent = previousParent;
24482432
return node;
@@ -3141,7 +3125,6 @@ function deserializeNullLiteral(pos) {
31413125
range: [start, end],
31423126
parent,
31433127
});
3144-
node.value = null;
31453128
node.raw = start === 0 && end === 0 ? null : 'null';
31463129
parent = previousParent;
31473130
return node;
@@ -4733,7 +4716,6 @@ function deserializeTSPropertySignature(pos) {
47334716
});
47344717
node.key = deserializePropertyKey(pos + 8);
47354718
node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 24);
4736-
node.accessibility = null;
47374719
node.static = false;
47384720
parent = previousParent;
47394721
return node;
@@ -4775,7 +4757,6 @@ function deserializeTSIndexSignature(pos) {
47754757
});
47764758
node.parameters = deserializeVecTSIndexSignatureName(pos + 8);
47774759
node.typeAnnotation = deserializeBoxTSTypeAnnotation(pos + 32);
4778-
node.accessibility = null;
47794760
parent = previousParent;
47804761
return node;
47814762
}
@@ -4847,7 +4828,6 @@ function deserializeTSMethodSignature(pos) {
48474828
node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 24);
48484829
node.params = params;
48494830
node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 48);
4850-
node.accessibility = null;
48514831
node.readonly = false;
48524832
node.static = false;
48534833
parent = previousParent;

napi/parser/generated/deserialize/js.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,6 @@ function deserializeArrowFunctionExpression(pos) {
18131813
expression === true && (body = body.body[0].expression);
18141814
node.params = deserializeBoxFormalParameters(pos + 16);
18151815
node.body = body;
1816-
node.id = null;
18171816
node.generator = false;
18181817
return node;
18191818
}
@@ -2350,7 +2349,6 @@ function deserializeNullLiteral(pos) {
23502349
start,
23512350
end,
23522351
};
2353-
node.value = null;
23542352
node.raw = start === 0 && end === 0 ? null : 'null';
23552353
return node;
23562354
}
@@ -3522,7 +3520,6 @@ function deserializeTSPropertySignature(pos) {
35223520
};
35233521
node.key = deserializePropertyKey(pos + 8);
35243522
node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 24);
3525-
node.accessibility = null;
35263523
node.static = false;
35273524
return node;
35283525
}
@@ -3559,7 +3556,6 @@ function deserializeTSIndexSignature(pos) {
35593556
};
35603557
node.parameters = deserializeVecTSIndexSignatureName(pos + 8);
35613558
node.typeAnnotation = deserializeBoxTSTypeAnnotation(pos + 32);
3562-
node.accessibility = null;
35633559
return node;
35643560
}
35653561

@@ -3619,7 +3615,6 @@ function deserializeTSMethodSignature(pos) {
36193615
node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 24);
36203616
node.params = params;
36213617
node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 48);
3622-
node.accessibility = null;
36233618
node.readonly = false;
36243619
node.static = false;
36253620
return node;

napi/parser/generated/deserialize/js_parent.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,6 @@ function deserializeArrowFunctionExpression(pos) {
21082108
}
21092109
node.params = deserializeBoxFormalParameters(pos + 16);
21102110
node.body = body;
2111-
node.id = null;
21122111
node.generator = false;
21132112
parent = previousParent;
21142113
return node;
@@ -2728,7 +2727,6 @@ function deserializeNullLiteral(pos) {
27282727
end,
27292728
parent,
27302729
});
2731-
node.value = null;
27322730
node.raw = start === 0 && end === 0 ? null : 'null';
27332731
parent = previousParent;
27342732
return node;
@@ -4103,7 +4101,6 @@ function deserializeTSPropertySignature(pos) {
41034101
});
41044102
node.key = deserializePropertyKey(pos + 8);
41054103
node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 24);
4106-
node.accessibility = null;
41074104
node.static = false;
41084105
parent = previousParent;
41094106
return node;
@@ -4143,7 +4140,6 @@ function deserializeTSIndexSignature(pos) {
41434140
});
41444141
node.parameters = deserializeVecTSIndexSignatureName(pos + 8);
41454142
node.typeAnnotation = deserializeBoxTSTypeAnnotation(pos + 32);
4146-
node.accessibility = null;
41474143
parent = previousParent;
41484144
return node;
41494145
}
@@ -4211,7 +4207,6 @@ function deserializeTSMethodSignature(pos) {
42114207
node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 24);
42124208
node.params = params;
42134209
node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 48);
4214-
node.accessibility = null;
42154210
node.readonly = false;
42164211
node.static = false;
42174212
parent = previousParent;

napi/parser/generated/deserialize/js_range.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,6 @@ function deserializeArrowFunctionExpression(pos) {
19781978
expression === true && (body = body.body[0].expression);
19791979
node.params = deserializeBoxFormalParameters(pos + 16);
19801980
node.body = body;
1981-
node.id = null;
19821981
node.generator = false;
19831982
return node;
19841983
}
@@ -2558,7 +2557,6 @@ function deserializeNullLiteral(pos) {
25582557
end,
25592558
range: [start, end],
25602559
};
2561-
node.value = null;
25622560
node.raw = start === 0 && end === 0 ? null : 'null';
25632561
return node;
25642562
}
@@ -3886,7 +3884,6 @@ function deserializeTSPropertySignature(pos) {
38863884
};
38873885
node.key = deserializePropertyKey(pos + 8);
38883886
node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 24);
3889-
node.accessibility = null;
38903887
node.static = false;
38913888
return node;
38923889
}
@@ -3924,7 +3921,6 @@ function deserializeTSIndexSignature(pos) {
39243921
};
39253922
node.parameters = deserializeVecTSIndexSignatureName(pos + 8);
39263923
node.typeAnnotation = deserializeBoxTSTypeAnnotation(pos + 32);
3927-
node.accessibility = null;
39283924
return node;
39293925
}
39303926

@@ -3988,7 +3984,6 @@ function deserializeTSMethodSignature(pos) {
39883984
node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 24);
39893985
node.params = params;
39903986
node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 48);
3991-
node.accessibility = null;
39923987
node.readonly = false;
39933988
node.static = false;
39943989
return node;

napi/parser/generated/deserialize/js_range_parent.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,6 @@ function deserializeArrowFunctionExpression(pos) {
21942194
}
21952195
node.params = deserializeBoxFormalParameters(pos + 16);
21962196
node.body = body;
2197-
node.id = null;
21982197
node.generator = false;
21992198
parent = previousParent;
22002199
return node;
@@ -2835,7 +2834,6 @@ function deserializeNullLiteral(pos) {
28352834
range: [start, end],
28362835
parent,
28372836
});
2838-
node.value = null;
28392837
node.raw = start === 0 && end === 0 ? null : 'null';
28402838
parent = previousParent;
28412839
return node;
@@ -4307,7 +4305,6 @@ function deserializeTSPropertySignature(pos) {
43074305
});
43084306
node.key = deserializePropertyKey(pos + 8);
43094307
node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 24);
4310-
node.accessibility = null;
43114308
node.static = false;
43124309
parent = previousParent;
43134310
return node;
@@ -4348,7 +4345,6 @@ function deserializeTSIndexSignature(pos) {
43484345
});
43494346
node.parameters = deserializeVecTSIndexSignatureName(pos + 8);
43504347
node.typeAnnotation = deserializeBoxTSTypeAnnotation(pos + 32);
4351-
node.accessibility = null;
43524348
parent = previousParent;
43534349
return node;
43544350
}
@@ -4418,7 +4414,6 @@ function deserializeTSMethodSignature(pos) {
44184414
node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 24);
44194415
node.params = params;
44204416
node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 48);
4421-
node.accessibility = null;
44224417
node.readonly = false;
44234418
node.static = false;
44244419
parent = previousParent;

0 commit comments

Comments
 (0)