import { ArkFile, Language } from './ArkFile'; import { FullPosition, LineColPosition } from '../base/Position'; import { ExportInfo, FromInfo } from './ArkExport'; import { ArkBaseModel } from './ArkBaseModel'; import { ArkError } from '../common/ArkError'; /** * Shift amount for import type encoding in ImportInfo tags field. * Uses CLASS_SPECIFIC_TAG_SHIFT as the base offset for class-specific properties. */ export declare const IMPORT_TYPE_SHIFT = 16; /** * Mask for extracting import type from ImportInfo tags field. * Covers 3 bits for up to 8 import type values. * Uses value encoding (like ClassCategory) instead of bitmask encoding. */ export declare const IMPORT_TYPE_MASK: number; /** * Import type enum values for encoding in ImportInfo tags field. * Uses value encoding (sequential numbers) instead of bitmask encoding. * This allows storing up to 8 values using only 3 bits. */ export declare enum ImportType { /** Value 0: None/Unknown import type (side-effect import like `import '../xxx'`) */ NONE_IMPORT = 0, /** Value 1: Identifier import (default import) */ IDENTIFIER_IMPORT = 1, /** Value 2: Named imports */ NAMED_IMPORTS_IMPORT = 2, /** Value 3: Namespace import */ NAMESPACE_IMPORT = 3, /** Value 4: Equals import */ EQUALS_IMPORT = 4, /** Value 5: Type alias import (used in ArkIRTransformer for import type nodes) */ TYPE_ALIAS_IMPORT = 5 } /** * @category core/model */ export declare class ImportInfo extends ArkBaseModel implements FromInfo { private importClauseName; private importFrom?; private nameBeforeAs?; private declaringArkFile; /** The full position of the entire import statement in the source file. */ private originFullPosition; /** The full position of the specific import item within the import statement. * Undefined when this import info has no item (e.g., namespace import). */ private itemOriginFullPosition?; private sourceCode?; private lazyExportInfo?; constructor(); /** * Returns the program language of the file where this import info defined. */ getLanguage(): Language; /** * Builds the import info with the given parameters. * @param importClauseName - The import clause name * @param importTypeTag - The import type tag (ImportType.IDENTIFIER_IMPORT, ImportType.NAMED_IMPORTS_IMPORT, etc.) * @param importFrom - The import source path * @param originTsPosition - The original TypeScript position * @param modifiers - The modifiers value * @param nameBeforeAs - The name before 'as' keyword (optional) */ build(importClauseName: string, importTypeTag: number, importFrom: string, originFullPosition: FullPosition, modifiers: number, nameBeforeAs?: string, itemOriginFullPosition?: FullPosition): void; getOriginName(): string; /** * Returns the export information, i.e., the actual reference generated at the time of call. * The export information includes: clause's name, clause's type, modifiers, location * where it is exported from, etc. If the export information could not be found, **null** will be returned. * @returns The export information. If there is no export information, the return will be a **null**. */ getLazyExportInfo(): ExportInfo | null; getExportInfo(): ExportInfo | null | undefined; setExportInfo(exportInfo: ExportInfo | null): void; setDeclaringArkFile(declaringArkFile: ArkFile): void; getDeclaringArkFile(): ArkFile; getImportClauseName(): string; setImportClauseName(importClauseName: string): void; /** * Gets the import type as an ImportType value. * Returns the encoded import type value (ImportType.NONE_IMPORT, ImportType.IDENTIFIER_IMPORT, etc.) * If no import type is set, returns ImportType.NONE_IMPORT (0). * @returns The import type as an ImportType value */ getImportTypeTag(): ImportType; /** * Sets the import type using an ImportType value. * Uses value encoding (setTagValue) instead of bitmask encoding. * @param importTypeTag - The import type value (ImportType.IDENTIFIER_IMPORT, ImportType.NAMED_IMPORTS_IMPORT, etc.) */ setImportTypeTag(importTypeTag: ImportType): void; /** * Gets the import type as a string value. * @deprecated Use {@link getImportTypeTag} instead for better type safety and performance. * @returns The import type string: '', 'Identifier', 'NamedImports', 'NamespaceImport', 'EqualsImport', or 'TypeAlias' */ getImportType(): string; /** * Sets the import type using a string value. * @deprecated Use {@link setImportTypeTag} instead for better type safety and performance. * @param importType - The import type string: '', 'Identifier', 'NamedImports', 'NamespaceImport', 'EqualsImport', or 'TypeAlias' */ setImportType(importType: string): void; setImportFrom(importFrom: string): void; getNameBeforeAs(): string | undefined; setNameBeforeAs(nameBeforeAs: string | undefined): void; /** * @deprecated Use setItemOriginFullPosition() instead. * @param originTsPosition - The LineColPosition to set. */ setOriginTsPosition(originTsPosition: LineColPosition): void; /** * @deprecated Use getItemOriginFullPosition() instead. * @returns The LineColPosition of the import item. */ getOriginTsPosition(): LineColPosition; /** * Sets the full position of the entire import statement in the source file. * @param originFullPosition - The full position in the source code to set. */ setOriginFullPosition(originFullPosition: FullPosition): void; /** * Returns the full position of the entire import statement in the source file. * @returns The full position in the source code of this import statement. */ getOriginFullPosition(): FullPosition; /** * Sets the full position of the specific import item within the import statement. * @param itemOriginFullPosition - The full position in the source code to set. */ setItemOriginFullPosition(itemOriginFullPosition: FullPosition): void; /** * Returns the full position of the specific import item within the import statement. * @returns The full position in the source code of the import item, or undefined if this * import info has no item (e.g., namespace import or default import). */ getItemOriginFullPosition(): FullPosition | undefined; /** * @deprecated Source text is now stored on ArkFile only. This method has no effect. * @param _tsSourceCode - The source code (ignored). */ setTsSourceCode(_tsSourceCode: string): void; /** * Returns the source text of the import extracted from the declaring ArkFile * using the import's origin position. Implements lazy loading with caching. * @returns The source text of the import, or empty string if unavailable. */ getTsSourceCode(): string; /** * Clears the cached source text, forcing re-extraction on next getTsSourceCode call. */ clearSourceCode(): void; getFrom(): string | undefined; isDefault(): boolean; validate(): ArkError; clearAllReferences(): void; } //# sourceMappingURL=ArkImport.d.ts.map