Skip to content

Commit addacaa

Browse files
authored
simplify
1 parent ef3abe4 commit addacaa

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/plugin.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,10 @@ export function makePlugin<EnvSpecificOptions>(loadOptions: (opts: EnvSpecificOp
172172
parentPath: null,
173173
container: state.ast,
174174
});
175-
const p = program.get('body');
176175
for (const i of imports) {
177-
const idx = state.ast.program.body.indexOf(i);
178-
const impNodePath = p[idx] as NodePath<t.ImportDeclaration>;
179-
const specifiers = impNodePath.get('specifiers');
176+
const specifiers = i.specifiers;
180177
for (const specifier of specifiers) {
181-
const local = specifier.get('local');
178+
const local = specifier.local;
182179
if (!state.scope.getBinding(local.node.name)?.referencePaths.length) {
183180
state.scope.getBinding(local.node.name)?.referencePaths.push(program);
184181
}

0 commit comments

Comments
 (0)