private static void replace_variants_with_name_(ErrorState state,
                                                  Frame frame,
                                                  PsiBuilder builder,
                                                  IElementType elementType,
                                                  boolean result,
                                                  boolean pinned) {
    int initialPos = builder.rawTokenIndex();
    boolean willFail = !result && !pinned;
    if (willFail && initialPos == frame.position && frame.lastVariantAt == frame.position &&
        frame.name != null && state.variants.size() >= frame.variantCount + (elementType == null ? 0 : 2)) {
      state.clearVariants(true, frame.variantCount);
      addVariantInner(state, frame, initialPos, frame.name);
    }
  }
private static void replace_variants_with_name_(ErrorState state,
                                                  Frame frame,
                                                  PsiBuilder builder,
                                                  IElementType elementType,
                                                  boolean result,
                                                  boolean pinned)