MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / walkPattern

Function walkPattern

tools/acorn-optimizer.mjs:112–128  ·  view source on GitHub ↗
(node, onExpr, onBoundIdent)

Source from the content-addressed store, hash-verified

110
111// Traverse a pattern node (identifier, object/array pattern, etc) invoking onExpr on any nested expressions and onBoundIdent on any bound identifiers.
112function walkPattern(node, onExpr, onBoundIdent) {
113 recursiveWalk(node, {
114 AssignmentPattern(node, c) {
115 c(node.left);
116 onExpr(node.right);
117 },
118 Property(node, c) {
119 if (node.computed) {
120 onExpr(node.key);
121 }
122 c(node.value);
123 },
124 Identifier({name}) {
125 onBoundIdent(name);
126 },
127 });
128}
129
130function hasSideEffects(node) {
131 // Conservative analysis.

Callers 3

VariableDeclarationFunction · 0.85
handleFunctionFunction · 0.85
VariableDeclaratorFunction · 0.85

Calls 1

recursiveWalkFunction · 0.85

Tested by

no test coverage detected