MCPcopy Create free account
hub / github.com/reactjs/react-rails / visitStructuredVariable

Function visitStructuredVariable

lib/assets/javascripts/JSXTransformer.js:14178–14189  ·  view source on GitHub ↗
(traverse, node, path, state)

Source from the content-addressed store, hash-verified

14176// -------------------------------------------------------
14177
14178function visitStructuredVariable(traverse, node, path, state) {
14179 // Allocate new temp for the pattern.
14180 utils.append(utils.getTempVar(state.localScope.tempVarIndex) + '=', state);
14181 // Skip the pattern and assign the init to the temp.
14182 utils.catchupWhiteSpace(node.init.range[0], state);
14183 traverse(node.init, path, state);
14184 utils.catchup(node.init.range[1], state);
14185 // Render the destructured data.
14186 utils.append(',' + getDestructuredComponents(node.id, state), state);
14187 state.localScope.tempVarIndex++;
14188 return false;
14189}
14190
14191visitStructuredVariable.test = function(node, path, state) {
14192 return node.type === Syntax.VariableDeclarator &&

Callers

nothing calls this directly

Calls 2

traverseFunction · 0.85

Tested by

no test coverage detected