Content-Length: 341316 | pFad | https://github.com/babel/babel/commit/c7e6806e2194deb36c330f543409c792592b22d4

94 Add `t.buildUndefinedNode` (#15893) · babel/babel@c7e6806 · GitHub
Skip to content

Commit c7e6806

Browse files
Add t.buildUndefinedNode (#15893)
* add * JLHwung feedback --------- Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
1 parent 38ee8b4 commit c7e6806

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/babel-traverse/src/scope/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import {
4040
memberExpression,
4141
numericLiteral,
4242
toIdentifier,
43-
unaryExpression,
4443
variableDeclaration,
4544
variableDeclarator,
4645
isRecordExpression,
@@ -50,6 +49,7 @@ import {
5049
isMetaProperty,
5150
isPrivateName,
5251
isExportDeclaration,
52+
buildUndefinedNode,
5353
} from "@babel/types";
5454
import * as t from "@babel/types";
5555
import { scope as scopeCache } from "../cache.ts";
@@ -783,7 +783,7 @@ export default class Scope {
783783
}
784784

785785
buildUndefinedNode() {
786-
return unaryExpression("void", numericLiteral(0), true);
786+
return buildUndefinedNode();
787787
}
788788

789789
registerConstantViolation(path: NodePath) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { numericLiteral, unaryExpression } from "./generated/index.ts";
2+
3+
export function buildUndefinedNode() {
4+
return unaryExpression("void", numericLiteral(0), true);
5+
}

packages/babel-types/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export { default as createFlowUnionType } from "./builders/flow/createFlowUnionT
1414
export { default as createTSUnionType } from "./builders/typescript/createTSUnionType.ts";
1515
export * from "./builders/generated/index.ts";
1616
export * from "./builders/generated/uppercase.js";
17+
export * from "./builders/productions.ts";
1718

1819
// clone
1920
export { default as cloneNode } from "./clone/cloneNode.ts";

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/babel/babel/commit/c7e6806e2194deb36c330f543409c792592b22d4

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy