2
當用訪客解析AST時,訪問者如何檢測範圍更改?例如,當我們在Class節點中時,我們創建了Class scope,但是如何檢測我們何時離開一個類節點來關閉範圍?AST解析,檢測當前範圍
1: Stmt_Class(
type: 0
extends: null
implements: array(
)
stmts: array(
0: Stmt_ClassMethod(
type: 1
byRef: false
params: array(
0: Param(
name: str
default: null
type: null
byRef: false
)
)
stmts: array(
0: Stmt_Return(
expr: Expr_FuncCall(
name: Name(
parts: array(
0: mysql_real_escape_string
)
name: null
)
args: array(
0: Arg(
value: Expr_Variable(
name: str
)
byRef: false
name: null
)
)
)
name: null
)
)
name: clear
)
)
name: Filter
)