Skip to main content
Version: Latest(3.11)

CallFunction 调用函数

1. 结构声明

class CallFunction extends LogicItem {
calleeNamespace: string;
calleeName: string;
shortcut?: boolean;
typeArguments?: Array<TypeAnnotation>;
arguments: Array<Argument>;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "CallFunction",
"label": "调用逻辑",
"calleeNamespace": "nasl.util",
"calleeName": "Clone",
"arguments": [
{
"concept": "Argument",
"keyword": "obj",
"expression": {
"concept": "Identifier",
"namespace": "",
"name": "student"
}
}
]
}

对应的代码如下:

Clone(student)

(2) 带 lambda 的入参

AST 如下:

{
"concept": "CallFunction",
"label": "内置函数",
"calleeNamespace": "nasl.util",
"calleeName": "ListFilter",
"typeArguments": [],
"arguments": [
{
"concept": "Argument",
"keyword": "list",
"expression": {
"concept": "Identifier",
"namespace": "",
"name": "list"
}
},
{
"concept": "Argument",
"keyword": "by",
"expression": {
"concept": "AnonymousFunction",
"params": [
{
"concept": "Param",
"name": "item",
"description": ""
}
],
"body": {
"concept": "BinaryExpression",
"left": {
"concept": "MemberExpression",
"object": {
"concept": "MemberExpression",
"object": {
"concept": "Identifier",
"namespace": "",
"name": "item"
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "productReport"
}
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "executed"
}
},
"right": {
"concept": "NullLiteral"
},
"operator": "!="
}
}
}
]
}

对应的代码如下:

ListFilter(list, { item: String => item.productReport.executed != null })