MCPcopy Create free account
hub / github.com/babel/babel / checkImportPhase

Function checkImportPhase

packages/babel-parser/src/parser/statement.ts:2923–2940  ·  view source on GitHub ↗
(node: Undone<N.ImportDeclaration>)

Source from the content-addressed store, hash-verified

2921 }
2922
2923 checkImportPhase(node: Undone<N.ImportDeclaration>) {
2924 if (node.phase == null) {
2925 return;
2926 }
2927 const { specifiers } = node;
2928 const singleBindingType =
2929 specifiers.length === 1 ? specifiers[0].type : null;
2930
2931 if (node.phase === "source") {
2932 if (singleBindingType !== "ImportDefaultSpecifier") {
2933 this.raise(Errors.SourcePhaseImportRequiresDefault, node);
2934 }
2935 } else if (node.phase === "defer") {
2936 if (singleBindingType !== "ImportNamespaceSpecifier") {
2937 this.raise(Errors.DeferImportRequiresNamespace, node);
2938 }
2939 }
2940 }
2941
2942 isPotentialImportPhase(isExport: boolean): boolean {
2943 if (isExport) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected