Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 20, 2023
1 parent 24606f4 commit 056a017
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
8 changes: 5 additions & 3 deletions src/ast/nodes/ImportExpression.ts
Expand Up @@ -15,7 +15,7 @@ import type NamespaceVariable from '../variables/NamespaceVariable';
import type ArrowFunctionExpression from './ArrowFunctionExpression';
import type AwaitExpression from './AwaitExpression';
import type CallExpression from './CallExpression';
import type FunctionDeclaration from './FunctionDeclaration';
import type FunctionExpression from './FunctionExpression';
import type Identifier from './Identifier';
import type MemberExpression from './MemberExpression';
import type * as NodeType from './NodeType';
Expand Down Expand Up @@ -95,15 +95,17 @@ export default class ImportExpression extends NodeBase {

const callExpression = memberExpression.parent as CallExpression;

console.log(callExpression);

if (
callExpression.arguments.length !== 1 ||
!['ArrowFunctionExpression', 'FunctionDeclaration'].includes(
!['ArrowFunctionExpression', 'FunctionExpression'].includes(
callExpression.arguments[0].type
)
)
return;

const callback = callExpression.arguments[0] as ArrowFunctionExpression | FunctionDeclaration;
const callback = callExpression.arguments[0] as ArrowFunctionExpression | FunctionExpression;
if (callback.params.length !== 1 || callback.params[0].type !== 'ObjectPattern') return;

return getDeterministicObjectDestructure(callback.params[0] as ObjectPattern);
Expand Down
Expand Up @@ -41,10 +41,6 @@ function bar3() {
return 'bar3';
}

function baz3() {
return 'baz3'; // this should be tree-shaken
}

console.log('side-effect3');

function foo2() {
Expand All @@ -59,19 +55,13 @@ function baz2() {
return 'baz2';
}

function qux2() {
return 'qux2'; // this should be tree-shaken
}

var sub2 = /*#__PURE__*/Object.freeze({
__proto__: null,
bar2: bar2,
bar3: bar3,
baz2: baz2,
baz3: baz3,
foo2: foo2,
foo3: foo3,
qux2: qux2,
reexported: bar3
});

Expand Down

0 comments on commit 056a017

Please sign in to comment.