UNPKG

@lcap/nasl

Version:

NetEase Application Specific Language

25 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.transform2GlobalLogicDeclaration = void 0; const utils_1 = require("./utils"); const transform2TypeAnnotation_1 = require("./transform2TypeAnnotation"); const transform2LogicItem_1 = require("./transform2LogicItem"); function transform2GlobalLogicDeclaration(node, parseState) { const logic = new utils_1.naslTypes.Logic(); parseState.nodeName = logic.name = node.id.name; logic.description = (0, utils_1.fetchFromComments)(node.leadingComments); logic.body = [ new utils_1.naslTypes.Start(), new utils_1.naslTypes.End(), ]; logic.params = node.params.map((param) => (0, transform2LogicItem_1.transform2Param)(param, { ...parseState, transformType: 'attr' })).filter(Boolean); if (node.returnType && node.returnType.typeAnnotation.type !== 'TSVoidKeyword') { logic.returns.push(new utils_1.naslTypes.Return({ name: 'result', typeAnnotation: (0, transform2TypeAnnotation_1.transform2TypeAnnotation)(node.returnType.typeAnnotation, parseState) || undefined, })); } return logic; } exports.transform2GlobalLogicDeclaration = transform2GlobalLogicDeclaration; //# sourceMappingURL=transform2GlobalLogicDeclaration.js.map