JavaScript抽象语法树英文对照

type:"Program" //顶级对象类型 

type:"Identifier" // 标识符

type:"FuncationDeclaration" // 函数申明

type:"Literal" // 字面量

generator: false // 是不是generator函数

expression: false, // 是不是一个表达式

async: false // 是不是一个异步函数

row: //原始未被加工过的值

kind:// 变量申明的关键字

sourceType:'script' // 资源类型

  

{
    "type": "Program",
    "body": [
        {
            "type": "VariableDeclaration",
            "declarations": [
                {
                    "type": "VariableDeclarator",
                    "id": {
                        "type": "Identifier",
                        "name": "a"
                    },
                    "init": {
                        "type": "Literal",
                        "value": 1,
                        "raw": "1"
                    }
                }
            ],
            "kind": "var"
        },
        {
            "type": "VariableDeclaration",
            "declarations": [
                {
                    "type": "VariableDeclarator",
                    "id": {
                        "type": "Identifier",
                        "name": "b"
                    },
                    "init": {
                        "type": "BinaryExpression",
                        "operator": "+",
                        "left": {
                            "type": "Identifier",
                            "name": "a"
                        },
                        "right": {
                            "type": "Literal",
                            "value": 1,
                            "raw": "1"
                        }
                    }
                }
            ],
            "kind": "var"
        }
    ],
    "sourceType": "script"
}

  

原文地址:https://www.cnblogs.com/winyh/p/11089974.html