/** * Some util functions to generate a AST node for transform */ import { ClassDeclaration, DecoratorNode, ImportStatement, NamedTypeNode, NamespaceDeclaration, Range, Statement, TypeName } from "assemblyscript"; /** * A helper for generate NamedTypeNode which may be namespaced type * @param range * @param typeName * @param isNullable * @returns */ export declare function genNamedTypeNode(range: Range, typeName: string, isNullable?: boolean): NamedTypeNode; /** * Add an interface to be implemented to a class. * @param node class needed to implement a interface * @param interfaceName The interface path * @returns node */ export declare function addImplement(node: ClassDeclaration, interfaceName: string): ClassDeclaration; /** * Add interface list to be implemented to a class. * @param node class needed to implement a interface * @param interfaceNames The interface path list * @returns node */ export declare function addImplements(node: ClassDeclaration, interfaceNames: string[]): ClassDeclaration; /** * append `@serialize` to a declaration * @param range node range * @param decl declaration node */ export declare function addSerializeDecorator(decl: { range: Range; decorators: DecoratorNode[] | null; }): void; /** * append `@deserialize` to a declaration * @param range node range * @param decl declaration node */ export declare function addDeserializeDecorator(decl: { range: Range; decorators: DecoratorNode[] | null; }): void; /** * append a decorator to a declaration * @param range node range * @param decl declaration node pending to be decorated */ export declare function addDecorator(decl: { decorators: DecoratorNode[] | null; }, decorator: DecoratorNode): void; /** * genTypeName create type name for namespaced type such as `__lang.AccountId`. * @param name type name * @param range * @returns typeName ast node */ export declare function genTypeName(name: string, range: Range): TypeName; /** * create a namespace * @param range related code range * @param members all stmts in namespace */ export declare function genNamespcae(range: Range, namepsace: string, members: Statement[]): NamespaceDeclaration; /** * Genetate an import statement, e.g.`import * as __lang from "ask-lang"` * @param namespace imported namespaced * @param path module path * @param range * @returns ImportStatement */ export declare function genImportStatement(namespace: string, path: string, range: Range): ImportStatement;