Record Class PreprocessorFlow

java.lang.Object
java.lang.Record
com.github._1c_syntax.bsl.languageserver.cfg.PreprocessorFlow
Record Components:
vertices - вершины, достижимые из входа хотя бы в одном из выбранных контекстов.
edges - рёбра достижимых переходов.

public record PreprocessorFlow(Set<CfgVertex> vertices, Set<CfgEdge> edges) extends Record
Достижимые вершины и рёбра CFG для множества возможных контекстов компиляции.

Фабрика of(ControlFlowGraph, Set) обходит граф от входа, исключая ложные ветки препроцессора. При неизвестном условии сохраняются обе ветки. Остальные условия не сужаются дополнительно; рёбра CfgEdgeType.ADJACENT_CODE не участвуют в достижимости.

Исходный граф не изменяется. Вершины и рёбра не копируются и сравниваются по идентичности. Фабрика возвращает неизменяемые множества; прямой конструктор record сохраняет переданные множества без защитного копирования.

  • Constructor Details

    • PreprocessorFlow

      public PreprocessorFlow(Set<CfgVertex> vertices, Set<CfgEdge> edges)
      Creates an instance of a PreprocessorFlow record class.
      Parameters:
      vertices - the value for the vertices record component
      edges - the value for the edges record component
  • Method Details

    • of

      public static PreprocessorFlow of(ControlFlowGraph graph, Set<ExecutionContext> contexts)
      Построить представление достижимой части графа с учётом препроцессора.

      Условия вычисляются через PreprocessorContexts. Исключаются и рёбра веток, и недостижимые по оставшимся рёбрам вершины: их операторы не должны влиять на типы.

      Контексты распространяются по рёбрам от входа: вложенная ветка не может восстановить режим, исключённый внешним условием. Это сохраняет противоречия и при объединении режимов.

      Parameters:
      graph - исходный граф с вершинами условий препроцессора.
      contexts - возможные контексты тела; пустое множество исключает всё тело.
      Returns:
      новое представление с неизменяемыми множествами объектов исходного графа.
    • of

      public static PreprocessorFlow of(ControlFlowGraph graph, Set<ExecutionContext> contexts, FileType fileType)
      Построить достижимую часть графа по символам выбранного диалекта.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • vertices

      public Set<CfgVertex> vertices()
      Returns the value of the vertices record component.
      Returns:
      the value of the vertices record component
    • edges

      public Set<CfgEdge> edges()
      Returns the value of the edges record component.
      Returns:
      the value of the edges record component