code: function getVariable (name, leafNode) {
    let node = leafNode
  
    while (node != null) {
      const variables = node.variables
      const variable = variables && variables.find(v => v.id.name === name)
  
      if (variable != null) {
        return variable
      }
  
      node = node.parent
    }
  
    return null
  }
docs: Get the variable by names.
  @param {string} name The variable name to find.
  @param {ASTNode} leafNode The node to look up.
  @returns {Variable|null} The found variable or null.