MCPcopy Create free account
hub / github.com/SplootCode/splootcode / clean

Method clean

packages/language-web/types/js/if.ts:61–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 // }
60
61 clean() {
62 this.getTrueBlock().children.forEach((child: SplootNode, index: number) => {
63 if (child.type === SPLOOT_EXPRESSION) {
64 if ((child as SplootExpression).getTokenSet().getCount() === 0) {
65 this.getTrueBlock().removeChild(index)
66 }
67 }
68 })
69 // this.getElseBlock().children.forEach((child: SplootNode, index: number) => {
70 // if (child.type === SPLOOT_EXPRESSION) {
71 // if ((child as SplootExpression).getTokenSet().getCount() === 0) {
72 // this.getElseBlock().removeChild(index);
73 // }
74 // }
75 // });
76 }
77
78 generateJsAst(): ASTNode {
79 const test = (this.getCondition().getChild(0) as JavaScriptSplootNode).generateJsAst() as ExpressionKind

Callers

nothing calls this directly

Calls 4

getTrueBlockMethod · 0.95
getCountMethod · 0.80
removeChildMethod · 0.80
getTokenSetMethod · 0.45

Tested by

no test coverage detected