Skip to main content
Version: 3.8

MatchCase 匹配分支

1. 结构声明

class MatchCase extends LogicItem {
patterns: Array<LogicItem | TypeAnnotation>;
body: Array<LogicItem>;
isMatchedTypeEnumable: boolean = false;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "MatchCase",
"patterns": [
{
"concept": "BooleanLiteral",
"value": "true"
}
],
"body": [
{
"concept": "NumericLiteral",
"value": "1",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
}
],
"isMatchedTypeEnumable": true
}

对应的代码如下:

true => {
1
}

(2) 示例

AST 如下:

{
"concept": "MatchCase",
"patterns": [],
"body": [],
"isMatchedTypeEnumable": false
}

对应的代码如下:

_ => {
}