Open
Description
varDeclare中,在递归查找父作用域之后,不是应该定义到最终查找到的父作用域上吗,怎么还是赋给了this.declaration?
varDeclare (name, value) {
let scope = this
// 若当前作用域存在非函数类型的父级作用域时,就把变量定义到父级作用域
while (scope.parentScope && scope.type !== 'function') {
scope = scope.parentScope
}
this.declaration[name] = new SimpleValue(value, 'var')
return this.declaration[name]
}
Metadata
Assignees
Labels
No labels
Activity