Constant 常量
1. 结构声明
- TS Declaration
- JSON Schema
class Constant extends BaseNode {
name: string = '';
description: string;
typeAnnotation: TypeAnnotation;
defaultValue: DefaultValue;
}
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
},
"defaultValue": {
"$ref": "#/definitions/DefaultValue"
}
},
"required": [
"name",
"description",
"typeAnnotation",
"defaultValue"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Constant",
"name": "MAX_COUNT",
"description": "",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"defaultValue": {
"concept": "DefaultValue",
"expression": {
"concept": "NumericLiteral",
"value": "100",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
},
"playground": []
}
}
concept: Constant
name: MAX_COUNT
description: ""
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
defaultValue:
concept: DefaultValue
expression:
concept: NumericLiteral
value: "100"
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
playground: []