package jetbrains.mps.checkers;

/*Generated by MPS */

import jetbrains.mps.baseLanguage.closures.runtime._FunctionTypes;
import jetbrains.mps.annotations.GeneratedClass;
import jetbrains.mps.errors.item.NodeReportItem;
import org.jetbrains.mps.openapi.model.SNode;

/**
 * A helper class used in {@link jetbrains.mps.checkers.AbstractNodeCheckerInEditor } as a way to provide interface to error collecting
 * and dependency tracking facility. 
 * <p>
 * Here by "dependency" is meant any node that is "accessed" while running checks on the "current" node, 
 * and only makes sense when used in conjunction with {@link jetbrains.mps.checkers.LanguageErrorsComponent }.
 * <p>
 * The method {@link jetbrains.mps.checkers.LanguageErrorsCollector#runCheckingAction(_FunctionTypes._return_P0_E0<? extends Result>) } can be used to automatically track and add all dependencies
 * that arise when the {@code action} is executed. 
 */
@GeneratedClass(node = "r:ba41e9c6-15ca-4a47-95f2-6a81c2318547(jetbrains.mps.checkers)/1915871562652911288", model = "r:ba41e9c6-15ca-4a47-95f2-6a81c2318547(jetbrains.mps.checkers)")
public abstract class LanguageErrorsCollector {

  public void addError(NodeReportItem reportItem) {
    addErrorInternal(reportItem);
  }

  protected abstract void addErrorInternal(NodeReportItem reportItem);

  public void addDependency(SNode dependency) {
  }

  public <Result> Result runCheckingAction(_FunctionTypes._return_P0_E0<? extends Result> action) {
    return action.invoke();
  }
}
