All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aya.resolve.context.ReporterContext Maven / Gradle / Ivy

The newest version!
// Copyright (c) 2020-2024 Tesla (Yinsen) Zhang.
// Use of this source code is governed by the MIT license that can be found in the LICENSE.md file.
package org.aya.resolve.context;

import kala.collection.mutable.MutableList;
import org.aya.syntax.concrete.stmt.ModuleName;
import org.aya.syntax.ref.AnyVar;
import org.aya.syntax.ref.LocalVar;
import org.aya.util.error.SourcePos;
import org.aya.util.reporter.Reporter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.nio.file.Path;

/**
 * Overrides the {@link #reporter} of {@link #parent}.
 *
 * @see org.aya.resolve.error.NameProblem.UnqualifiedNameNotFoundError#didYouMean
 */
public record ReporterContext(@NotNull Context parent, @NotNull Reporter reporter) implements Context {
  @Override public @NotNull Context parent() { return parent; }
  @Override public @NotNull Reporter reporter() { return reporter; }

  @Override public @NotNull Path underlyingFile() {
    return parent.underlyingFile();
  }

  @Override public MutableList collect(@NotNull MutableList container) {
    return parent.collect(container);
  }

  @Override public @Nullable LocalVar getUnqualifiedLocalMaybe(
    @NotNull String name, @NotNull SourcePos sourcePos
  ) {
    return null;
  }

  @Override public @Nullable AnyVar getQualifiedLocalMaybe(
    @NotNull ModuleName.Qualified modName,
    @NotNull String name,
    @NotNull SourcePos sourcePos
  ) {
    return parent.getQualifiedLocalMaybe(modName, name, sourcePos);
  }

  @Override public @Nullable ModuleExport getModuleLocalMaybe(@NotNull ModuleName.Qualified modName) {
    return null;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy