MemberExpression 成员表达式
1. 结构声明
- TS Declaration
- JSON Schema
class MemberExpression extends LogicItem {
object: LogicItem;
property: LogicItem;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"folded": {
"type": "boolean"
},
"offsetX": {
"type": "number"
},
"offsetY": {
"type": "number"
},
"object": {
"$ref": "#/definitions/LogicItem"
},
"property": {
"$ref": "#/definitions/LogicItem"
}
},
"required": [
"object",
"property"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "MemberExpression",
"object": {
"concept": "Identifier",
"namespace": "",
"name": "student"
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "name"
}
}
concept: MemberExpression
object:
concept: Identifier
namespace: ""
name: student
property:
concept: Identifier
namespace: ""
name: name
对应的代码如下:
- 文本化 NASL
student.name
(2) 示例
AST 如下:
- JSON
- YAML
{
"concept": "MemberExpression",
"object": {
"concept": "MemberExpression",
"object": {
"concept": "Identifier",
"namespace": "",
"name": "item"
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "student"
}
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "name"
}
}
concept: MemberExpression
object:
concept: MemberExpression
object:
concept: Identifier
namespace: ""
name: item
property:
concept: Identifier
namespace: ""
name: student
property:
concept: Identifier
namespace: ""
name: name
对应的代码如下:
- 文本化 NASL
item.student.name
(3) 枚举标识符
AST 如下:
- JSON
- YAML
{
"concept": "MemberExpression",
"object": {
"concept": "Identifier",
"namespace": "app.enums",
"name": "Status"
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "Normal"
}
}
concept: MemberExpression
object:
concept: Identifier
namespace: app.enums
name: Status
property:
concept: Identifier
namespace: ""
name: Normal
对应的代码如下:
- 文本化 NASL
app::enums::Status.Normal
(4) 数值枚举标识符
AST 如下:
- JSON
- YAML
{
"concept": "MemberExpression",
"object": {
"concept": "Identifier",
"namespace": "app.enums",
"name": "Status"
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "0"
}
}
concept: MemberExpression
object:
concept: Identifier
namespace: app.enums
name: Status
property:
concept: Identifier
namespace: ""
name: "0"
对应的代码如下:
- 文本化 NASL
app::enums::Status.0