ESTree Node Types Table
Guy Lewin edited this page Nov 3, 2019
·
1 revision
(Thanks @xuld)
Node Type | Example | Chinsese Transition |
---|---|---|
Program | 程序 | |
ImportDeclaration | import foo from "path" |
导入声明 |
ImportSpecifier | import * as foo |
命名空间导入声明符 |
ImportDefaultSpecifier | import foo |
默认导入声明符 |
ImportNamespaceSpecifier | foo as local |
导入声明符 |
Import | import |
导出声明 |
ExportNamedDeclaration | export foo |
导出声明 |
ExportSpecifier | export * as foo |
命名空间导出声明 |
ExportNamespaceSpecifier | foo as local |
导出声明符 |
ExportDefaultDeclaration | export default |
默认导出声明符 |
ExportAllDeclaration | export * |
全部导出声明 |
VariableDeclaration | var x, y |
变量声明 |
VariableDeclarator | x = 1 |
变量声明符 |
ArrayPattern | [x] |
数组析构模式 |
ObjectPattern | {y} |
对象析构模式 |
AssignmentPattern | x = 1 |
赋值析构模式 |
RestElement | ...foo |
展开析构模式 |
FunctionDeclaration | function f() { } |
函数声明 |
ClassDeclaration | class C { } |
类声明 |
ClassBody | { } |
类主体 |
MethodDefinition | f() { } |
方法声明 |
FieldDefinition | foo = 1 |
字段声明 |
PrivateName | #foo |
私有字段声明 |
Decorator | @foo |
修饰器 |
Node Type | Example | Chinsese Transition |
---|---|---|
BlockStatement | {} |
块语句 |
IfStatement | if (x) {} |
if 语句 |
SwitchStatement | switch (x) {} |
switch 语句 |
SwitchCase | case x: |
case 或 default 分句 |
WhileStatement | while (x) {} |
while 语句 |
DoWhileStatement | do {} while (x) |
do..while 语句 |
ForStatement | for (;;) { } |
for 语句 |
ForInStatement | for (var x in foo) { } |
for..in 语句 |
ForOfStatement | for (var x of foo) { } |
for..of 语句 |
BreakStatement | break |
break 语句 |
ContinueStatement | continue |
continue 语句 |
ReturnStatement | return foo |
return 语句 |
TryStatement | try { } catch(e) {} |
try 语句 |
CatchClause | catch(e) {} |
catch 分句 |
ThrowStatement | throw err |
throw 语句 |
LabeledStatement | label: |
标签语句 |
DebuggerStatement | debugger |
debugger 语句 |
WithStatement | with (x) { } |
with 语句 |
EmptyStatement | ; |
空语句 |
ExpressionStatement | foo; |
表达式语句 |
Node Type | Example | Chinsese Transition |
---|---|---|
UnaryExpression | +x |
单目运算表达式 |
BinaryExpression | x + y |
双目运算表达式 |
LogicalExpression | x && y |
逻辑运算表达式 |
CoalesceExpression | x ?? y |
空值表达式 |
AssignmentExpression | x = y |
赋值运算表达式 |
UpdateExpression | x++ |
增量表达式 |
ThisExpression | this |
this 表达式 |
Super | super |
super 表达式 |
MemberExpression | x.y |
成员访问表达式 |
OptionalExpression | x?.y |
非空访问表达式 |
CallExpression | x() |
函数调用表达式 |
NewExpression | new C() |
new 表达式 |
ImportExpression | import("foo") |
导入表达式 |
ConditionalExpression | x ? y : z |
条件表达式 |
SequenceExpression | x, y |
逗号表达式 |
AwaitExpression | await foo |
await 表达式 |
YieldExpression | yield foo |
yield 表达式 |
MetaProperty | import.meta |
import 元信息表达式 |
DoExpression | do {} |
do 表达式 |
ParenthesizedExpression | (foo) |
括号表达式 |
Node Type | Example | Chinsese Transition |
---|---|---|
Literal |
0 /true /... |
字面量 |
NumberLiteral | 0 |
数字字面量 |
BooleanLiteral | true |
布尔字面量 |
NullLiteral | null |
空字面量 |
RegExpLiteral | /foo/g |
正则表达式字面量 |
StringLiteral | 'foo' |
字符串字面量 |
TemplateLiteral | `foo` |
模板字面量 |
TemplateElement | ${foo} |
模板元素 |
TaggedTemplateExpression | tag`foo` |
标签模板表达式 |
BigIntLiteral | 99n |
大整数字面量 |
ArrayExpression | [x, y] |
数组表达式 |
SpreadElement | ...x |
展开元素 |
ObjectExpression | {x: 1, y} |
对象表达式 |
Property | x: 1 |
对象属性 |
FunctionExpression | function () {} |
函数表达式 |
ArrowFunctionExpression | () => {} |
箭头函数 |
ClassExpression | class {} |
类表达式 |
Identifier | foo |
标识符 |
Node Type | Example | Chinsese Transition |
---|---|---|
JSXElement | <foo /> |
JSX 元素 |
JSXOpeningElement | <foo> |
JSX 元素打包标签 |
JSXClosingElement | </foo> |
JSX 元素关闭标签 |
JSXAttribute | foo="goo" |
JSX 属性 |
JSXSpreadAttribute | {...foo} |
JSX 展开属性 |
JSXFragment | <></> |
JSX 片段 |
JSXOpeningFragment | <> |
JSX 片段打包标签 |
JSXClosingFragment | </> |
JSX 片段关闭标签 |
JSXEmptyExpression | {} |
JSX 空表达式 |
JSXExpressionContainer | {foo} |
JSX 表达式容器 |
JSXIdentifier | foo |
JSX 标识符 |
JSXNamespacedName | foo:goo |
JSX 命名空间 |
JSXMemberExpression | foo.goo |
JSX 成员调用表达式 |
JSXSpreadChild | {foo} |
JSX 子元素 |
JSXText | |
JSX 文本 |