findVariable method

AstReferenceVariable? findVariable(
  1. String? variableName
)

查找变量

Implementation

AstReferenceVariable? findVariable(String? variableName) {
  var ref = _variables[variableName];
  if (ref != null) {
    return ref;
  }
  //如果当前作用域没有匹配变量,向上追溯查找变量
  if (parent != null) {
    ref = parent!.findVariable(variableName);
  }
  return ref;
}