Skip to content

Commit 6bbcdf0

Browse files
committed
perf: remove redundant 'T_' prefix trim
1 parent 1ff8603 commit 6bbcdf0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/variables.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,9 +1568,9 @@ export class RealVariable extends Variable {
15681568

15691569
/*
15701570
* Some constants from source code.
1571-
* Using them in such way is quite safe, because they haven't
1572-
* changed for many years (and I do not think will be changed
1573-
* in near future).
1571+
*
1572+
* Using them in such way is quite safe, because they haven't changed for many
1573+
* years (and I do not think will be changed in near future).
15741574
*/
15751575
const InvalidOid = 0;
15761576
const oidIsValid = (oid: number) => Number.isInteger(oid) && oid !== InvalidOid;
@@ -1585,13 +1585,18 @@ const InvalidAttrNumber = 0;
15851585
export class NodeVariable extends RealVariable {
15861586
/**
15871587
* Real tag of node without 'T_' prefix.
1588-
* @example AggPath
1588+
*
1589+
* NOTE: if you want to remove 'T_' prefix, then do not use replace('T_', ''),
1590+
* because it can replace substring *inside* typename. Instead
1591+
* for check use `startsWith('T_')` and to trim `substring(2)`
1592+
*
1593+
* @example AggPath, List
15891594
*/
15901595
realNodeTag: string;
15911596

15921597
constructor(realNodeTag: string, args: RealVariableArgs) {
15931598
super(args);
1594-
this.realNodeTag = realNodeTag.replace('T_', '');
1599+
this.realNodeTag = realNodeTag;
15951600
}
15961601

15971602
protected computeEffectiveType() {

0 commit comments

Comments
 (0)