File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -8,20 +8,12 @@ export function getNodeChildren(node: Node): Node[] | undefined {
88}
99
1010/** @internal */
11- export function setNodeChildren ( node : Node , children : Node [ ] ) {
11+ export function setNodeChildren ( node : Node , children : Node [ ] ) : Node [ ] {
1212 nodeChildren . set ( node , children ) ;
13+ return children ;
1314}
1415
1516/** @internal */
1617export function unsetNodeChildren ( node : Node ) {
1718 nodeChildren . delete ( node ) ;
1819}
19-
20- /** @internal */
21- export function getOrSetNodeChildren ( node : Node , fn : ( ) => Node [ ] ) : Node [ ] {
22- let children = getNodeChildren ( node ) ;
23- if ( children === undefined ) {
24- setNodeChildren ( node , children = fn ( ) ) ;
25- }
26- return children ;
27- }
Original file line number Diff line number Diff line change @@ -106,10 +106,10 @@ import {
106106 getNameFromPropertyName ,
107107 getNewLineCharacter ,
108108 getNewLineOrDefaultFromHost ,
109+ getNodeChildren ,
109110 getNonAssignedNameOfDeclaration ,
110111 getNormalizedAbsolutePath ,
111112 getObjectFlags ,
112- getOrSetNodeChildren ,
113113 getQuotePreference ,
114114 getScriptKind ,
115115 getSetExternalModuleIndicator ,
@@ -438,7 +438,7 @@ class NodeObject<TKind extends SyntaxKind> implements Node {
438438
439439 public getChildren ( sourceFile ?: SourceFileLike ) : Node [ ] {
440440 this . assertHasRealPosition ( "Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine" ) ;
441- return getOrSetNodeChildren ( this , ( ) => createChildren ( this , sourceFile ) ) ;
441+ return getNodeChildren ( this ) ?? setNodeChildren ( this , createChildren ( this , sourceFile ) ) ;
442442 }
443443
444444 public getFirstToken ( sourceFile ?: SourceFileLike ) : Node | undefined {
You can’t perform that action at this time.
0 commit comments