• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import {
17    global,
18    passNode,
19    passNodeArray,
20    unpackNonNullableNode,
21    unpackNode,
22    unpackNodeArray,
23    assertValidPeer,
24    AstNode,
25    Es2pandaAstNodeType,
26    KNativePointer,
27    nodeByType,
28    ArktsObject,
29    unpackString
30} from "../../reexport-for-generated"
31
32import { ImportDeclaration } from "./ImportDeclaration"
33import { ImportSource } from "./ImportSource"
34import { Es2pandaImportKinds } from "./../Es2pandaEnums"
35import { StringLiteral } from "./StringLiteral"
36import { Es2pandaImportFlags } from "./../../Es2pandaEnums"
37export class ETSImportDeclaration extends ImportDeclaration {
38     constructor(pointer: KNativePointer) {
39        assertValidPeer(pointer, Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION)
40        super(pointer)
41
42    }
43    static createETSImportDeclaration(source: StringLiteral | undefined, specifiers: readonly AstNode[], importKind: Es2pandaImportKinds, program: ArktsObject, flags: Es2pandaImportFlags): ETSImportDeclaration {
44        return new ETSImportDeclaration(global.es2panda._CreateETSImportDeclaration(global.context, passNode(source), passNodeArray(specifiers), specifiers.length, importKind, passNode(program), flags))
45    }
46    static updateETSImportDeclaration(original: ETSImportDeclaration | undefined, source: StringLiteral | undefined, specifiers: readonly AstNode[], importKind: Es2pandaImportKinds): ETSImportDeclaration {
47        return new ETSImportDeclaration(global.generatedEs2panda._UpdateETSImportDeclaration(global.context, passNode(original), passNode(source), passNodeArray(specifiers), specifiers.length, importKind))
48    }
49    get hasDecl(): boolean {
50        return global.generatedEs2panda._ETSImportDeclarationHasDeclConst(global.context, this.peer)
51    }
52    get isPureDynamic(): boolean {
53        return global.generatedEs2panda._ETSImportDeclarationIsPureDynamicConst(global.context, this.peer)
54    }
55    get assemblerName(): string {
56        return unpackString(global.generatedEs2panda._ETSImportDeclarationAssemblerNameConst(global.context, this.peer))
57    }
58    // get source(): StringLiteral | undefined {
59    //     return unpackNode(global.generatedEs2panda._ETSImportDeclarationSourceConst(global.context, this.peer))
60    // }
61    get resolvedSource(): StringLiteral | undefined {
62        return unpackNode(global.generatedEs2panda._ETSImportDeclarationResolvedSourceConst(global.context, this.peer))
63    }
64}
65export function isETSImportDeclaration(node: AstNode): node is ETSImportDeclaration {
66    return node instanceof ETSImportDeclaration
67}
68if (!nodeByType.has(Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION)) {
69    nodeByType.set(Es2pandaAstNodeType.AST_NODE_TYPE_ETS_IMPORT_DECLARATION, ETSImportDeclaration)
70}
71