@lcap/nasl 3.7.3-beta.1 → 3.8.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mocharc.js +0 -1
- package/out/automate/engine/utils.js +6 -1
- package/out/automate/engine/utils.js.map +1 -1
- package/out/bak/translator.js +37 -0
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/shared/utils.d.ts +1 -0
- package/out/breakpoint/shared/utils.js +1 -1
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +11 -0
- package/out/common/BaseNode.js +101 -5
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Annotatable__.d.ts +109 -0
- package/out/concepts/Annotatable__.js +161 -0
- package/out/concepts/Annotatable__.js.map +1 -0
- package/out/concepts/AnnotationProperty__.d.ts +48 -0
- package/out/concepts/AnnotationProperty__.js +74 -0
- package/out/concepts/AnnotationProperty__.js.map +1 -0
- package/out/concepts/Annotation__.d.ts +128 -0
- package/out/concepts/Annotation__.js +248 -0
- package/out/concepts/Annotation__.js.map +1 -0
- package/out/concepts/App__.d.ts +14 -26
- package/out/concepts/App__.js +50 -20
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/ApplyAnnotation__.d.ts +87 -0
- package/out/concepts/ApplyAnnotation__.js +140 -0
- package/out/concepts/ApplyAnnotation__.js.map +1 -0
- package/out/concepts/Argument__.d.ts +19 -0
- package/out/concepts/Argument__.js +126 -0
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/AssigneeV2__.d.ts +169 -0
- package/out/concepts/AssigneeV2__.js +176 -1
- package/out/concepts/AssigneeV2__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/AuthLogic__.js +1 -1
- package/out/concepts/AuthLogic__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +1 -0
- package/out/concepts/BooleanLiteral__.js +9 -0
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/BusinessLogic__.js +1 -1
- package/out/concepts/BusinessLogic__.js.map +1 -1
- package/out/concepts/CallFunction__.js +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +15 -0
- package/out/concepts/CallLogic__.js +149 -17
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/ConnectorLogic__.js +1 -1
- package/out/concepts/ConnectorLogic__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.d.ts +0 -2
- package/out/concepts/DatabaseTypeAnnotation__.js +0 -20
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
- package/out/concepts/DepartmentManagerV2__.d.ts +29 -0
- package/out/concepts/DepartmentManagerV2__.js +56 -0
- package/out/concepts/DepartmentManagerV2__.js.map +1 -0
- package/out/concepts/DepartmentV2__.d.ts +33 -0
- package/out/concepts/DepartmentV2__.js +63 -0
- package/out/concepts/DepartmentV2__.js.map +1 -0
- package/out/concepts/DirectManagerV2__.d.ts +25 -0
- package/out/concepts/DirectManagerV2__.js +53 -0
- package/out/concepts/DirectManagerV2__.js.map +1 -0
- package/out/concepts/End__.js +9 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +0 -2
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +2 -2
- package/out/concepts/Entity__.js +4 -7
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +1 -12
- package/out/concepts/EnumItem__.js +17 -49
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/EnumSelectSetter__.d.ts +4 -0
- package/out/concepts/EnumSelectSetter__.js +7 -0
- package/out/concepts/EnumSelectSetter__.js.map +1 -1
- package/out/concepts/Enum__.js +1 -4
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +52 -48
- package/out/concepts/FrontendLibrary__.js +45 -36
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/FrontendType__.d.ts +4 -0
- package/out/concepts/FrontendType__.js +7 -0
- package/out/concepts/FrontendType__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +2 -0
- package/out/concepts/Frontend__.js +21 -2
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/HistoryProcessV2__.js +4 -1
- package/out/concepts/HistoryProcessV2__.js.map +1 -1
- package/out/concepts/I18nInfo__.d.ts +0 -1
- package/out/concepts/I18nInfo__.js +0 -7
- package/out/concepts/I18nInfo__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +2 -0
- package/out/concepts/Identifier__.js +31 -0
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Interface__.js +1 -4
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +16 -1
- package/out/concepts/Logic__.js +133 -15
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/ManagerV2__.d.ts +34 -0
- package/out/concepts/ManagerV2__.js +61 -0
- package/out/concepts/ManagerV2__.js.map +1 -0
- package/out/concepts/MatchCase__.d.ts +2 -2
- package/out/concepts/MatchCase__.js +7 -7
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -0
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +88 -0
- package/out/concepts/Module__.js +85 -0
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/OperatePermissionV2__.d.ts +1 -1
- package/out/concepts/OperatePermissionV2__.js.map +1 -1
- package/out/concepts/Param__.d.ts +4 -0
- package/out/concepts/Param__.js +13 -21
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElementV2__.d.ts +6 -1
- package/out/concepts/ProcessElementV2__.js +20 -0
- package/out/concepts/ProcessElementV2__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +7 -0
- package/out/concepts/ProcessElement__.js +47 -0
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessV2__.d.ts +1 -34
- package/out/concepts/ProcessV2__.js +3 -70
- package/out/concepts/ProcessV2__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +2 -2
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/StaticString__.d.ts +0 -4
- package/out/concepts/StaticString__.js +0 -11
- package/out/concepts/StaticString__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +1 -0
- package/out/concepts/StructureProperty__.js +14 -5
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +4 -0
- package/out/concepts/Structure__.js +6 -9
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SubLogic__.d.ts +418 -0
- package/out/concepts/SubLogic__.js +992 -0
- package/out/concepts/SubLogic__.js.map +1 -0
- package/out/concepts/Theme__.d.ts +9 -0
- package/out/concepts/Theme__.js +10 -0
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.d.ts +0 -1
- package/out/concepts/Transactional__.js +0 -7
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +18 -0
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +1 -0
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +6 -1
- package/out/concepts/ValidationRule__.js +6 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +8 -2
- package/out/concepts/ViewElement__.js +213 -32
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +10 -2
- package/out/concepts/View__.js +129 -17
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.processV2.d.ts +2 -0
- package/out/concepts/basics/stdlib/nasl.processV2.js +50 -4
- package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +1 -1
- package/out/concepts/basics/types/index.js +2 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/concepts/index__.d.ts +9 -0
- package/out/concepts/index__.js +9 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/concepts/utils/asserts.d.ts +409 -0
- package/out/concepts/utils/asserts.js +564 -14
- package/out/concepts/utils/asserts.js.map +1 -1
- package/out/concepts/utils/types.d.ts +33 -2
- package/out/generator/genBundleFiles.d.ts +13 -9
- package/out/generator/genBundleFiles.js +383 -63
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.js +2 -0
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/release-body/body.js +1 -0
- package/out/generator/release-body/body.js.map +1 -1
- package/out/generator/release-body/utils.d.ts +15 -7
- package/out/generator/release-body/utils.js +50 -7
- package/out/generator/release-body/utils.js.map +1 -1
- package/out/natural/genNaturalTS.js +2 -4
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/getContext/index.js +0 -2
- package/out/natural/getContext/index.js.map +1 -1
- package/out/natural/transformTS2UI.js.map +1 -1
- package/out/natural/transformTSCode.d.ts +1 -1
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/extendBaseNode.js +9 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/getLogics.js +10 -6
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +6 -0
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcessesV2.d.ts +3 -2
- package/out/server/getProcessesV2.js +15 -6
- package/out/server/getProcessesV2.js.map +1 -1
- package/out/server/naslServer.d.ts +5 -1
- package/out/server/naslServer.js +120 -30
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +4 -0
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.d.ts +2 -1
- package/out/service/storage/init.js +28 -71
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.d.ts +6 -2
- package/out/templator/genCreateBlock.js +25 -8
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.d.ts +22 -0
- package/out/templator/genCurdEditMultipleKeyBlock.js +60 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.d.ts +13 -3
- package/out/templator/genCurdMultipleKeyBlock.js +29 -23
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.d.ts +1 -1
- package/out/templator/genGetBlock.js +3 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genListViewBlock.d.ts +1 -1
- package/out/templator/genListViewBlock.js +3 -2
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.d.ts +1 -1
- package/out/templator/genSelectBlock.js +3 -2
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +9 -4
- package/out/templator/genTableBlock.js +31 -17
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.d.ts +2 -2
- package/out/templator/genUpdateBlock.js +11 -11
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/translator/types.d.ts +0 -4
- package/out/translator/utils.d.ts +0 -1
- package/out/translator/utils.js +1 -6
- package/out/translator/utils.js.map +1 -1
- package/out/utils/delay/index.d.ts +0 -0
- package/out/utils/delay/index.js +1 -0
- package/out/utils/delay/index.js.map +1 -0
- package/out/utils/env.d.ts +0 -4
- package/out/utils/env.js +3 -6
- package/out/utils/env.js.map +1 -1
- package/out/utils/index.d.ts +3 -2
- package/out/utils/index.js +18 -14
- package/out/utils/index.js.map +1 -1
- package/out/utils/time-slicing/controller.js.map +1 -1
- package/out/utils/types.d.ts +0 -17
- package/package.json +27 -20
- package/sandbox/stdlib/extension.component.ts +29 -0
- package/sandbox/stdlib/nasl.process.ts +17 -0
- package/sandbox/stdlib/nasl.processV2.ts +10 -5
- package/sandbox/stdlib/nasl.util.ts +3 -1
- package/src/automate/engine/utils.js +7 -2
- package/src/bak/translator.js +42 -1
- package/src/breakpoint/shared/utils.ts +2 -1
- package/src/common/BaseNode.ts +117 -5
- package/src/concepts/Annotatable__.ts +263 -0
- package/src/concepts/AnnotationProperty__.ts +102 -0
- package/src/concepts/Annotation__.ts +344 -0
- package/src/concepts/App__.ts +917 -26
- package/src/concepts/ApplyAnnotation__.ts +198 -0
- package/src/concepts/Argument__.ts +145 -1
- package/src/concepts/AssigneeV2__.ts +387 -1
- package/src/concepts/AuthLogicForCallInterface__.ts +1 -1
- package/src/concepts/AuthLogic__.ts +1 -1
- package/src/concepts/BooleanLiteral__.ts +9 -1
- package/src/concepts/BusinessLogic__.ts +1 -1
- package/src/concepts/CallFunction__.ts +1 -1
- package/src/concepts/CallLogic__.ts +153 -16
- package/src/concepts/ConnectorLogic__.ts +1 -1
- package/src/concepts/DatabaseTypeAnnotation__.ts +0 -11
- package/src/concepts/DepartmentManagerV2__.ts +70 -0
- package/src/concepts/DepartmentV2__.ts +75 -0
- package/src/concepts/DirectManagerV2__.ts +65 -0
- package/src/concepts/End__.ts +10 -1
- package/src/concepts/EntityProperty__.ts +0 -5
- package/src/concepts/Entity__.ts +5 -9
- package/src/concepts/EnumItem__.ts +16 -65
- package/src/concepts/EnumSelectSetter__.ts +6 -0
- package/src/concepts/Enum__.ts +1 -6
- package/src/concepts/ForEachStatement__.ts +1 -1
- package/src/concepts/FrontendLibrary__.ts +88 -80
- package/src/concepts/FrontendType__.ts +6 -0
- package/src/concepts/Frontend__.ts +26 -3
- package/src/concepts/HistoryProcessV2__.ts +5 -0
- package/src/concepts/I18nInfo__.ts +0 -5
- package/src/concepts/Identifier__.ts +32 -0
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/Interface__.ts +1 -6
- package/src/concepts/LogicItem__.ts +1 -0
- package/src/concepts/Logic__.ts +140 -17
- package/src/concepts/ManagerV2__.ts +78 -0
- package/src/concepts/MatchCase__.ts +9 -8
- package/src/concepts/MemberExpression__.ts +1 -0
- package/src/concepts/Module__.ts +194 -0
- package/src/concepts/OperatePermissionV2__.ts +1 -1
- package/src/concepts/Param__.ts +17 -20
- package/src/concepts/ProcessElementV2__.ts +23 -0
- package/src/concepts/ProcessElement__.ts +18 -0
- package/src/concepts/ProcessV2__.ts +4 -70
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/StaticString__.ts +0 -13
- package/src/concepts/StructureProperty__.ts +16 -7
- package/src/concepts/Structure__.ts +10 -11
- package/src/concepts/SubLogic__.ts +1516 -0
- package/src/concepts/Theme__.ts +9 -0
- package/src/concepts/Transactional__.ts +0 -5
- package/src/concepts/TriggerLauncher__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +17 -0
- package/src/concepts/TypeParam__.ts +3 -0
- package/src/concepts/ValidationRule__.ts +6 -1
- package/src/concepts/ViewElement__.ts +224 -34
- package/src/concepts/View__.ts +135 -22
- package/src/concepts/basics/stdlib/nasl.processV2.ts +56 -3
- package/src/concepts/basics/types/index.ts +1 -1
- package/src/concepts/index__.ts +9 -0
- package/src/concepts/utils/asserts.ts +595 -0
- package/src/concepts/utils/types.ts +53 -0
- package/src/generator/genBundleFiles.ts +408 -68
- package/src/generator/genMetaData.ts +3 -0
- package/src/generator/release-body/body.ts +1 -0
- package/src/generator/release-body/utils.ts +159 -55
- package/src/natural/genNaturalTS.ts +3 -5
- package/src/natural/getContext/index.ts +0 -2
- package/src/natural/transformTS2UI.ts +5 -2
- package/src/natural/transformTSCode.ts +2 -2
- package/src/server/extendBaseNode.ts +11 -2
- package/src/server/getLogics.ts +9 -7
- package/src/server/getMemberIdentifier.ts +7 -0
- package/src/server/getProcessesV2.ts +16 -6
- package/src/server/naslServer.ts +133 -30
- package/src/server/translator.ts +4 -0
- package/src/service/storage/init.ts +52 -97
- package/src/templator/genCreateBlock.ts +35 -14
- package/src/templator/genCurdEditMultipleKeyBlock.ts +65 -1
- package/src/templator/genCurdMultipleKeyBlock.ts +42 -23
- package/src/templator/genGetBlock.ts +4 -3
- package/src/templator/genListViewBlock.ts +3 -3
- package/src/templator/genSelectBlock.ts +4 -2
- package/src/templator/genTableBlock.ts +32 -17
- package/src/templator/genUpdateBlock.ts +21 -18
- package/src/translator/types.ts +0 -4
- package/src/translator/utils.ts +0 -6
- package/src/utils/delay/index.ts +0 -0
- package/src/utils/env.ts +4 -5
- package/src/utils/index.ts +16 -4
- package/src/utils/time-slicing/controller.ts +1 -0
- package/src/utils/types.ts +0 -20
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +2 -1
- package/ts-worker/bundle.js +1 -1
- package/ts-worker/src/index.js +1 -0
- package/out/utils/language-cache/constant.d.ts +0 -18
- package/out/utils/language-cache/constant.js +0 -35
- package/out/utils/language-cache/constant.js.map +0 -1
- package/out/utils/language-cache/index.d.ts +0 -2
- package/out/utils/language-cache/index.js +0 -19
- package/out/utils/language-cache/index.js.map +0 -1
- package/out/utils/language-cache/nasl.d.ts +0 -10
- package/out/utils/language-cache/nasl.js +0 -98
- package/out/utils/language-cache/nasl.js.map +0 -1
- package/out/utils/language-cache/types.d.ts +0 -44
- package/out/utils/language-cache/types.js +0 -4
- package/out/utils/language-cache/types.js.map +0 -1
- package/src/utils/language-cache/constant.ts +0 -37
- package/src/utils/language-cache/index.ts +0 -2
- package/src/utils/language-cache/nasl.ts +0 -83
- package/src/utils/language-cache/types.ts +0 -48
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
TranslatorGenerator,
|
|
9
9
|
indent,
|
|
10
10
|
createDecoratorCode,
|
|
11
|
-
createDescriptionComment,
|
|
12
11
|
} from '../translator';
|
|
12
|
+
import type Namespace from './Namespace__';
|
|
13
13
|
import Enum from './Enum__';
|
|
14
14
|
import Module from './Module__';
|
|
15
15
|
|
|
@@ -106,62 +106,6 @@ export class EnumItem extends BaseNode {
|
|
|
106
106
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
107
107
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
108
108
|
//================================================================================
|
|
109
|
-
/**
|
|
110
|
-
* 删除静态字符串
|
|
111
|
-
* @param name 静态字符串名称
|
|
112
|
-
*/
|
|
113
|
-
removeLabel(name: string): void;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* 删除静态字符串
|
|
117
|
-
* @param label 已有的静态字符串实例
|
|
118
|
-
*/
|
|
119
|
-
removeLabel(label: StaticString): void;
|
|
120
|
-
|
|
121
|
-
removeLabel(options: string | StaticString) {
|
|
122
|
-
let label: StaticString;
|
|
123
|
-
if (typeof options === 'string') {
|
|
124
|
-
label = this.label;
|
|
125
|
-
if (!label) {
|
|
126
|
-
throw new Error('找不到静态字符串 ' + options);
|
|
127
|
-
}
|
|
128
|
-
} else {
|
|
129
|
-
label = options;
|
|
130
|
-
}
|
|
131
|
-
return label.delete();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
__removeStaticString(staticString: StaticString) {
|
|
135
|
-
const parentKey = staticString.parentKey;
|
|
136
|
-
const params: Params = {
|
|
137
|
-
parentNode: this,
|
|
138
|
-
parentKey,
|
|
139
|
-
index: -1,
|
|
140
|
-
object: null,
|
|
141
|
-
oldObject: staticString,
|
|
142
|
-
};
|
|
143
|
-
if (parentKey) {
|
|
144
|
-
params.parentKey = parentKey;
|
|
145
|
-
// @ts-ignore
|
|
146
|
-
const t = this.__v_raw || this;
|
|
147
|
-
// @ts-ignore
|
|
148
|
-
const n = staticString.__v_raw || staticString;
|
|
149
|
-
if (Array.isArray((t as any)[parentKey])) {
|
|
150
|
-
// @ts-ignore
|
|
151
|
-
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
152
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
153
|
-
params.index = index;
|
|
154
|
-
} else {
|
|
155
|
-
const q = (t as any)[parentKey];
|
|
156
|
-
if ((q.__v_raw || q) === n) {
|
|
157
|
-
params.index = 0;
|
|
158
|
-
(this as any)[parentKey] = undefined;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return params;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
109
|
/**
|
|
166
110
|
* 祖先 Enum
|
|
167
111
|
*/
|
|
@@ -186,6 +130,19 @@ export class EnumItem extends BaseNode {
|
|
|
186
130
|
*/
|
|
187
131
|
isLeaf: boolean = true;
|
|
188
132
|
|
|
133
|
+
getNamespace() {
|
|
134
|
+
if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
|
|
135
|
+
const parentNamespace = (this.parentNode as Namespace).getNamespace();
|
|
136
|
+
const parentName = this.parentNode.name;
|
|
137
|
+
const arr = [parentNamespace];
|
|
138
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
139
|
+
arr.push(parentName);
|
|
140
|
+
}
|
|
141
|
+
return `${arr.join('.')}.structures`;
|
|
142
|
+
}
|
|
143
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
144
|
+
}
|
|
145
|
+
|
|
189
146
|
@withSourceMapGenerator
|
|
190
147
|
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
191
148
|
const self = this;
|
|
@@ -194,13 +151,7 @@ export class EnumItem extends BaseNode {
|
|
|
194
151
|
|
|
195
152
|
@withSourceMap()
|
|
196
153
|
toNaturalTS(state = createCompilerState()): string {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (state.descriptionComment)
|
|
200
|
-
code += createDescriptionComment(state, this, ['label']);
|
|
201
|
-
code += `'${this.value}' = '${this.label?.value}'`;
|
|
202
|
-
|
|
203
|
-
return code;
|
|
154
|
+
return `'${this.value}' = '${this.label?.value}'`;
|
|
204
155
|
}
|
|
205
156
|
|
|
206
157
|
@withSourceMap()
|
|
@@ -233,7 +184,7 @@ export class EnumItem extends BaseNode {
|
|
|
233
184
|
* 设置枚举值标题
|
|
234
185
|
*/
|
|
235
186
|
setLabelValue(label: string) {
|
|
236
|
-
this.label?.setValue?.(label);
|
|
187
|
+
(this.label as any)?.setValue?.(label);
|
|
237
188
|
}
|
|
238
189
|
//================================================================================
|
|
239
190
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
package/src/concepts/Enum__.ts
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
withGenerator,
|
|
11
11
|
TranslatorGenerator,
|
|
12
12
|
createDecoratorCode,
|
|
13
|
-
createDescriptionComment,
|
|
14
13
|
} from '../translator';
|
|
15
14
|
import type Namespace from './Namespace__';
|
|
16
15
|
import type Identifier from './Identifier__';
|
|
@@ -318,11 +317,7 @@ export class Enum extends BaseNode {
|
|
|
318
317
|
|
|
319
318
|
@withSourceMap()
|
|
320
319
|
toNaturalTS(state = createCompilerState()): string {
|
|
321
|
-
let code =
|
|
322
|
-
if (state.descriptionComment)
|
|
323
|
-
code += createDescriptionComment(state, this, ['label', 'description']);
|
|
324
|
-
|
|
325
|
-
code += `enum ${this.name} {\n`;
|
|
320
|
+
let code = `enum ${this.name} {\n`;
|
|
326
321
|
this.enumItems.forEach((item) => {
|
|
327
322
|
code += indent(state.tabSize + 1);
|
|
328
323
|
code += item.toNaturalTS(shiftState(state, code, { tabSize: 0 }));
|
|
@@ -472,7 +472,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
472
472
|
if (state?.focusedNodePath === `${this?.nodePath}.body[${this.body?.length}]`)
|
|
473
473
|
code += `${indent((state?.tabSize || 0) + 1)}/* 当前位置 */\n`;
|
|
474
474
|
|
|
475
|
-
code += `${indent(state.tabSize)}}\n`;
|
|
475
|
+
code += `${indent(state.tabSize)}\n}\n`;
|
|
476
476
|
|
|
477
477
|
return code;
|
|
478
478
|
}
|
|
@@ -13,7 +13,7 @@ import { createUUID } from '../utils/create';
|
|
|
13
13
|
import * as types from './utils/types';
|
|
14
14
|
import * as asserts from './utils/asserts';
|
|
15
15
|
import BaseNode from '../common/BaseNode';
|
|
16
|
-
import
|
|
16
|
+
import LogicDeclaration from './LogicDeclaration__';
|
|
17
17
|
import ViewComponentDeclaration from './ViewComponentDeclaration__';
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -50,17 +50,23 @@ export class FrontendLibrary extends BaseNode {
|
|
|
50
50
|
type: 'pc' | 'h5';
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* 框架标识
|
|
54
|
+
*/
|
|
55
|
+
@property()
|
|
56
|
+
frameworkKind: 'react' | 'vue2' = 'vue2';
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 依赖库逻辑声明列表
|
|
54
60
|
*/
|
|
55
61
|
@property({
|
|
56
|
-
objectRef: '
|
|
62
|
+
objectRef: 'LogicDeclaration',
|
|
57
63
|
isArray: true,
|
|
58
64
|
defaultValue: [],
|
|
59
65
|
})
|
|
60
|
-
logics: Array<
|
|
66
|
+
logics: Array<LogicDeclaration> = [];
|
|
61
67
|
|
|
62
68
|
/**
|
|
63
|
-
*
|
|
69
|
+
* 依赖库组件声明列表
|
|
64
70
|
*/
|
|
65
71
|
@property({
|
|
66
72
|
objectRef: 'ViewComponentDeclaration',
|
|
@@ -82,96 +88,98 @@ export class FrontendLibrary extends BaseNode {
|
|
|
82
88
|
return super.from(source, parentNode, parentKey) as FrontendLibrary;
|
|
83
89
|
}
|
|
84
90
|
|
|
85
|
-
|
|
91
|
+
getLogicDeclarationExistingNames(excludedList: Array<LogicDeclaration> = []) {
|
|
86
92
|
const excludedSet = new Set(excludedList);
|
|
87
|
-
return ((this.logics as
|
|
93
|
+
return ((this.logics as LogicDeclaration[]) || [])
|
|
94
|
+
.filter((item) => !excludedSet.has(item))
|
|
95
|
+
.map((item) => item.name);
|
|
88
96
|
}
|
|
89
|
-
|
|
90
|
-
return utils.unique(name, this.
|
|
97
|
+
getLogicDeclarationUniqueName(name = 'logicDeclaration1') {
|
|
98
|
+
return utils.unique(name, this.getLogicDeclarationExistingNames(), undefined, true);
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
/**
|
|
94
|
-
*
|
|
102
|
+
* 插入逻辑声明
|
|
95
103
|
* @internal
|
|
96
|
-
* @param name
|
|
104
|
+
* @param name 逻辑声明名称,如果不填会自动生成一个唯一名称
|
|
97
105
|
*/
|
|
98
|
-
|
|
106
|
+
_insertLogicDeclarationAt(name: string, index: number): LogicDeclaration;
|
|
99
107
|
|
|
100
108
|
/**
|
|
101
|
-
*
|
|
109
|
+
* 插入逻辑声明
|
|
102
110
|
* @internal
|
|
103
|
-
* @param
|
|
111
|
+
* @param logicDeclarationOptions 逻辑声明参数
|
|
104
112
|
*/
|
|
105
|
-
|
|
113
|
+
_insertLogicDeclarationAt(logicDeclarationOptions: Partial<LogicDeclaration>, index: number): LogicDeclaration;
|
|
106
114
|
|
|
107
115
|
/**
|
|
108
|
-
*
|
|
116
|
+
* 插入逻辑声明
|
|
109
117
|
* @internal
|
|
110
|
-
* @param
|
|
118
|
+
* @param logicDeclaration 已有的逻辑声明实例
|
|
111
119
|
*/
|
|
112
|
-
|
|
120
|
+
_insertLogicDeclarationAt(logicDeclaration: LogicDeclaration, index: number): LogicDeclaration;
|
|
113
121
|
|
|
114
|
-
|
|
115
|
-
const
|
|
122
|
+
_insertLogicDeclarationAt(options: string | Partial<LogicDeclaration> | LogicDeclaration, index: number) {
|
|
123
|
+
const logicDeclarationOptions: any = {};
|
|
116
124
|
const relationOptions = { parentNode: this, parentKey: 'logics' };
|
|
117
|
-
const
|
|
118
|
-
let
|
|
125
|
+
const LogicDeclaration = getConceptConstructor('LogicDeclaration');
|
|
126
|
+
let logicDeclaration: LogicDeclaration;
|
|
119
127
|
if (!options) {
|
|
120
|
-
|
|
128
|
+
logicDeclaration = LogicDeclaration.from(
|
|
121
129
|
{
|
|
122
|
-
...
|
|
123
|
-
name: this.
|
|
130
|
+
...logicDeclarationOptions,
|
|
131
|
+
name: this.getLogicDeclarationUniqueName(),
|
|
124
132
|
},
|
|
125
133
|
this,
|
|
126
134
|
'logics',
|
|
127
135
|
);
|
|
128
136
|
} else if (typeof options === 'string') {
|
|
129
|
-
|
|
137
|
+
logicDeclaration = LogicDeclaration.from(
|
|
130
138
|
{
|
|
131
|
-
...
|
|
139
|
+
...logicDeclarationOptions,
|
|
132
140
|
name: options,
|
|
133
141
|
},
|
|
134
142
|
this,
|
|
135
143
|
'logics',
|
|
136
144
|
);
|
|
137
|
-
} else if (asserts.
|
|
145
|
+
} else if (asserts.isLogicDeclaration(options)) {
|
|
138
146
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
139
|
-
|
|
140
|
-
Object.assign(
|
|
147
|
+
logicDeclaration = options;
|
|
148
|
+
Object.assign(logicDeclaration, relationOptions);
|
|
141
149
|
} else {
|
|
142
|
-
|
|
150
|
+
logicDeclaration = LogicDeclaration.from(
|
|
143
151
|
{
|
|
144
|
-
...
|
|
152
|
+
...logicDeclarationOptions,
|
|
145
153
|
...options,
|
|
146
154
|
},
|
|
147
155
|
this,
|
|
148
156
|
'logics',
|
|
149
157
|
);
|
|
150
158
|
}
|
|
151
|
-
this.logics.splice(index, 0,
|
|
152
|
-
return
|
|
159
|
+
this.logics.splice(index, 0, logicDeclaration);
|
|
160
|
+
return logicDeclaration;
|
|
153
161
|
}
|
|
154
162
|
|
|
155
163
|
/**
|
|
156
|
-
*
|
|
157
|
-
* @param name
|
|
164
|
+
* 插入逻辑声明
|
|
165
|
+
* @param name 逻辑声明名称,如果不填会自动生成一个唯一名称
|
|
158
166
|
*/
|
|
159
|
-
|
|
167
|
+
insertLogicDeclarationAt(name: string, index: number): LogicDeclaration;
|
|
160
168
|
|
|
161
169
|
/**
|
|
162
|
-
*
|
|
163
|
-
* @param
|
|
170
|
+
* 插入逻辑声明
|
|
171
|
+
* @param logicDeclarationOptions 逻辑声明参数
|
|
164
172
|
*/
|
|
165
|
-
|
|
173
|
+
insertLogicDeclarationAt(logicDeclarationOptions: Partial<LogicDeclaration>, index: number): LogicDeclaration;
|
|
166
174
|
|
|
167
175
|
/**
|
|
168
|
-
*
|
|
169
|
-
* @param
|
|
176
|
+
* 插入逻辑声明
|
|
177
|
+
* @param logicDeclaration 已有的逻辑声明实例
|
|
170
178
|
*/
|
|
171
|
-
|
|
179
|
+
insertLogicDeclarationAt(logicDeclaration: LogicDeclaration, index: number): LogicDeclaration;
|
|
172
180
|
|
|
173
|
-
|
|
174
|
-
const node = this.
|
|
181
|
+
insertLogicDeclarationAt(options: string | Partial<LogicDeclaration> | LogicDeclaration, index: number) {
|
|
182
|
+
const node = this._insertLogicDeclarationAt(options as any, index);
|
|
175
183
|
node.create({
|
|
176
184
|
index,
|
|
177
185
|
parentNode: this,
|
|
@@ -181,52 +189,52 @@ export class FrontendLibrary extends BaseNode {
|
|
|
181
189
|
}
|
|
182
190
|
|
|
183
191
|
/**
|
|
184
|
-
*
|
|
192
|
+
* 添加逻辑声明
|
|
185
193
|
* @internal
|
|
186
|
-
* @param name
|
|
194
|
+
* @param name 逻辑声明名称,如果不填会自动生成一个唯一名称
|
|
187
195
|
*/
|
|
188
|
-
|
|
196
|
+
_addLogicDeclaration(name?: string): LogicDeclaration;
|
|
189
197
|
|
|
190
198
|
/**
|
|
191
|
-
*
|
|
199
|
+
* 添加逻辑声明
|
|
192
200
|
* @internal
|
|
193
|
-
* @param
|
|
201
|
+
* @param logicDeclarationOptions 逻辑声明参数
|
|
194
202
|
*/
|
|
195
|
-
|
|
203
|
+
_addLogicDeclaration(logicDeclarationOptions: Partial<LogicDeclaration>): LogicDeclaration;
|
|
196
204
|
|
|
197
205
|
/**
|
|
198
|
-
*
|
|
206
|
+
* 添加逻辑声明
|
|
199
207
|
* @internal
|
|
200
|
-
* @param
|
|
208
|
+
* @param logicDeclaration 已有的逻辑声明实例
|
|
201
209
|
*/
|
|
202
|
-
|
|
210
|
+
_addLogicDeclaration(logicDeclaration: LogicDeclaration): LogicDeclaration;
|
|
203
211
|
|
|
204
|
-
|
|
212
|
+
_addLogicDeclaration(options?: string | Partial<LogicDeclaration> | LogicDeclaration) {
|
|
205
213
|
const index = this.logics.length;
|
|
206
|
-
return this.
|
|
214
|
+
return this._insertLogicDeclarationAt(options as any, index);
|
|
207
215
|
}
|
|
208
216
|
|
|
209
217
|
/**
|
|
210
|
-
*
|
|
218
|
+
* 添加逻辑声明
|
|
211
219
|
* @internal
|
|
212
|
-
* @param name
|
|
220
|
+
* @param name 逻辑声明名称,如果不填会自动生成一个唯一名称
|
|
213
221
|
*/
|
|
214
|
-
|
|
222
|
+
addLogicDeclaration(name?: string): LogicDeclaration;
|
|
215
223
|
|
|
216
224
|
/**
|
|
217
|
-
*
|
|
218
|
-
* @param
|
|
225
|
+
* 添加逻辑声明
|
|
226
|
+
* @param logicDeclarationOptions 逻辑声明参数
|
|
219
227
|
*/
|
|
220
|
-
|
|
228
|
+
addLogicDeclaration(logicDeclarationOptions: Partial<LogicDeclaration>): LogicDeclaration;
|
|
221
229
|
|
|
222
230
|
/**
|
|
223
|
-
*
|
|
224
|
-
* @param
|
|
231
|
+
* 添加逻辑声明
|
|
232
|
+
* @param logicDeclaration 已有的逻辑声明实例
|
|
225
233
|
*/
|
|
226
|
-
|
|
234
|
+
addLogicDeclaration(logicDeclaration: LogicDeclaration): LogicDeclaration;
|
|
227
235
|
|
|
228
|
-
|
|
229
|
-
const node = this.
|
|
236
|
+
addLogicDeclaration(options?: string | Partial<LogicDeclaration> | LogicDeclaration) {
|
|
237
|
+
const node = this._addLogicDeclaration(options as any);
|
|
230
238
|
const index = this.logics.indexOf(node);
|
|
231
239
|
node.create({
|
|
232
240
|
index,
|
|
@@ -415,28 +423,28 @@ export class FrontendLibrary extends BaseNode {
|
|
|
415
423
|
}
|
|
416
424
|
|
|
417
425
|
/**
|
|
418
|
-
*
|
|
419
|
-
* @param name
|
|
426
|
+
* 删除逻辑声明
|
|
427
|
+
* @param name 逻辑声明名称
|
|
420
428
|
*/
|
|
421
|
-
|
|
429
|
+
removeLogicDeclaration(name: string): void;
|
|
422
430
|
|
|
423
431
|
/**
|
|
424
|
-
*
|
|
425
|
-
* @param
|
|
432
|
+
* 删除逻辑声明
|
|
433
|
+
* @param logicDeclaration 已有的逻辑声明实例
|
|
426
434
|
*/
|
|
427
|
-
|
|
435
|
+
removeLogicDeclaration(logicDeclaration: LogicDeclaration): void;
|
|
428
436
|
|
|
429
|
-
|
|
430
|
-
let
|
|
437
|
+
removeLogicDeclaration(options: string | LogicDeclaration) {
|
|
438
|
+
let logicDeclaration: LogicDeclaration;
|
|
431
439
|
if (typeof options === 'string') {
|
|
432
|
-
|
|
433
|
-
if (!
|
|
434
|
-
throw new Error('
|
|
440
|
+
logicDeclaration = (this.logics as LogicDeclaration[]).find((item) => item.name === options);
|
|
441
|
+
if (!logicDeclaration) {
|
|
442
|
+
throw new Error('找不到逻辑声明 ' + options);
|
|
435
443
|
}
|
|
436
444
|
} else {
|
|
437
|
-
|
|
445
|
+
logicDeclaration = options;
|
|
438
446
|
}
|
|
439
|
-
return
|
|
447
|
+
return logicDeclaration.delete();
|
|
440
448
|
}
|
|
441
449
|
|
|
442
450
|
/**
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import type Namespace from './Namespace__';
|
|
13
13
|
import { languageList } from '../utils/i18nInfo';
|
|
14
14
|
import type BusinessComponent from './BusinessComponent__';
|
|
15
|
-
import type FrontendType from './FrontendType__';
|
|
15
|
+
import type { FrontendType } from './FrontendType__';
|
|
16
16
|
|
|
17
17
|
//================================================================================
|
|
18
18
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -813,8 +813,23 @@ export class Frontend extends BaseNode {
|
|
|
813
813
|
}
|
|
814
814
|
|
|
815
815
|
genThemeCSS() {
|
|
816
|
-
|
|
817
|
-
|
|
816
|
+
if (!this.theme) {
|
|
817
|
+
return
|
|
818
|
+
}
|
|
819
|
+
const { variableMap, scopeVariableMap } = this.theme;
|
|
820
|
+
const scopeKeys = Object.keys(scopeVariableMap || {});
|
|
821
|
+
const keys = Object.keys(variableMap || {});
|
|
822
|
+
|
|
823
|
+
if (!keys.length && !scopeKeys.length) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
if (scopeKeys.length > 0) {
|
|
828
|
+
return scopeKeys.map((selector) => {
|
|
829
|
+
const varMap = scopeVariableMap[selector];
|
|
830
|
+
return `${selector} {${Object.keys(varMap).map((varName) => `${varName}:${varMap[varName]};`).join('')}}`;
|
|
831
|
+
}).join('\n');
|
|
832
|
+
}
|
|
818
833
|
|
|
819
834
|
return `:root {
|
|
820
835
|
${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
|
|
@@ -886,6 +901,14 @@ export class Frontend extends BaseNode {
|
|
|
886
901
|
};
|
|
887
902
|
}
|
|
888
903
|
|
|
904
|
+
get frameworkKind(): FrontendType['frameworkKind'] {
|
|
905
|
+
const node = this.getAncestor('FrontendType');
|
|
906
|
+
if (asserts.isFrontendType(node)) {
|
|
907
|
+
return node.frameworkKind ?? 'vue2';
|
|
908
|
+
}
|
|
909
|
+
return 'vue2';
|
|
910
|
+
}
|
|
911
|
+
|
|
889
912
|
getPath() {
|
|
890
913
|
const { path } = this;
|
|
891
914
|
const finalPath = path && path !== '/' ? path : '';
|
|
@@ -531,11 +531,16 @@ export class HistoryProcessV2 extends BaseNode {
|
|
|
531
531
|
|
|
532
532
|
// 流程逻辑提示错误信息
|
|
533
533
|
if (Array.isArray(self.bindEvents)) {
|
|
534
|
+
// 当前范围的变量声明
|
|
535
|
+
let variDeclCodeWithSelf = `let processSystem: nasl.processV2.ProcessVariable;\n`;
|
|
536
|
+
variDeclCodeWithSelf += 'let custom: typeof bindData;\n';
|
|
534
537
|
yield* wrapForEach(self.bindEvents, function* warpForEachGenerator(event) {
|
|
535
538
|
code += yield* event.toEmbeddedTS(
|
|
536
539
|
shiftState(state, code, {
|
|
537
540
|
tabSize: state?.tabSize || 0,
|
|
538
541
|
}),
|
|
542
|
+
false,
|
|
543
|
+
variDeclCodeWithSelf,
|
|
539
544
|
);
|
|
540
545
|
code += '\n';
|
|
541
546
|
});
|
|
@@ -92,11 +92,6 @@ export class I18nInfo extends BaseNode {
|
|
|
92
92
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
93
93
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
94
94
|
//================================================================================
|
|
95
|
-
@withSourceMap()
|
|
96
|
-
toNaturalTS(state = createCompilerState()): string {
|
|
97
|
-
return '';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
95
|
get messagesLanguageList() {
|
|
101
96
|
return Object.keys(this.messageMap || {});
|
|
102
97
|
}
|
|
@@ -14,6 +14,8 @@ import { findConceptKeyWordByNamespace } from '../utils';
|
|
|
14
14
|
import type View from './View__';
|
|
15
15
|
import BusinessComponent from './BusinessComponent__';
|
|
16
16
|
import FrontendType from './FrontendType__';
|
|
17
|
+
import { getNodeByNodeCallee } from '../automate/engine/utils';
|
|
18
|
+
import type Logic from './Logic__';
|
|
17
19
|
|
|
18
20
|
//================================================================================
|
|
19
21
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -409,6 +411,36 @@ export class Identifier extends LogicItem {
|
|
|
409
411
|
});
|
|
410
412
|
}
|
|
411
413
|
|
|
414
|
+
// 如果绑定的是函数引用,通过内容过去节点
|
|
415
|
+
// 从 calllogic复制过来的,用于获取函数节点
|
|
416
|
+
// 因为这里只会出现全局逻辑的引用,所以先不考虑其他情况有的话 在逐步加
|
|
417
|
+
getFunctionCallNode(): Logic | undefined {
|
|
418
|
+
let node;
|
|
419
|
+
// 如果不是函数就return
|
|
420
|
+
if (!this.namespace || !this.namespace.endsWith('logics')) {
|
|
421
|
+
return node;
|
|
422
|
+
}
|
|
423
|
+
const calleewholeKey = `${this.namespace}.${this.name}`;
|
|
424
|
+
// 如果是其余app下自定义逻辑
|
|
425
|
+
try {
|
|
426
|
+
node = getNodeByNodeCallee(this.app, calleewholeKey, (key: any, tempPoint: any) => {
|
|
427
|
+
// 处理 NASL 中未定义的假的节点
|
|
428
|
+
if (key === tempPoint.name) {
|
|
429
|
+
return {
|
|
430
|
+
tempPoint,
|
|
431
|
+
state: 1,
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const t = tempPoint[key];
|
|
435
|
+
return {
|
|
436
|
+
tempPoint: t,
|
|
437
|
+
state: Array.isArray(t) ? 2 : 1,
|
|
438
|
+
};
|
|
439
|
+
});
|
|
440
|
+
} catch (err) {}
|
|
441
|
+
return node;
|
|
442
|
+
}
|
|
443
|
+
|
|
412
444
|
//================================================================================
|
|
413
445
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
414
446
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -468,7 +468,7 @@ export class IfStatement extends LogicItem {
|
|
|
468
468
|
});
|
|
469
469
|
if (state.focusedNodePath === `${this.nodePath}.alternate[${this.alternate.length}]`)
|
|
470
470
|
code += `${indent((state?.tabSize || 0) + 1)}/* 当前位置 */\n`;
|
|
471
|
-
code += `${indent(state?.tabSize || 0)}}`;
|
|
471
|
+
code += `${indent(state?.tabSize || 0)}}\n`;
|
|
472
472
|
return code;
|
|
473
473
|
}
|
|
474
474
|
|
|
@@ -506,7 +506,7 @@ export class IfStatement extends LogicItem {
|
|
|
506
506
|
});
|
|
507
507
|
if (state.focusedNodePath === `${this.nodePath}.alternate[${this.alternate.length}]`)
|
|
508
508
|
code += `${indent((state?.tabSize || 0) + 1)}/* 当前位置 */\n`;
|
|
509
|
-
code += `${indent(state?.tabSize || 0)}}`;
|
|
509
|
+
code += `${indent(state?.tabSize || 0)}}\n`;
|
|
510
510
|
return code;
|
|
511
511
|
}
|
|
512
512
|
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
withSourceMapGenerator,
|
|
10
10
|
withGenerator,
|
|
11
11
|
TranslatorGenerator,
|
|
12
|
-
createDescriptionComment,
|
|
13
12
|
} from '../translator';
|
|
14
13
|
import type Namespace from './Namespace__';
|
|
15
14
|
import type TypeAnnotation from './TypeAnnotation__';
|
|
@@ -979,11 +978,7 @@ export class Interface extends ImportedInterface {
|
|
|
979
978
|
@withSourceMap()
|
|
980
979
|
toNaturalTS(state = createCompilerState(), interfaceName: string): string {
|
|
981
980
|
const { name, params, returns } = this || {};
|
|
982
|
-
|
|
983
|
-
let code = '';
|
|
984
|
-
if (state.descriptionComment)
|
|
985
|
-
code += createDescriptionComment(state, this, ['description']);
|
|
986
|
-
code = `declare function ${interfaceName || name}(`;
|
|
981
|
+
let code = `declare function ${interfaceName || name}(`;
|
|
987
982
|
if (params?.length) {
|
|
988
983
|
code += '{';
|
|
989
984
|
params?.forEach((param, index) => {
|