this.targetScope.set(rawName, new Variable(Kind.let, value));
}
// const类型变量定义
public defineConst...(rawName: string, value: any) {
this.targetScope.set(rawName, new Variable(Kind.const, value));...}
// 作用域链实现,向上查找标识符
public search(rawName: string): Variable | null {
if (this.targetScope.get...return this.parent.search(rawName);
} else {
return null;
}
}
// 变量声明方法,变量已定义则抛出语法错误异常...: Expression | null;
}
Identifier
顾名思义,标识符节点,我们写 JS 时定义的变量名,函数名,属性名,都归为标识符。