@lcap/nasl 3.3.3-beta.6 → 3.3.3-beta.7
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/out/bak/translator.js +73 -15
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +11 -0
- package/out/common/BaseNode.js +51 -0
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/index.d.ts +1 -0
- package/out/common/index.js +1 -0
- package/out/common/index.js.map +1 -1
- package/out/common/utils.d.ts +2 -0
- package/out/common/utils.js +18 -0
- package/out/common/utils.js.map +1 -0
- package/out/concepts/Abort__.d.ts +2 -2
- package/out/concepts/Abort__.js +6 -2
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.d.ts +2 -2
- package/out/concepts/Anchor__.js +11 -7
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +3 -3
- package/out/concepts/AnonymousFunction__.js +37 -23
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.js +137 -69
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +2 -2
- package/out/concepts/Argument__.js +18 -13
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +2 -2
- package/out/concepts/Assignee__.js +31 -19
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.d.ts +2 -2
- package/out/concepts/AssignmentLine__.js +3 -2
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +2 -2
- package/out/concepts/Assignment__.js +16 -12
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js +6 -3
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.d.ts +2 -2
- package/out/concepts/AuthLogicForCallInterface__.js +62 -78
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/BackendVariable__.d.ts +5 -8
- package/out/concepts/BackendVariable__.js +23 -18
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.d.ts +4 -7
- package/out/concepts/Backend__.js +16 -11
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +2 -2
- package/out/concepts/BatchAssignment__.js +30 -22
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +2 -2
- package/out/concepts/BinaryExpression__.js +30 -18
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +10 -4
- package/out/concepts/BindAttribute__.js +144 -43
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +2 -2
- package/out/concepts/BindDirective__.js +16 -11
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +4 -7
- package/out/concepts/BindEvent__.js +32 -24
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +2 -2
- package/out/concepts/BindStyle__.js +15 -10
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +2 -2
- package/out/concepts/BooleanLiteral__.js +2 -2
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.d.ts +2 -2
- package/out/concepts/CallAuthInterface__.js +36 -31
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.d.ts +2 -2
- package/out/concepts/CallConnector__.js +25 -23
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +2 -2
- package/out/concepts/CallFunction__.js +31 -22
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +2 -2
- package/out/concepts/CallInterface__.js +20 -29
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +2 -3
- package/out/concepts/CallLogic__.js +47 -50
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +4 -4
- package/out/concepts/CallQueryComponent__.js +50 -42
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.d.ts +2 -2
- package/out/concepts/Comment__.js +3 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +6 -3
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +6 -3
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +4 -7
- package/out/concepts/ConfigProperty__.js +18 -13
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +6 -3
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.d.ts +4 -7
- package/out/concepts/Connection__.js +12 -8
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Connector__.js +30 -15
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +3 -3
- package/out/concepts/Constant__.js +18 -13
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +4 -7
- package/out/concepts/DataSource__.js +13 -9
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +3 -3
- package/out/concepts/Destination__.js +35 -29
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.d.ts +2 -2
- package/out/concepts/End__.js +17 -13
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +2 -2
- package/out/concepts/EntityIndex__.js +4 -3
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +2 -2
- package/out/concepts/EntityProperty__.js +22 -15
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +4 -7
- package/out/concepts/Entity__.js +29 -21
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +2 -2
- package/out/concepts/EnumItem__.js +4 -3
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +4 -7
- package/out/concepts/Enum__.js +16 -11
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +6 -3
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +2 -2
- package/out/concepts/ExternalDestination__.js +13 -8
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +2 -2
- package/out/concepts/ForEachStatement__.js +26 -18
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.js +18 -10
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +4 -7
- package/out/concepts/Frontend__.js +37 -21
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.d.ts +3 -3
- package/out/concepts/Function__.js +52 -33
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +2 -2
- package/out/concepts/Identifier__.js +19 -18
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +2 -2
- package/out/concepts/IfStatement__.js +18 -13
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.js +17 -9
- package/out/concepts/Integration__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +2 -2
- package/out/concepts/InterfaceParam__.js +12 -8
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +4 -7
- package/out/concepts/Interface__.js +44 -33
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +2 -2
- package/out/concepts/JSBlock__.js +3 -2
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.d.ts +2 -2
- package/out/concepts/JavaLogic__.js +6 -2
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -2
- package/out/concepts/LogicItem__.js +7 -3
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +8 -11
- package/out/concepts/Logic__.js +141 -136
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +2 -2
- package/out/concepts/MatchCase__.js +35 -27
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +2 -2
- package/out/concepts/Match__.js +29 -24
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +2 -2
- package/out/concepts/MemberExpression__.js +34 -27
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MetadataType__.d.ts +4 -7
- package/out/concepts/MetadataType__.js +23 -15
- package/out/concepts/MetadataType__.js.map +1 -1
- package/out/concepts/MsgTriggerEvent__.js +6 -3
- package/out/concepts/MsgTriggerEvent__.js.map +1 -1
- package/out/concepts/MsgTriggerLauncher__.js +6 -3
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
- package/out/concepts/Namespace__.js +66 -33
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +5 -5
- package/out/concepts/NewComposite__.js +95 -82
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +5 -5
- package/out/concepts/NewList__.js +42 -32
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +4 -4
- package/out/concepts/NewMap__.js +51 -41
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.d.ts +2 -2
- package/out/concepts/New__.js +3 -2
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.d.ts +2 -2
- package/out/concepts/NullLiteral__.js +2 -2
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +2 -2
- package/out/concepts/NumericLiteral__.js +12 -7
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +2 -2
- package/out/concepts/OqlQueryComponent__.js +22 -17
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +8 -11
- package/out/concepts/OverriddenLogic__.js +135 -130
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.d.ts +3 -3
- package/out/concepts/Param__.js +29 -24
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +12 -6
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +2 -2
- package/out/concepts/ProcessElement__.js +92 -66
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.d.ts +2 -1
- package/out/concepts/ProcessOutcome__.js +5 -4
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +2 -1
- package/out/concepts/ProcessOutcomes__.js +6 -5
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.d.ts +4 -7
- package/out/concepts/Process__.js +51 -34
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.d.ts +2 -2
- package/out/concepts/QueryAggregateExpression__.js +8 -5
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +2 -2
- package/out/concepts/QueryFieldExpression__.js +5 -4
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +2 -2
- package/out/concepts/QueryFromExpression__.js +14 -9
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +2 -1
- package/out/concepts/QueryGroupByExpression__.js +12 -8
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +2 -2
- package/out/concepts/QueryJoinExpression__.js +18 -13
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.d.ts +2 -2
- package/out/concepts/QueryLimitExpression__.js +12 -8
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +2 -2
- package/out/concepts/QueryOrderByExpression__.js +12 -8
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +6 -3
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +3 -3
- package/out/concepts/Return__.js +21 -16
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +4 -7
- package/out/concepts/Role__.js +7 -6
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +2 -2
- package/out/concepts/SelectMembers__.js +9 -5
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.js +6 -3
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +2 -2
- package/out/concepts/SqlQueryComponent__.js +18 -13
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.d.ts +2 -2
- package/out/concepts/Start__.js +2 -2
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +2 -2
- package/out/concepts/StringInterpolation__.js +13 -8
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +2 -2
- package/out/concepts/StringLiteral__.js +4 -3
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +2 -2
- package/out/concepts/StructureProperty__.js +14 -10
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +4 -7
- package/out/concepts/Structure__.js +22 -14
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +2 -2
- package/out/concepts/SwitchCase__.js +18 -13
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.d.ts +2 -2
- package/out/concepts/SwitchStatement__.js +14 -9
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerEvent__.js +6 -3
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.d.ts +4 -7
- package/out/concepts/TriggerLauncher__.js +7 -6
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +2 -2
- package/out/concepts/TypeAnnotation__.js +61 -29
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +2 -2
- package/out/concepts/TypeParam__.js +4 -3
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +2 -2
- package/out/concepts/UnaryExpression__.js +18 -10
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +2 -1
- package/out/concepts/Unparsed__.js +2 -2
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +2 -2
- package/out/concepts/ValidationRule__.js +17 -12
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +5 -8
- package/out/concepts/Variable__.js +23 -18
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +7 -6
- package/out/concepts/ViewElement__.js +139 -101
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +8 -9
- package/out/concepts/View__.js +73 -62
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.d.ts +2 -2
- package/out/concepts/WhileStatement__.js +9 -7
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/manager/diagnostic.js +2 -3
- package/out/manager/diagnostic.js.map +1 -1
- package/out/server/naslServer.d.ts +46 -55
- package/out/server/naslServer.js +302 -449
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +1 -1
- package/out/server/translator.js.map +1 -1
- package/out/templator/genCreateBlock.js +4 -4
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +6 -6
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +4 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -2
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +4 -4
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/translator/types.d.ts +16 -3
- package/out/translator/utils.d.ts +19 -1
- package/out/translator/utils.js +71 -2
- package/out/translator/utils.js.map +1 -1
- package/out/utils/time-slicing/constant.d.ts +35 -0
- package/out/utils/time-slicing/constant.js +40 -0
- package/out/utils/time-slicing/constant.js.map +1 -0
- package/out/utils/time-slicing/controller.d.ts +53 -0
- package/out/utils/time-slicing/controller.js +280 -0
- package/out/utils/time-slicing/controller.js.map +1 -0
- package/out/utils/time-slicing/index.d.ts +5 -0
- package/out/utils/time-slicing/index.js +26 -0
- package/out/utils/time-slicing/index.js.map +1 -0
- package/out/utils/time-slicing/page-state.d.ts +2 -0
- package/out/utils/time-slicing/page-state.js +14 -0
- package/out/utils/time-slicing/page-state.js.map +1 -0
- package/out/utils/time-slicing/performance.d.ts +11 -0
- package/out/utils/time-slicing/performance.js +51 -0
- package/out/utils/time-slicing/performance.js.map +1 -0
- package/out/utils/time-slicing/runner.d.ts +12 -0
- package/out/utils/time-slicing/runner.js +53 -0
- package/out/utils/time-slicing/runner.js.map +1 -0
- package/out/utils/time-slicing/tool.d.ts +24 -0
- package/out/utils/time-slicing/tool.js +47 -0
- package/out/utils/time-slicing/tool.js.map +1 -0
- package/out/utils/time-slicing/utils.d.ts +62 -0
- package/out/utils/time-slicing/utils.js +47 -0
- package/out/utils/time-slicing/utils.js.map +1 -0
- package/out/utils/time-slicing/wrapper.d.ts +18 -0
- package/out/utils/time-slicing/wrapper.js +55 -0
- package/out/utils/time-slicing/wrapper.js.map +1 -0
- package/out/utils/types.d.ts +7 -0
- package/package.json +1 -1
- package/src/bak/translator.js +75 -16
- package/src/common/BaseNode.ts +67 -6
- package/src/common/index.ts +1 -0
- package/src/common/utils.ts +17 -0
- package/src/concepts/Abort__.ts +12 -3
- package/src/concepts/Anchor__.ts +21 -8
- package/src/concepts/AnonymousFunction__.ts +45 -31
- package/src/concepts/App__.ts +137 -69
- package/src/concepts/Argument__.ts +31 -14
- package/src/concepts/Assignee__.ts +42 -21
- package/src/concepts/AssignmentLine__.ts +13 -3
- package/src/concepts/Assignment__.ts +26 -14
- package/src/concepts/Attribute__.ts +6 -3
- package/src/concepts/AuthLogicForCallInterface__.ts +69 -87
- package/src/concepts/BackendVariable__.ts +34 -19
- package/src/concepts/Backend__.ts +33 -12
- package/src/concepts/BatchAssignment__.ts +41 -23
- package/src/concepts/BinaryExpression__.ts +40 -20
- package/src/concepts/BindAttribute__.ts +151 -49
- package/src/concepts/BindDirective__.ts +25 -12
- package/src/concepts/BindEvent__.ts +43 -32
- package/src/concepts/BindStyle__.ts +24 -11
- package/src/concepts/BooleanLiteral__.ts +11 -3
- package/src/concepts/CallAuthInterface__.ts +45 -34
- package/src/concepts/CallConnector__.ts +34 -26
- package/src/concepts/CallFunction__.ts +34 -23
- package/src/concepts/CallInterface__.ts +33 -42
- package/src/concepts/CallLogic__.ts +60 -67
- package/src/concepts/CallQueryComponent__.ts +60 -52
- package/src/concepts/Comment__.ts +13 -3
- package/src/concepts/CompletionProperty__.ts +6 -3
- package/src/concepts/ConfigGroup__.ts +6 -3
- package/src/concepts/ConfigProperty__.ts +28 -15
- package/src/concepts/Configuration__.ts +6 -3
- package/src/concepts/Connection__.ts +28 -9
- package/src/concepts/Connector__.ts +30 -15
- package/src/concepts/Constant__.ts +28 -14
- package/src/concepts/DataSource__.ts +22 -10
- package/src/concepts/Destination__.ts +45 -36
- package/src/concepts/End__.ts +24 -15
- package/src/concepts/EntityIndex__.ts +13 -4
- package/src/concepts/EntityProperty__.ts +33 -17
- package/src/concepts/Entity__.ts +40 -25
- package/src/concepts/EnumItem__.ts +13 -4
- package/src/concepts/Enum__.ts +27 -13
- package/src/concepts/Event__.ts +6 -3
- package/src/concepts/ExternalDestination__.ts +22 -10
- package/src/concepts/ForEachStatement__.ts +36 -20
- package/src/concepts/FrontendLibrary__.ts +18 -10
- package/src/concepts/Frontend__.ts +48 -22
- package/src/concepts/Function__.ts +60 -36
- package/src/concepts/Identifier__.ts +28 -23
- package/src/concepts/IfStatement__.ts +28 -17
- package/src/concepts/Integration__.ts +17 -9
- package/src/concepts/InterfaceParam__.ts +22 -9
- package/src/concepts/Interface__.ts +55 -37
- package/src/concepts/JSBlock__.ts +12 -3
- package/src/concepts/JavaLogic__.ts +13 -3
- package/src/concepts/LogicItem__.ts +13 -4
- package/src/concepts/Logic__.ts +159 -149
- package/src/concepts/MatchCase__.ts +45 -32
- package/src/concepts/Match__.ts +39 -28
- package/src/concepts/MemberExpression__.ts +43 -28
- package/src/concepts/MetadataType__.ts +34 -16
- package/src/concepts/MsgTriggerEvent__.ts +6 -3
- package/src/concepts/MsgTriggerLauncher__.ts +6 -3
- package/src/concepts/Namespace__.ts +66 -33
- package/src/concepts/NewComposite__.ts +106 -87
- package/src/concepts/NewList__.ts +52 -38
- package/src/concepts/NewMap__.ts +61 -48
- package/src/concepts/New__.ts +13 -3
- package/src/concepts/NullLiteral__.ts +11 -3
- package/src/concepts/NumericLiteral__.ts +21 -8
- package/src/concepts/OqlQueryComponent__.ts +32 -21
- package/src/concepts/OverriddenLogic__.ts +153 -143
- package/src/concepts/Param__.ts +48 -34
- package/src/concepts/ProcessComponent__.ts +12 -6
- package/src/concepts/ProcessElement__.ts +102 -76
- package/src/concepts/ProcessOutcome__.ts +16 -8
- package/src/concepts/ProcessOutcomes__.ts +17 -9
- package/src/concepts/Process__.ts +62 -41
- package/src/concepts/QueryAggregateExpression__.ts +17 -6
- package/src/concepts/QueryFieldExpression__.ts +14 -5
- package/src/concepts/QueryFromExpression__.ts +24 -10
- package/src/concepts/QueryGroupByExpression__.ts +20 -9
- package/src/concepts/QueryJoinExpression__.ts +28 -14
- package/src/concepts/QueryLimitExpression__.ts +22 -9
- package/src/concepts/QueryOrderByExpression__.ts +23 -9
- package/src/concepts/QuerySelectExpression__.ts +6 -3
- package/src/concepts/Return__.ts +31 -17
- package/src/concepts/Role__.ts +17 -8
- package/src/concepts/SelectMembers__.ts +19 -6
- package/src/concepts/Slot__.ts +6 -3
- package/src/concepts/SqlQueryComponent__.ts +28 -14
- package/src/concepts/Start__.ts +11 -3
- package/src/concepts/StringInterpolation__.ts +16 -8
- package/src/concepts/StringLiteral__.ts +13 -4
- package/src/concepts/StructureProperty__.ts +24 -11
- package/src/concepts/Structure__.ts +33 -16
- package/src/concepts/SwitchCase__.ts +28 -17
- package/src/concepts/SwitchStatement__.ts +23 -10
- package/src/concepts/TriggerEvent__.ts +6 -3
- package/src/concepts/TriggerLauncher__.ts +17 -7
- package/src/concepts/TypeAnnotation__.ts +46 -30
- package/src/concepts/TypeParam__.ts +13 -4
- package/src/concepts/UnaryExpression__.ts +28 -12
- package/src/concepts/Unparsed__.ts +10 -3
- package/src/concepts/ValidationRule__.ts +27 -20
- package/src/concepts/Variable__.ts +34 -19
- package/src/concepts/ViewElement__.ts +165 -125
- package/src/concepts/View__.ts +108 -89
- package/src/concepts/WhileStatement__.ts +19 -10
- package/src/concepts/types__.ts +1 -1
- package/src/manager/diagnostic.ts +3 -4
- package/src/server/naslServer.ts +676 -729
- package/src/server/translator.ts +1 -1
- package/src/templator/genCreateBlock.ts +4 -4
- package/src/templator/genCurdEditMultipleKeyBlock.ts +6 -6
- package/src/templator/genCurdMultipleKeyBlock.ts +4 -4
- package/src/templator/genEditTableBlock.ts +2 -2
- package/src/templator/genUpdateBlock.ts +4 -4
- package/src/translator/types.ts +20 -5
- package/src/translator/utils.ts +78 -4
- package/src/utils/time-slicing/constant.ts +37 -0
- package/src/utils/time-slicing/controller.ts +342 -0
- package/src/utils/time-slicing/index.ts +6 -0
- package/src/utils/time-slicing/page-state.ts +12 -0
- package/src/utils/time-slicing/performance.ts +56 -0
- package/src/utils/time-slicing/runner.ts +54 -0
- package/src/utils/time-slicing/tool.ts +45 -0
- package/src/utils/time-slicing/utils.ts +90 -0
- package/src/utils/time-slicing/wrapper.ts +58 -0
- package/src/utils/types.ts +9 -0
- package/test/concepts/anonymous-function/__snapshots__/toEmbeddedTS.spec.ts.snap +8 -0
- package/test/concepts/anonymous-function/__snapshots__/toJS.spec.ts.snap +3 -0
- package/test/concepts/anonymous-function/__snapshots__/toVue.spec.ts.snap +6 -0
- package/test/concepts/anonymous-function/constant.ts +5 -0
- package/test/concepts/anonymous-function/fixtures/simple.json +85 -0
- package/test/concepts/anonymous-function/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/anonymous-function/toJS.spec.ts +14 -0
- package/test/concepts/anonymous-function/toVue.spec.ts +14 -0
- package/test/concepts/assignment/__snapshots__/toEmbeddedTS.spec.ts.snap +21 -0
- package/test/concepts/assignment/__snapshots__/toJS.spec.ts.snap +9 -0
- package/test/concepts/assignment/__snapshots__/toVue.spec.ts.snap +21 -0
- package/test/concepts/assignment/constant.ts +5 -0
- package/test/concepts/assignment/fixtures/both-space.json +4 -0
- package/test/concepts/assignment/fixtures/left-space.json +14 -0
- package/test/concepts/assignment/fixtures/right-space.json +8 -0
- package/test/concepts/assignment/fixtures/simple.json +12 -0
- package/test/concepts/assignment/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/assignment/toJS.spec.ts +14 -0
- package/test/concepts/assignment/toVue.spec.ts +14 -0
- package/test/concepts/batch-assignment/__snapshots__/toEmbeddedTS.spec.ts.snap +28 -0
- package/test/concepts/batch-assignment/__snapshots__/toJS.spec.ts.snap +13 -0
- package/test/concepts/batch-assignment/__snapshots__/toVue.spec.ts.snap +14 -0
- package/test/concepts/batch-assignment/constant.ts +5 -0
- package/test/concepts/batch-assignment/fixtures/muli-var-muli-value.json +144 -0
- package/test/concepts/batch-assignment/fixtures/simple-var-simple-value.json +36 -0
- package/test/concepts/batch-assignment/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/batch-assignment/toJS.spec.ts +14 -0
- package/test/concepts/batch-assignment/toVue.spec.ts +14 -0
- package/test/concepts/binary-expression/__snapshots__/toEmbeddedTS.spec.ts.snap +25 -0
- package/test/concepts/binary-expression/__snapshots__/toJS.spec.ts.snap +17 -0
- package/test/concepts/binary-expression/__snapshots__/toVue.spec.ts.snap +19 -0
- package/test/concepts/binary-expression/constant.ts +5 -0
- package/test/concepts/binary-expression/fixtures/constant-nested.json +36 -0
- package/test/concepts/binary-expression/fixtures/constant-simple.json +12 -0
- package/test/concepts/binary-expression/fixtures/variable-nested.json +69 -0
- package/test/concepts/binary-expression/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/binary-expression/toJS.spec.ts +14 -0
- package/test/concepts/binary-expression/toVue.spec.ts +14 -0
- package/test/concepts/boolean-literal/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/boolean-literal/toJS.spec.ts +2 -2
- package/test/concepts/boolean-literal/toVue.spec.ts +2 -2
- package/test/concepts/call-function/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/call-interface/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/call-logic/getQuickInfoOffset.spec.ts +2 -1
- package/test/concepts/call-logic/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/data-source/__snapshots__/toEmbeddedTS.spec.ts.snap +8 -0
- package/test/concepts/data-source/__snapshots__/toEmbeddedTSFile.spec.ts.snap +12 -0
- package/test/concepts/data-source/constant.ts +5 -0
- package/test/concepts/data-source/fixtures/normal.json +289 -0
- package/test/concepts/data-source/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/data-source/toEmbeddedTSFile.spec.ts +16 -0
- package/test/concepts/entity/__snapshots__/toEmbeddedTS.spec.ts.snap +74 -0
- package/test/concepts/entity/__snapshots__/toEmbeddedTSFile.spec.ts.snap +3 -0
- package/test/concepts/entity/constant.ts +5 -0
- package/test/concepts/entity/fixtures/normal.json +469 -0
- package/test/concepts/entity/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/entity/toEmbeddedTSFile.spec.ts +14 -0
- package/test/concepts/identifier/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/identifier/toJS.spec.ts +2 -2
- package/test/concepts/identifier/toVue.spec.ts +2 -2
- package/test/concepts/match/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/member-expression/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/member-expression/toVue.spec.ts +2 -2
- package/test/concepts/null-literal/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/null-literal/toJS.spec.ts +2 -2
- package/test/concepts/null-literal/toVue.spec.ts +2 -2
- package/test/concepts/numeric-literal/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/numeric-literal/toJS.spec.ts +2 -2
- package/test/concepts/numeric-literal/toVue.spec.ts +2 -2
- package/test/concepts/string-literal/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/string-literal/toJS.spec.ts +2 -2
- package/test/concepts/string-literal/toVue.spec.ts +2 -2
- package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/validation-rule/validation-rule.spec.ts +2 -1
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +0 -2
- package/test/concepts/view-element/toEmbeddedTS.spec.ts +2 -1
- package/test/time-slicing/runner.spec.ts +28 -0
- package/test/time-slicing/time-slicing-nodejs.spec.ts +27 -0
- package/test/time-slicing/utils.ts +7 -0
- package/test/time-slicing/wrapper.spec.ts +92 -0
- package/ts-worker/lib/tsserver.js +10 -1
- package/ts-worker/package.json +1 -0
- package/ts-worker/src/index.js +13 -12
- package/ts-worker/webpack.config.js +1 -1
- package/out/utils/time-slicing.d.ts +0 -41
- package/out/utils/time-slicing.js +0 -82
- package/out/utils/time-slicing.js.map +0 -1
- package/src/utils/time-slicing.ts +0 -111
package/out/concepts/Logic__.js
CHANGED
|
@@ -34,6 +34,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
34
34
|
var Logic_1;
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Logic = void 0;
|
|
37
|
+
const time_slicing_1 = require("../utils/time-slicing");
|
|
38
|
+
const common_1 = require("../common");
|
|
37
39
|
const FrontendLibrary__1 = require("./FrontendLibrary__");
|
|
38
40
|
const translator_1 = require("../translator");
|
|
39
41
|
const Namespace__1 = __importDefault(require("./Namespace__"));
|
|
@@ -42,7 +44,6 @@ const Assignment__1 = __importDefault(require("./Assignment__"));
|
|
|
42
44
|
const Identifier__1 = __importDefault(require("./Identifier__"));
|
|
43
45
|
const BindEvent__1 = __importDefault(require("./BindEvent__"));
|
|
44
46
|
const BatchAssignment__1 = __importDefault(require("./BatchAssignment__"));
|
|
45
|
-
const OqlQueryComponent__1 = __importDefault(require("./OqlQueryComponent__"));
|
|
46
47
|
const TypeAnnotation__1 = __importDefault(require("./TypeAnnotation__"));
|
|
47
48
|
const CallInterface__1 = __importDefault(require("./CallInterface__"));
|
|
48
49
|
const CallLogic__1 = __importDefault(require("./CallLogic__"));
|
|
@@ -616,9 +617,12 @@ class Logic extends BaseNode_1.default {
|
|
|
616
617
|
~index && this[parentKey].splice(index, 1);
|
|
617
618
|
params.index = index;
|
|
618
619
|
}
|
|
619
|
-
else
|
|
620
|
-
|
|
621
|
-
|
|
620
|
+
else {
|
|
621
|
+
const q = t[parentKey];
|
|
622
|
+
if ((q.__v_raw || q) === n) {
|
|
623
|
+
params.index = 0;
|
|
624
|
+
this[parentKey] = undefined;
|
|
625
|
+
}
|
|
622
626
|
}
|
|
623
627
|
}
|
|
624
628
|
return params;
|
|
@@ -657,9 +661,12 @@ class Logic extends BaseNode_1.default {
|
|
|
657
661
|
~index && this[parentKey].splice(index, 1);
|
|
658
662
|
params.index = index;
|
|
659
663
|
}
|
|
660
|
-
else
|
|
661
|
-
|
|
662
|
-
|
|
664
|
+
else {
|
|
665
|
+
const q = t[parentKey];
|
|
666
|
+
if ((q.__v_raw || q) === n) {
|
|
667
|
+
params.index = 0;
|
|
668
|
+
this[parentKey] = undefined;
|
|
669
|
+
}
|
|
663
670
|
}
|
|
664
671
|
}
|
|
665
672
|
return params;
|
|
@@ -698,9 +705,12 @@ class Logic extends BaseNode_1.default {
|
|
|
698
705
|
~index && this[parentKey].splice(index, 1);
|
|
699
706
|
params.index = index;
|
|
700
707
|
}
|
|
701
|
-
else
|
|
702
|
-
|
|
703
|
-
|
|
708
|
+
else {
|
|
709
|
+
const q = t[parentKey];
|
|
710
|
+
if ((q.__v_raw || q) === n) {
|
|
711
|
+
params.index = 0;
|
|
712
|
+
this[parentKey] = undefined;
|
|
713
|
+
}
|
|
704
714
|
}
|
|
705
715
|
}
|
|
706
716
|
return params;
|
|
@@ -739,9 +749,12 @@ class Logic extends BaseNode_1.default {
|
|
|
739
749
|
~index && this[parentKey].splice(index, 1);
|
|
740
750
|
params.index = index;
|
|
741
751
|
}
|
|
742
|
-
else
|
|
743
|
-
|
|
744
|
-
|
|
752
|
+
else {
|
|
753
|
+
const q = t[parentKey];
|
|
754
|
+
if ((q.__v_raw || q) === n) {
|
|
755
|
+
params.index = 0;
|
|
756
|
+
this[parentKey] = undefined;
|
|
757
|
+
}
|
|
745
758
|
}
|
|
746
759
|
}
|
|
747
760
|
return params;
|
|
@@ -780,9 +793,12 @@ class Logic extends BaseNode_1.default {
|
|
|
780
793
|
~index && this[parentKey].splice(index, 1);
|
|
781
794
|
params.index = index;
|
|
782
795
|
}
|
|
783
|
-
else
|
|
784
|
-
|
|
785
|
-
|
|
796
|
+
else {
|
|
797
|
+
const q = t[parentKey];
|
|
798
|
+
if ((q.__v_raw || q) === n) {
|
|
799
|
+
params.index = 0;
|
|
800
|
+
this[parentKey] = undefined;
|
|
801
|
+
}
|
|
786
802
|
}
|
|
787
803
|
}
|
|
788
804
|
return params;
|
|
@@ -816,9 +832,12 @@ class Logic extends BaseNode_1.default {
|
|
|
816
832
|
~index && this[parentKey].splice(index, 1);
|
|
817
833
|
params.index = index;
|
|
818
834
|
}
|
|
819
|
-
else
|
|
820
|
-
|
|
821
|
-
|
|
835
|
+
else {
|
|
836
|
+
const q = t[parentKey];
|
|
837
|
+
if ((q.__v_raw || q) === n) {
|
|
838
|
+
params.index = 0;
|
|
839
|
+
this[parentKey] = undefined;
|
|
840
|
+
}
|
|
822
841
|
}
|
|
823
842
|
}
|
|
824
843
|
return params;
|
|
@@ -1047,54 +1066,57 @@ class Logic extends BaseNode_1.default {
|
|
|
1047
1066
|
},
|
|
1048
1067
|
};
|
|
1049
1068
|
}
|
|
1050
|
-
toEmbeddedTSInProcess(state, prependCode, noName, prefix) {
|
|
1069
|
+
*toEmbeddedTSInProcess(state = (0, translator_1.createCompilerState)(), prependCode, noName, prefix) {
|
|
1070
|
+
const self = this;
|
|
1051
1071
|
let code = '';
|
|
1052
1072
|
if (!prefix)
|
|
1053
|
-
code += `${noName ? '' : `${
|
|
1073
|
+
code += `${noName ? '' : `${self.name}:`} function(`;
|
|
1054
1074
|
else
|
|
1055
|
-
code += `function ${
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1075
|
+
code += `function ${self.name}(`; // 加空格会导致无法查询到引用
|
|
1076
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(
|
|
1077
|
+
// 加空格会导致无法查询到引用
|
|
1078
|
+
self.params, function* warpForEachGenerator(param, index) {
|
|
1079
|
+
code += yield* param.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1080
|
+
if (index !== self.params.length - 1)
|
|
1059
1081
|
code += ', ';
|
|
1060
1082
|
});
|
|
1061
1083
|
code += `) {\n`;
|
|
1062
1084
|
code += prependCode || '';
|
|
1063
1085
|
code += '\n';
|
|
1064
|
-
|
|
1086
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.variables, function* warpForEachGenerator(variable) {
|
|
1065
1087
|
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
|
|
1066
|
-
code += variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1088
|
+
code += yield* variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1067
1089
|
code += ';\n';
|
|
1068
1090
|
});
|
|
1069
|
-
|
|
1091
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.returns, function* warpForEachGenerator(ret) {
|
|
1070
1092
|
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
|
|
1071
|
-
code += ret.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1093
|
+
code += yield* ret.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1072
1094
|
code += ';\n';
|
|
1073
1095
|
});
|
|
1074
|
-
if (!
|
|
1075
|
-
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}return ${
|
|
1096
|
+
if (!self.body.length && self.returns.length) {
|
|
1097
|
+
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}return ${self.returns[0].name};\n`;
|
|
1076
1098
|
}
|
|
1077
1099
|
else {
|
|
1078
|
-
if (
|
|
1079
|
-
if (
|
|
1100
|
+
if (self.parentNode.type === 'ExclusiveGateway') {
|
|
1101
|
+
if (self.body.length <= 1) {
|
|
1080
1102
|
code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
|
|
1081
1103
|
code += 'const __LogicEmpty: any = null;';
|
|
1082
1104
|
}
|
|
1083
1105
|
}
|
|
1084
|
-
else if (
|
|
1085
|
-
!(
|
|
1086
|
-
!(
|
|
1106
|
+
else if (self.body.length <= 2 &&
|
|
1107
|
+
!(self.parentNode instanceof Namespace__1.default) &&
|
|
1108
|
+
!(self.parentNode instanceof Process__1.default)) {
|
|
1087
1109
|
code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
|
|
1088
1110
|
code += `${(0, translator_1.indent)(state?.tabSize || 0 + 4)}const __LogicEmpty: any = null;`;
|
|
1089
1111
|
}
|
|
1090
|
-
|
|
1091
|
-
code +=
|
|
1112
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.body, function* warpForEachGenerator(item) {
|
|
1113
|
+
code += yield* item.toEmbeddedTS?.((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 })) ?? (0, time_slicing_1.returnOrigin)('');
|
|
1092
1114
|
code += ';\n';
|
|
1093
1115
|
});
|
|
1094
1116
|
}
|
|
1095
1117
|
// 在body渲染完成之后把其余的节点放到下面
|
|
1096
|
-
|
|
1097
|
-
code += item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1118
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.playground, function* warpForEachGenerator(item) {
|
|
1119
|
+
code += yield* item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1098
1120
|
code += '\n';
|
|
1099
1121
|
});
|
|
1100
1122
|
code += `${(0, translator_1.indent)(state?.tabSize || 0 + 4)}}`;
|
|
@@ -1102,35 +1124,38 @@ class Logic extends BaseNode_1.default {
|
|
|
1102
1124
|
return code;
|
|
1103
1125
|
}
|
|
1104
1126
|
toEmbeddedTSNoExport(state) {
|
|
1105
|
-
return this.toEmbeddedTS(state, 'noExport');
|
|
1127
|
+
return (0, time_slicing_1.runGeneratorSync)(this.toEmbeddedTS(state, 'noExport'));
|
|
1106
1128
|
}
|
|
1107
|
-
toEmbeddedTS(state, prefix) {
|
|
1129
|
+
*toEmbeddedTS(state = (0, translator_1.createCompilerState)(), prefix) {
|
|
1130
|
+
const self = this;
|
|
1131
|
+
// 等待 oql 查询返回内容
|
|
1132
|
+
yield (0, common_1.waitOqlQueryComponentChildrenFinish)(self);
|
|
1108
1133
|
// 如果传了不要前缀那就为空, 要不用传进来的,要是都没有就默认导出
|
|
1109
1134
|
let code = '';
|
|
1110
1135
|
if (!prefix) {
|
|
1111
|
-
code += `export function ${
|
|
1136
|
+
code += `export function ${self.name}`;
|
|
1112
1137
|
}
|
|
1113
1138
|
else if (prefix === 'noExport') {
|
|
1114
|
-
code += `function ${
|
|
1139
|
+
code += `function ${self.name}`;
|
|
1115
1140
|
}
|
|
1116
1141
|
else if (prefix === 'inObject') {
|
|
1117
|
-
code += `${
|
|
1142
|
+
code += `${self.name}`;
|
|
1118
1143
|
}
|
|
1119
|
-
if (
|
|
1144
|
+
if (self.typeParams?.length) {
|
|
1120
1145
|
code += '<';
|
|
1121
|
-
|
|
1122
|
-
code += typeParam.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1123
|
-
if (typeParamIndex !==
|
|
1146
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.typeParams, function* warpForEachGenerator(typeParam, typeParamIndex) {
|
|
1147
|
+
code += yield* typeParam.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1148
|
+
if (typeParamIndex !== self.typeParams.length - 1)
|
|
1124
1149
|
code += ', ';
|
|
1125
1150
|
});
|
|
1126
1151
|
code += '>';
|
|
1127
1152
|
}
|
|
1128
1153
|
// 有参数长度
|
|
1129
|
-
if (
|
|
1154
|
+
if (self.params.length) {
|
|
1130
1155
|
code += '(';
|
|
1131
|
-
|
|
1132
|
-
code += param.toEmbeddedTS((0, translator_1.shiftState)(state, code));
|
|
1133
|
-
if (index !==
|
|
1156
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.params, function* warpForEachGenerator(param, index) {
|
|
1157
|
+
code += yield* param.toEmbeddedTS((0, translator_1.shiftState)(state, code));
|
|
1158
|
+
if (index !== self.params.length - 1)
|
|
1134
1159
|
code += ', ';
|
|
1135
1160
|
});
|
|
1136
1161
|
code += ')';
|
|
@@ -1141,94 +1166,73 @@ class Logic extends BaseNode_1.default {
|
|
|
1141
1166
|
}
|
|
1142
1167
|
// 需要类型推导的局部变量/返回值需要调整申明顺序
|
|
1143
1168
|
const advanceMap = new Map();
|
|
1144
|
-
const needGetSourceMapOqlList = [];
|
|
1145
|
-
|
|
1169
|
+
// const needGetSourceMapOqlList: Promise<any>[] = [];
|
|
1170
|
+
yield* self.traverseChildrenGenerator(function* traverseChildrenGenerator(el) {
|
|
1146
1171
|
if (el && (el instanceof BatchAssignment__1.default || (el instanceof Assignment__1.default && el.left?.name))) {
|
|
1147
1172
|
if (el instanceof Assignment__1.default) {
|
|
1148
|
-
const advanceVar =
|
|
1173
|
+
const advanceVar = self.variables?.find((variable) => !variable.typeAnnotation && el.left?.name === variable.name);
|
|
1149
1174
|
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1150
1175
|
advanceMap.set(advanceVar, el);
|
|
1151
1176
|
}
|
|
1152
|
-
const advanceRn =
|
|
1177
|
+
const advanceRn = self.returns?.find((ret) => !ret.typeAnnotation && el.left?.name === ret.name);
|
|
1153
1178
|
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1154
1179
|
advanceMap.set(advanceRn, el);
|
|
1155
1180
|
}
|
|
1156
1181
|
}
|
|
1157
1182
|
else if (el instanceof BatchAssignment__1.default) {
|
|
1158
|
-
el.assignmentLines
|
|
1183
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(el.assignmentLines, function* warpForEachGenerator({ leftIndex }) {
|
|
1159
1184
|
const leftCode = leftIndex.length === 1
|
|
1160
|
-
? el.left.expression.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
|
|
1161
|
-
: el.left.members[leftIndex[1]]?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1162
|
-
const advanceVar =
|
|
1185
|
+
? yield* el.left.expression.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
|
|
1186
|
+
: yield* el.left.members[leftIndex[1]]?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true })) ?? (0, time_slicing_1.returnOrigin)('');
|
|
1187
|
+
const advanceVar = self.variables?.find((variable) => !variable.typeAnnotation && leftCode === variable.name);
|
|
1163
1188
|
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1164
1189
|
advanceMap.set(advanceVar, el);
|
|
1165
1190
|
}
|
|
1166
|
-
const advanceRn =
|
|
1191
|
+
const advanceRn = self.returns?.find((ret) => !ret.typeAnnotation && leftCode === ret.name);
|
|
1167
1192
|
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1168
1193
|
advanceMap.set(advanceRn, el);
|
|
1169
1194
|
}
|
|
1170
1195
|
});
|
|
1171
1196
|
}
|
|
1172
1197
|
}
|
|
1173
|
-
// 如果有sql查询组件就需要把他们存起来
|
|
1174
|
-
if (el instanceof OqlQueryComponent__1.default) {
|
|
1175
|
-
if (!el.codeSourceMap) {
|
|
1176
|
-
needGetSourceMapOqlList.push(el.requestEmbeddedTS());
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
1198
|
});
|
|
1180
|
-
if (needGetSourceMapOqlList.length) {
|
|
1181
|
-
Promise.all(needGetSourceMapOqlList).then(() => {
|
|
1182
|
-
// 触发一下更新重新生成代码
|
|
1183
|
-
this.app?.naslServer?.embeddedTSEmitter.emit('change', {
|
|
1184
|
-
value: [
|
|
1185
|
-
{
|
|
1186
|
-
originEvent: {
|
|
1187
|
-
action: 'update',
|
|
1188
|
-
target: this,
|
|
1189
|
-
},
|
|
1190
|
-
},
|
|
1191
|
-
],
|
|
1192
|
-
});
|
|
1193
|
-
});
|
|
1194
|
-
}
|
|
1195
1199
|
// 兼容 return 没有类型情况
|
|
1196
|
-
if (
|
|
1200
|
+
if (self.returns.length && self.returns[0].typeAnnotation) {
|
|
1197
1201
|
code += ': ';
|
|
1198
|
-
code +=
|
|
1202
|
+
code += yield* self.returns[0].typeAnnotation?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true })) ?? (0, time_slicing_1.returnOrigin)('');
|
|
1199
1203
|
}
|
|
1200
1204
|
code += '{\n';
|
|
1201
1205
|
// 用于虚拟节点的查找引用
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
this.virtualParams.forEach((param) => {
|
|
1206
|
+
if (Array.isArray(self.virtualParams)) {
|
|
1207
|
+
for (const param of self.virtualParams) {
|
|
1205
1208
|
code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
|
|
1206
|
-
code += param.toEmbeddedNameTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1209
|
+
code += yield* param.toEmbeddedNameTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1207
1210
|
code += '\n';
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.variables, function* warpForEachGenerator(variable) {
|
|
1210
1214
|
if (!advanceMap.get(variable)) {
|
|
1211
1215
|
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
|
|
1212
|
-
code += variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1216
|
+
code += yield* variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1213
1217
|
code += ';\n';
|
|
1214
1218
|
}
|
|
1215
1219
|
});
|
|
1216
|
-
|
|
1220
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.returns, function* warpForEachGenerator(ret) {
|
|
1217
1221
|
if (!advanceMap.get(ret)) {
|
|
1218
1222
|
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
|
|
1219
|
-
code += ret.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1223
|
+
code += yield* ret.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1220
1224
|
code += ';\n';
|
|
1221
1225
|
}
|
|
1222
1226
|
});
|
|
1223
|
-
advanceMap.
|
|
1227
|
+
yield* (0, time_slicing_1.wrapIteratorToGenerator)(advanceMap.entries(), function* warpForEachGenerator([node, assignment]) {
|
|
1224
1228
|
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}// @ts-ignore\n`;
|
|
1225
1229
|
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
|
|
1226
|
-
code += node.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1230
|
+
code += yield* node.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1227
1231
|
if (assignment instanceof BatchAssignment__1.default) {
|
|
1228
|
-
assignment.assignmentLines
|
|
1232
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(assignment.assignmentLines, function* warpForEachGenerator({ leftIndex, rightIndex }) {
|
|
1229
1233
|
const leftCode = leftIndex.length === 1
|
|
1230
|
-
? assignment.left.expression.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
|
|
1231
|
-
: assignment.left.members[leftIndex[1]]?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1234
|
+
? yield* assignment.left.expression.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
|
|
1235
|
+
: yield* assignment.left.members[leftIndex[1]]?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true })) ?? (0, time_slicing_1.returnOrigin)('');
|
|
1232
1236
|
if (leftCode === node.name) {
|
|
1233
1237
|
const rightNode = rightIndex.length === 1
|
|
1234
1238
|
? assignment.rights[rightIndex[0]]?.expression
|
|
@@ -1237,21 +1241,21 @@ class Logic extends BaseNode_1.default {
|
|
|
1237
1241
|
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent__1.default && !rightNode.isAutoInfer())) {
|
|
1238
1242
|
if (rightNode.concept === 'NewComposite' && rightNode.typeAnnotation?.typeKind === 'anonymousStructure') {
|
|
1239
1243
|
code += '= ';
|
|
1240
|
-
code += rightNode.getInitCode((0, translator_1.shiftState)(state, code, { inline: true })) || 'null';
|
|
1244
|
+
code += (yield* rightNode.getInitCode((0, translator_1.shiftState)(state, code, { inline: true }))) || 'null';
|
|
1241
1245
|
}
|
|
1242
1246
|
else if (rightNode.concept === 'NewComposite' && rightNode.typeAnnotation?.typeKind === 'generic') {
|
|
1243
1247
|
code += '= ';
|
|
1244
|
-
code += rightNode.getNewCompositeCode((0, translator_1.shiftState)(state, code, { inline: true })) || 'null';
|
|
1248
|
+
code += (yield* rightNode.getNewCompositeCode((0, translator_1.shiftState)(state, code, { inline: true }))) || 'null';
|
|
1245
1249
|
}
|
|
1246
1250
|
else {
|
|
1247
1251
|
code += ': ';
|
|
1248
|
-
code += rightNode.typeAnnotation?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
|
|
1252
|
+
code += yield* rightNode.typeAnnotation?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true })) ?? (0, time_slicing_1.returnOrigin)('null');
|
|
1249
1253
|
}
|
|
1250
1254
|
}
|
|
1251
1255
|
else {
|
|
1252
1256
|
code += ' = ';
|
|
1253
|
-
const rightCode = rightNode?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1254
|
-
code +=
|
|
1257
|
+
const rightCode = yield* rightNode?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true })) ?? (0, time_slicing_1.returnOrigin)('');
|
|
1258
|
+
code += yield* self.getRightCode(rightCode, assignment, rightNode);
|
|
1255
1259
|
}
|
|
1256
1260
|
}
|
|
1257
1261
|
});
|
|
@@ -1260,26 +1264,26 @@ class Logic extends BaseNode_1.default {
|
|
|
1260
1264
|
!assignment.right?.typeAnnotation) {
|
|
1261
1265
|
const rightNode = assignment.right;
|
|
1262
1266
|
code += ' = ';
|
|
1263
|
-
code += rightNode.getInitCode((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1267
|
+
code += yield* rightNode.getInitCode((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1264
1268
|
}
|
|
1265
1269
|
else if (assignment.right?.concept === 'NewComposite' &&
|
|
1266
1270
|
assignment.right?.typeAnnotation?.typeKind === 'anonymousStructure') {
|
|
1267
1271
|
const rightNode = assignment.right;
|
|
1268
1272
|
code += ' = ';
|
|
1269
|
-
code += rightNode.getInitCode((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1273
|
+
code += yield* rightNode.getInitCode((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1270
1274
|
}
|
|
1271
1275
|
else if (assignment.right?.concept === 'NewComposite' &&
|
|
1272
1276
|
assignment.right?.typeAnnotation?.typeKind === 'generic') {
|
|
1273
1277
|
const rightNode = assignment.right;
|
|
1274
1278
|
code += ' = ';
|
|
1275
|
-
code += rightNode.getNewCompositeCode((0, translator_1.shiftState)(state, code, { inline: true }));
|
|
1279
|
+
code += (yield* rightNode.getNewCompositeCode((0, translator_1.shiftState)(state, code, { inline: true })));
|
|
1276
1280
|
}
|
|
1277
1281
|
else {
|
|
1278
1282
|
const rightNode = assignment.right;
|
|
1279
1283
|
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1280
1284
|
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent__1.default && !rightNode.isAutoInfer())) {
|
|
1281
1285
|
code += ': ';
|
|
1282
|
-
code += rightNode.typeAnnotation?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
|
|
1286
|
+
code += yield* rightNode.typeAnnotation?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true })) ?? (0, time_slicing_1.returnOrigin)('null');
|
|
1283
1287
|
}
|
|
1284
1288
|
else {
|
|
1285
1289
|
code += ' = ';
|
|
@@ -1293,20 +1297,20 @@ class Logic extends BaseNode_1.default {
|
|
|
1293
1297
|
}
|
|
1294
1298
|
rightCode +=
|
|
1295
1299
|
rightNode && rightNode.toEmbeddedTS
|
|
1296
|
-
? rightNode.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
|
|
1300
|
+
? yield* rightNode.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
|
|
1297
1301
|
: '__RIGHT__';
|
|
1298
|
-
code +=
|
|
1302
|
+
code += yield* self.getRightCode(rightCode, assignment, rightNode);
|
|
1299
1303
|
}
|
|
1300
1304
|
}
|
|
1301
1305
|
code += ';\n';
|
|
1302
1306
|
});
|
|
1303
|
-
if (!
|
|
1304
|
-
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}return ${
|
|
1307
|
+
if (!self.body.length && self.returns.length) {
|
|
1308
|
+
code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}return ${self.returns[0].name};\n`;
|
|
1305
1309
|
}
|
|
1306
1310
|
else {
|
|
1307
1311
|
// 如果长度小于2 并且不是虚拟节点就 加 报错,
|
|
1308
|
-
if (
|
|
1309
|
-
if (
|
|
1312
|
+
if (self.body.length <= 2 && !(self.parentNode instanceof Namespace__1.default)) {
|
|
1313
|
+
if (self.body.length && self.body[0].concept === 'JavaLogic') {
|
|
1310
1314
|
code += '';
|
|
1311
1315
|
}
|
|
1312
1316
|
else {
|
|
@@ -1314,14 +1318,14 @@ class Logic extends BaseNode_1.default {
|
|
|
1314
1318
|
code += 'const __LogicEmpty: any = null;';
|
|
1315
1319
|
}
|
|
1316
1320
|
}
|
|
1317
|
-
|
|
1318
|
-
code +=
|
|
1321
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.body, function* warpForEachGenerator(item) {
|
|
1322
|
+
code += yield* item.toEmbeddedTS?.((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 })) ?? (0, time_slicing_1.returnOrigin)('');
|
|
1319
1323
|
code += ';\n';
|
|
1320
1324
|
});
|
|
1321
1325
|
}
|
|
1322
1326
|
// 在body渲染完成之后把其余的节点放到下面
|
|
1323
|
-
|
|
1324
|
-
code += item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1327
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(self.playground, function* warpForEachGenerator(item) {
|
|
1328
|
+
code += yield* item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1325
1329
|
code += ';\n';
|
|
1326
1330
|
});
|
|
1327
1331
|
code += `${(0, translator_1.indent)(state?.tabSize || 0)}}`;
|
|
@@ -1411,7 +1415,7 @@ ${(0, translator_1.indent)(state.tabSize)} */\n`;
|
|
|
1411
1415
|
partialCode = item.toNaturalTS((0, translator_1.shiftState)(state, code, { tabSize: state.tabSize + 1 }));
|
|
1412
1416
|
}
|
|
1413
1417
|
else if (item.toEmbeddedTS) {
|
|
1414
|
-
partialCode = item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: state.tabSize + 1 }));
|
|
1418
|
+
partialCode = (0, time_slicing_1.runGeneratorSync)(item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: state.tabSize + 1 })));
|
|
1415
1419
|
}
|
|
1416
1420
|
if (partialCode.trim()) {
|
|
1417
1421
|
code += partialCode;
|
|
@@ -1427,7 +1431,7 @@ ${(0, translator_1.indent)(state.tabSize)} */\n`;
|
|
|
1427
1431
|
code += '\n';
|
|
1428
1432
|
return code;
|
|
1429
1433
|
}
|
|
1430
|
-
getRightCode(code, assignment, rightNode) {
|
|
1434
|
+
*getRightCode(code, assignment, rightNode) {
|
|
1431
1435
|
code = code.replaceAll('\n', ' ');
|
|
1432
1436
|
if (assignment instanceof Assignment__1.default && !assignment.right)
|
|
1433
1437
|
return code;
|
|
@@ -1445,12 +1449,12 @@ ${(0, translator_1.indent)(state.tabSize)} */\n`;
|
|
|
1445
1449
|
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
1446
1450
|
const forEachStatement = assignment.getAncestor('ForEachStatement');
|
|
1447
1451
|
if (forEachStatement) {
|
|
1448
|
-
code = this.handleForEachCode(code, forEachStatement);
|
|
1452
|
+
code = yield* this.handleForEachCode(code, forEachStatement);
|
|
1449
1453
|
}
|
|
1450
1454
|
// Match 需要针对分支缩小类型范围
|
|
1451
1455
|
const matchCase = assignment.getAncestor('MatchCase');
|
|
1452
1456
|
if (matchCase) {
|
|
1453
|
-
code = this.handleMatchCaseCode(code, matchCase);
|
|
1457
|
+
code = yield* this.handleMatchCaseCode(code, matchCase);
|
|
1454
1458
|
}
|
|
1455
1459
|
return code;
|
|
1456
1460
|
}
|
|
@@ -1480,33 +1484,34 @@ ${(0, translator_1.indent)(state.tabSize)} */\n`;
|
|
|
1480
1484
|
return fnCode;
|
|
1481
1485
|
});
|
|
1482
1486
|
}
|
|
1483
|
-
handleForEachCode(code, forEachStatement) {
|
|
1487
|
+
*handleForEachCode(code, forEachStatement) {
|
|
1484
1488
|
const { item, index, each } = forEachStatement;
|
|
1485
1489
|
if (code.includes(item.name)) {
|
|
1486
|
-
const eachTSCode = each ? each.toEmbeddedTS() : '__IDENTIFIER__';
|
|
1490
|
+
const eachTSCode = each ? yield* each.toEmbeddedTS() : '__IDENTIFIER__';
|
|
1487
1491
|
code = this.handleReplaceCode(code, item.name, eachTSCode === '__IDENTIFIER__' ? eachTSCode : `${eachTSCode}.__get(0)`);
|
|
1488
1492
|
}
|
|
1489
|
-
if (code.includes(index.name))
|
|
1493
|
+
if (code.includes(index.name)) {
|
|
1490
1494
|
code = this.handleReplaceCode(code, index.name, 'new nasl.core.Long(0)');
|
|
1495
|
+
}
|
|
1491
1496
|
const parentForEachStatement = forEachStatement.getAncestor('ForEachStatement');
|
|
1492
1497
|
if (parentForEachStatement) {
|
|
1493
|
-
this.handleForEachCode(code, parentForEachStatement);
|
|
1498
|
+
code = yield* this.handleForEachCode(code, parentForEachStatement);
|
|
1494
1499
|
}
|
|
1495
1500
|
return code;
|
|
1496
1501
|
}
|
|
1497
|
-
handleMatchCaseCode(code, matchCase) {
|
|
1502
|
+
*handleMatchCaseCode(code, matchCase) {
|
|
1498
1503
|
const match = matchCase.getAncestor('Match');
|
|
1499
|
-
const expressionTsCode = match.expression.toEmbeddedTS();
|
|
1504
|
+
const expressionTsCode = yield* match.expression.toEmbeddedTS();
|
|
1500
1505
|
if (code.includes(expressionTsCode)) {
|
|
1501
1506
|
let typeCode = '';
|
|
1502
|
-
matchCase.patterns
|
|
1507
|
+
yield* (0, time_slicing_1.wrapForEachToGenerator)(matchCase.patterns, function* wrapForEach(pattern, index) {
|
|
1503
1508
|
if (pattern instanceof TypeAnnotation__1.default) {
|
|
1504
1509
|
if (index === 0) {
|
|
1505
|
-
typeCode += pattern.toEmbeddedTS();
|
|
1510
|
+
typeCode += yield* pattern.toEmbeddedTS();
|
|
1506
1511
|
}
|
|
1507
1512
|
else {
|
|
1508
1513
|
typeCode += '|';
|
|
1509
|
-
typeCode += pattern.toEmbeddedTS();
|
|
1514
|
+
typeCode += yield* pattern.toEmbeddedTS();
|
|
1510
1515
|
}
|
|
1511
1516
|
}
|
|
1512
1517
|
});
|
|
@@ -1516,7 +1521,7 @@ ${(0, translator_1.indent)(state.tabSize)} */\n`;
|
|
|
1516
1521
|
}
|
|
1517
1522
|
const parentMatchCase = match.getAncestor('MatchCase');
|
|
1518
1523
|
if (parentMatchCase) {
|
|
1519
|
-
code = this.handleMatchCaseCode(code, parentMatchCase);
|
|
1524
|
+
code = yield* this.handleMatchCaseCode(code, parentMatchCase);
|
|
1520
1525
|
}
|
|
1521
1526
|
return code;
|
|
1522
1527
|
}
|
|
@@ -1615,11 +1620,11 @@ ${(0, translator_1.indent)(state.tabSize)} */\n`;
|
|
|
1615
1620
|
}
|
|
1616
1621
|
return `/embedded/${this.app.name}${_path}/logics/${name}.ts`;
|
|
1617
1622
|
}
|
|
1618
|
-
toEmbeddedTSFile() {
|
|
1623
|
+
*toEmbeddedTSFile() {
|
|
1619
1624
|
let code = `namespace ${this.getTsNamespace()} {\n`;
|
|
1620
1625
|
const state = (0, translator_1.createCompilerState)(code, { tabSize: 1 });
|
|
1621
1626
|
try {
|
|
1622
|
-
code += this.toEmbeddedTS(state);
|
|
1627
|
+
code += yield* this.toEmbeddedTS(state);
|
|
1623
1628
|
}
|
|
1624
1629
|
catch (err) {
|
|
1625
1630
|
console.log(err, `有问题翻译失败:${this.getTsNamespace()}.${this.name}`);
|
|
@@ -1829,10 +1834,10 @@ __decorate([
|
|
|
1829
1834
|
(0, decorators_1.property)('LogicItem')
|
|
1830
1835
|
], Logic.prototype, "playground", void 0);
|
|
1831
1836
|
__decorate([
|
|
1832
|
-
|
|
1837
|
+
translator_1.withSourceMapGenerator
|
|
1833
1838
|
], Logic.prototype, "toEmbeddedTSInProcess", null);
|
|
1834
1839
|
__decorate([
|
|
1835
|
-
|
|
1840
|
+
translator_1.withSourceMapGenerator
|
|
1836
1841
|
], Logic.prototype, "toEmbeddedTS", null);
|
|
1837
1842
|
__decorate([
|
|
1838
1843
|
(0, translator_1.withSourceMap)()
|