MCPcopy
hub / github.com/umijs/babel-plugin-import / buildExpressionHandler

Method buildExpressionHandler

src/Plugin.js:103–116  ·  view source on GitHub ↗
(node, props, path, state)

Source from the content-addressed store, hash-verified

101 }
102
103 buildExpressionHandler(node, props, path, state) {
104 const file = (path && path.hub && path.hub.file) || (state && state.file);
105 const { types } = this;
106 const pluginState = this.getPluginState(state);
107 props.forEach(prop => {
108 if (!types.isIdentifier(node[prop])) return;
109 if (
110 pluginState.specified[node[prop].name] &&
111 types.isImportSpecifier(path.scope.getBinding(node[prop].name).path)
112 ) {
113 node[prop] = this.importMethod(pluginState.specified[node[prop].name], file, pluginState); // eslint-disable-line
114 }
115 });
116 }
117
118 buildDeclaratorHandler(node, prop, path, state) {
119 const file = (path && path.hub && path.hub.file) || (state && state.file);

Callers 13

ArrayExpressionMethod · 0.95
LogicalExpressionMethod · 0.95
ConditionalExpressionMethod · 0.95
IfStatementMethod · 0.95
ExpressionStatementMethod · 0.95
ReturnStatementMethod · 0.95
BinaryExpressionMethod · 0.95
NewExpressionMethod · 0.95
SwitchStatementMethod · 0.95
SwitchCaseMethod · 0.95
ClassDeclarationMethod · 0.95

Calls 2

getPluginStateMethod · 0.95
importMethodMethod · 0.95

Tested by

no test coverage detected