src/vm/oba_compiler.c
static int resolveLocal(Compiler* compiler, Token name) {
  // Find the first local whose depth is gte the current scope and whose
  // token matches `name`.
  for (int i = compiler->localCount - 1; i >= 0; i--) {
    Local local = compiler->locals[i];
    if (local.token.length == name.length &&
        identifiersMatch(local.token, name)) {
      if (local.depth < 0) {
        error(compiler, "Cannot read local variable in its own initializer");
        return -1;
      } else {
        return i;
      }
    }
  }
  return -1;
}
// Finds a local variable named [name] in the current scope.
// Returns a negative number if it is not found.
Finds a local variable named [name] in the current scope.
Returns a negative number if it is not found.
Finds a local variable named [ name ] in the current scope . Returns a negative number if it is not found .
static int resolveLocal(Compiler* compiler, Token name) {
  for (int i = compiler->localCount - 1; i >= 0; i--) {
    Local local = compiler->locals[i];
    if (local.token.length == name.length &&
        identifiersMatch(local.token, name)) {
      if (local.depth < 0) {
        error(compiler, "Cannot read local variable in its own initializer");
        return -1;
      } else {
        return i;
      }
    }
  }
  return -1;
}
static int resolveLocal ( Compiler * compiler , Token name ) { for ( int i = compiler -> localCount - 1 ; i >= 0 ; i -- ) { Local local = compiler -> locals [ i ] ; if ( local . token . length == name . length && identifiersMatch ( local . token , name ) ) { if ( local . depth < 0 ) { error ( compiler , " " ) ; return -1 ; } else { return i ; } } } return -1 ; }
Finds a local variable named [name] in the current scope.
Finds a local variable named [ name ] in the current scope .
// Find the first local whose depth is gte the current scope and whose // token matches `name`.