Skip to main content
Version: 3.8

NewMap Map 构造器

1. 结构声明

class NewMap extends LogicItem {
keys: Array<LogicItem>;
values: Array<LogicItem>;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "NewMap",
"keys": [
{
"concept": "NumericLiteral",
"value": "1",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
},
{
"concept": "NumericLiteral",
"value": "2",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
},
{
"concept": "NumericLiteral",
"value": "3",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
}
],
"values": [
{
"concept": "StringLiteral",
"value": "选项1"
},
{
"concept": "StringLiteral",
"value": "选项2"
},
{
"concept": "StringLiteral",
"value": "选项3"
}
]
}

对应的代码如下:

[1 -> '选项1', 2 -> '选项2', 3 -> '选项3']