All files / output zcl_abapgit_diff.clas.mjs

65.33% Statements 245/375
73.46% Branches 36/49
54.54% Functions 12/22
65.33% Lines 245/375

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 3751x 1x 12x 12x 12x 12x 12x 12x 12x               12x 12x     12x 12x 12x 1x 1x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 50x 50x 50x 29x 50x 4x 21x 4x 4x 50x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x   12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 96x 96x 96x 96x 12x 12x 12x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 12x 1x 1x 1x 1x 12x                                             12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 50x 50x 50x 50x 326x 326x 326x 12x 12x 12x 12x     12x 12x 12x 12x 12x 2x 12x 1x 10x 1x 1x 12x 12x 12x 12x 12x 326x 50x 12x 12x                                                           12x                                                       12x                                                       12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x 11x 26x 26x 26x 12x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x     3x 3x 3x 3x 24x 24x 24x 24x     24x     24x 24x 3x 3x 1x 12x 12x               12x 1x 1x 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_diff.clas.abap
class zcl_abapgit_diff {
  static STATIC_SUPER = undefined;
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_DIFF';
  static IMPLEMENTED_INTERFACES = ["ZIF_ABAPGIT_DIFF"];
  static ATTRIBUTES = {"MT_BEACONS": {"type": () => {return abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_definitions=>ty_string_tt");}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MT_DIFF": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({
  "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
  "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
  "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
  "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
  "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
  "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"new_num","type":"SORTED","isUnique":false,"keyFields":["NEW_NUM"]},{"name":"old_num","type":"SORTED","isUnique":false,"keyFields":["OLD_NUM"]}]}, "zif_abapgit_definitions=>ty_diffs_tt");}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MS_STATS": {"type": () => {return new abap.types.Structure({
  "insert": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-INSERT"}),
  "delete": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-DELETE"}),
  "update": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-UPDATE"})}, "zif_abapgit_definitions=>ty_count", undefined, {}, {});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "C_STARTING_BEACON": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "visibility": "I", "is_constant": "X", "is_class": "X"}};
  static METHODS = {"MAP_BEACONS": {"visibility": "I", "parameters": {}},
  "SHORTLIST": {"visibility": "I", "parameters": {}},
  "CREATE_REGEX_SET": {"visibility": "I", "parameters": {"RT_REGEX_SET": {"type": () => {return abap.types.TableFactory.construct(new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":["TABLE_LINE"]},"secondary":[]}, "zcl_abapgit_diff=>ty_regexset_tt");}, "is_optional": " ", "parm_kind": "R", "type_name": "TableType"}}},
  "CALCULATE_STATS": {"visibility": "I", "parameters": {}}};
  #mt_beacons;
  #mt_diff;
  #ms_stats;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "map_beacons": this.#map_beacons.bind(this),
      "shortlist": this.#shortlist.bind(this),
      "create_regex_set": this.#create_regex_set.bind(this),
      "calculate_stats": this.#calculate_stats.bind(this),
    };
    this.#mt_beacons = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_definitions=>ty_string_tt");
    this.FRIENDS_ACCESS_INSTANCE["mt_beacons"] = this.#mt_beacons;
    this.#mt_diff = abap.types.TableFactory.construct(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"new_num","type":"SORTED","isUnique":false,"keyFields":["NEW_NUM"]},{"name":"old_num","type":"SORTED","isUnique":false,"keyFields":["OLD_NUM"]}]}, "zif_abapgit_definitions=>ty_diffs_tt");
    this.FRIENDS_ACCESS_INSTANCE["mt_diff"] = this.#mt_diff;
    this.#ms_stats = new abap.types.Structure({
    "insert": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-INSERT"}),
    "delete": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-DELETE"}),
    "update": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-UPDATE"})}, "zif_abapgit_definitions=>ty_count", undefined, {}, {});
    this.FRIENDS_ACCESS_INSTANCE["ms_stats"] = this.#ms_stats;
    this.c_starting_beacon = zcl_abapgit_diff.c_starting_beacon;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async #calculate_stats() {
    let fs_ls_diff_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}));
    for await (const unique335 of abap.statements.loop(this.#mt_diff)) {
      fs_ls_diff_.assign(unique335);
      let unique336 = fs_ls_diff_.get().result;
      if (abap.compare.eq(unique336, abap.Classes['ZIF_ABAPGIT_DEFINITIONS'].zif_abapgit_definitions$c_diff.get().insert)) {
        this.#ms_stats.get().insert.set(abap.operators.add(this.#ms_stats.get().insert,abap.IntegerFactory.get(1)));
      } else if (abap.compare.eq(unique336, abap.Classes['ZIF_ABAPGIT_DEFINITIONS'].zif_abapgit_definitions$c_diff.get().delete)) {
        this.#ms_stats.get().delete.set(abap.operators.add(this.#ms_stats.get().delete,abap.IntegerFactory.get(1)));
      } else if (abap.compare.eq(unique336, abap.Classes['ZIF_ABAPGIT_DEFINITIONS'].zif_abapgit_definitions$c_diff.get().update)) {
        this.#ms_stats.get().update.set(abap.operators.add(this.#ms_stats.get().update,abap.IntegerFactory.get(1)));
      }
    }
  }
  async zif_abapgit_diff$create(INPUT) {
    let ri_diff = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_DIFF", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_DIFF"});
    let iv_new = INPUT?.iv_new;
    if (iv_new?.getQualifiedName === undefined || iv_new.getQualifiedName() !== "XSTRING") { iv_new = undefined; }
    if (iv_new === undefined) { iv_new = new abap.types.XString({qualifiedName: "XSTRING"}).set(INPUT.iv_new); }
    let iv_old = INPUT?.iv_old;
    if (iv_old?.getQualifiedName === undefined || iv_old.getQualifiedName() !== "XSTRING") { iv_old = undefined; }
    if (iv_old === undefined) { iv_old = new abap.types.XString({qualifiedName: "XSTRING"}).set(INPUT.iv_old); }
    let iv_ignore_indentation = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    if (INPUT && INPUT.iv_ignore_indentation) {iv_ignore_indentation.set(INPUT.iv_ignore_indentation);}
    if (INPUT === undefined || INPUT.iv_ignore_indentation === undefined) {iv_ignore_indentation = abap.builtin.abap_false;}
    let iv_ignore_comments = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    if (INPUT && INPUT.iv_ignore_comments) {iv_ignore_comments.set(INPUT.iv_ignore_comments);}
    if (INPUT === undefined || INPUT.iv_ignore_comments === undefined) {iv_ignore_comments = abap.builtin.abap_false;}
    let iv_ignore_case = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    if (INPUT && INPUT.iv_ignore_case) {iv_ignore_case.set(INPUT.iv_ignore_case);}
    if (INPUT === undefined || INPUT.iv_ignore_case === undefined) {iv_ignore_case = abap.builtin.abap_false;}
    if (abap.compare.eq((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_function_module()).get().zif_abapgit_function_module$function_exists({iv_function_module_name: abap.CharacterFactory.get(20, 'RS_CMP_COMPUTE_DELTA')})), abap.builtin.abap_true)) {
      this.#mt_diff.set((await abap.Classes['ZCL_ABAPGIT_DIFF_STD'].compute({iv_new: iv_new, iv_old: iv_old, iv_ignore_indentation: iv_ignore_indentation, iv_ignore_comments: iv_ignore_comments, iv_ignore_case: iv_ignore_case})));
    } else {
      this.#mt_diff.set((await abap.Classes['ZCL_ABAPGIT_DIFF_DIFF3'].compute({iv_new: iv_new, iv_old: iv_old})));
    }
    await this.#calculate_stats();
    await this.#map_beacons();
    await this.#shortlist();
    ri_diff.set(this.me);
    return ri_diff;
  }
  async #create_regex_set() {
    let rt_regex_set = abap.types.TableFactory.construct(new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":["TABLE_LINE"]},"secondary":[]}, "zcl_abapgit_diff=>ty_regexset_tt");
    let lo_regex = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"});
    let lt_regex = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_definitions=>ty_string_tt");
    let lv_regex = new abap.types.String({qualifiedName: "STRING"});
    abap.statements.append({source: abap.CharacterFactory.get(62, '^\\s*(CLASS|FORM|MODULE|REPORT|METHOD|INTERFACE|FUNCTION)\\s[^=]'), target: lt_regex});
    abap.statements.append({source: abap.CharacterFactory.get(46, '^\\s*(PUBLIC|PROTECTED|PRIVATE)\\sSECTION(\\s|\\.)'), target: lt_regex});
    abap.statements.append({source: abap.CharacterFactory.get(42, '^\\s*(CLASS|INTERFACE|FUNCTION|TYPE)-POOL\\s'), target: lt_regex});
    abap.statements.append({source: abap.CharacterFactory.get(35, '^\\s*(START|END)-OF-SELECTION(\\s|\\.)'), target: lt_regex});
    abap.statements.append({source: abap.CharacterFactory.get(25, '^\\s*INITIALIZATION(\\s|\\.)'), target: lt_regex});
    abap.statements.append({source: abap.CharacterFactory.get(36, '^\\s*(TOP-OF-PAGE|END-OF-PAGE)(\\s|\\.)'), target: lt_regex});
    abap.statements.append({source: abap.CharacterFactory.get(68, '^\\s*AT\\s*(SELECTION-SCREEN|LINE-SELECTION|USER-COMMAND|PF\\d+)(\\s|\\.)'), target: lt_regex});
    abap.statements.append({source: abap.CharacterFactory.get(26, '^\\s*(DEFINE|ENHANCEMENT)\\s'), target: lt_regex});
    for await (const unique337 of abap.statements.loop(lt_regex)) {
      lv_regex.set(unique337);
      lo_regex.set(await (new abap.Classes['CL_ABAP_REGEX']()).constructor_({pattern: lv_regex, ignore_case: abap.builtin.abap_true}));
      abap.statements.append({source: lo_regex, target: rt_regex_set});
    }
    return rt_regex_set;
  }
  async zif_abapgit_diff$get() {
    let rt_diff = abap.types.TableFactory.construct(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"new_num","type":"SORTED","isUnique":false,"keyFields":["NEW_NUM"]},{"name":"old_num","type":"SORTED","isUnique":false,"keyFields":["OLD_NUM"]}]}, "zif_abapgit_definitions=>ty_diffs_tt");
    rt_diff.set(this.#mt_diff);
    return rt_diff;
  }
  async zif_abapgit_diff$get_beacons() {
    let rt_beacons = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_definitions=>ty_string_tt");
    rt_beacons.set(this.#mt_beacons);
    return rt_beacons;
  }
  async zif_abapgit_diff$is_line_patched(INPUT) {
    let rv_patched = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    let iv_index = INPUT?.iv_index;
    if (iv_index?.getQualifiedName === undefined || iv_index.getQualifiedName() !== "I") { iv_index = undefined; }
    if (iv_index === undefined) { iv_index = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.iv_index); }
    let fs_ls_diff_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}));
    abap.statements.readTable(this.#mt_diff,{index: iv_index,
      assigning: fs_ls_diff_});
    if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      rv_patched.set(fs_ls_diff_.get().patch_flag);
    } else {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Diff line not found ${abap.templateFormatting(iv_index)}`)});
    }
    return rv_patched;
  }
  async #map_beacons() {
    let lv_beacon_idx = new abap.types.Integer({qualifiedName: "I"});
    lv_beacon_idx.set(zcl_abapgit_diff.c_starting_beacon);
    let lv_offs = new abap.types.Integer({qualifiedName: "I"});
    let lv_beacon_str = new abap.types.String({qualifiedName: "STRING"});
    let lv_beacon_2lev = new abap.types.String({qualifiedName: "STRING"});
    let lv_submatch = new abap.types.String({qualifiedName: "STRING"});
    let lo_regex = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"});
    let lt_regex = abap.types.TableFactory.construct(new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":["TABLE_LINE"]},"secondary":[]}, "zcl_abapgit_diff=>ty_regexset_tt");
    let fs_ls_diff_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}));
    lt_regex.set((await this.#create_regex_set()));
    for await (const unique338 of abap.statements.loop(this.#mt_diff)) {
      fs_ls_diff_.assign(unique338);
      lv_offs.clear();
      fs_ls_diff_.get().beacon.set(lv_beacon_idx);
      for await (const unique339 of abap.statements.loop(lt_regex)) {
        lo_regex.set(unique339);
        abap.statements.find(fs_ls_diff_.get().new, {regex: lo_regex, first: true, submatches: [lv_submatch]});
        if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
          lv_beacon_str.set(fs_ls_diff_.get().new);
          lv_submatch.set(abap.builtin.to_upper({val: lv_submatch}));
          abap.statements.find(lv_beacon_str, {find: abap.CharacterFactory.get(1, '.'), first: true, offset: lv_offs});
          if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
            abap.statements.find(lv_beacon_str, {find: abap.CharacterFactory.get(1, '"'), first: true, offset: lv_offs});
          }
          if (abap.compare.gt(lv_offs, abap.IntegerFactory.get(0))) {
            lv_beacon_str.set(lv_beacon_str.getOffset({length: lv_offs}));
          }
          lv_beacon_str.set(abap.builtin.condense({val: lv_beacon_str, del: new abap.types.String().set(` `)}));
          if (abap.compare.eq(lv_submatch, abap.CharacterFactory.get(5, 'CLASS'))) {
            lv_beacon_2lev.set(abap.builtin.replace({val: lv_beacon_str, regex: abap.CharacterFactory.get(30, '\\s+(DEFINITION|IMPLEMENTATION)'), with: abap.CharacterFactory.get(1, ''), occ: abap.IntegerFactory.get(0)}));
          } else if (abap.compare.eq(lv_submatch, abap.CharacterFactory.get(6, 'METHOD'))) {
            lv_beacon_str.set(abap.operators.concat(lv_beacon_2lev,abap.operators.concat(new abap.types.String().set(` => `),lv_beacon_str)));
          } else if (abap.compare.eq(lv_submatch, abap.CharacterFactory.get(6, 'PUBLIC')) || abap.compare.eq(lv_submatch, abap.CharacterFactory.get(9, 'PROTECTED')) || abap.compare.eq(lv_submatch, abap.CharacterFactory.get(7, 'PRIVATE'))) {
            lv_beacon_str.set(abap.operators.concat(lv_beacon_2lev,abap.operators.concat(new abap.types.String().set(` `),lv_beacon_str)));
          }
          abap.statements.append({source: lv_beacon_str, target: this.#mt_beacons});
          lv_beacon_idx.set(abap.builtin.sy.get().tabix);
          fs_ls_diff_.get().beacon.set(lv_beacon_idx);
          break;
        }
      }
    }
  }
  async zif_abapgit_diff$set_patch_by_old_diff(INPUT) {
    let is_diff_old = INPUT?.is_diff_old;
    if (is_diff_old?.getQualifiedName === undefined || is_diff_old.getQualifiedName() !== "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF") { is_diff_old = undefined; }
    if (is_diff_old === undefined) { is_diff_old = new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}).set(INPUT.is_diff_old); }
    let iv_patch_flag = INPUT?.iv_patch_flag;
    if (iv_patch_flag?.getQualifiedName === undefined || iv_patch_flag.getQualifiedName() !== "ABAP_BOOL") { iv_patch_flag = undefined; }
    if (iv_patch_flag === undefined) { iv_patch_flag = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}).set(INPUT.iv_patch_flag); }
    let fs_ls_diff_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}));
    for await (const unique340 of abap.statements.loop(this.#mt_diff,{usingKey: "new_num",where: async (I) => {return abap.compare.eq(I.old, is_diff_old.get().old) && abap.compare.eq(I.new, is_diff_old.get().new) && abap.compare.eq(I.new_num, is_diff_old.get().new_num) && abap.compare.eq(I.old_num, is_diff_old.get().old_num);},topEquals: {"old": is_diff_old.get().old,"new": is_diff_old.get().new,"new_num": is_diff_old.get().new_num,"old_num": is_diff_old.get().old_num}})) {
      fs_ls_diff_.assign(unique340);
      fs_ls_diff_.get().patch_flag.set(iv_patch_flag);
      break;
    }
  }
  async zif_abapgit_diff$set_patch_new(INPUT) {
    let iv_line_new = INPUT?.iv_line_new;
    if (iv_line_new?.getQualifiedName === undefined || iv_line_new.getQualifiedName() !== "I") { iv_line_new = undefined; }
    if (iv_line_new === undefined) { iv_line_new = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.iv_line_new); }
    let iv_patch_flag = INPUT?.iv_patch_flag;
    if (iv_patch_flag?.getQualifiedName === undefined || iv_patch_flag.getQualifiedName() !== "ABAP_BOOL") { iv_patch_flag = undefined; }
    if (iv_patch_flag === undefined) { iv_patch_flag = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}).set(INPUT.iv_patch_flag); }
    let fs_ls_diff_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}));
    abap.statements.readTable(this.#mt_diff,{keyName: "new_num",
      withTableKey: true,
      assigning: fs_ls_diff_,
      withKey: (i) => {return abap.compare.eq(i.new_num, iv_line_new);},
      withKeyValue: [{key: (i) => {return i.new_num}, value: iv_line_new}],
      usesTableLine: false,
      withKeySimple: {"new_num": iv_line_new}});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Invalid new line number ${abap.templateFormatting(iv_line_new)}`)});
    }
    fs_ls_diff_.get().patch_flag.set(iv_patch_flag);
  }
  async zif_abapgit_diff$set_patch_old(INPUT) {
    let iv_line_old = INPUT?.iv_line_old;
    if (iv_line_old?.getQualifiedName === undefined || iv_line_old.getQualifiedName() !== "I") { iv_line_old = undefined; }
    if (iv_line_old === undefined) { iv_line_old = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.iv_line_old); }
    let iv_patch_flag = INPUT?.iv_patch_flag;
    if (iv_patch_flag?.getQualifiedName === undefined || iv_patch_flag.getQualifiedName() !== "ABAP_BOOL") { iv_patch_flag = undefined; }
    if (iv_patch_flag === undefined) { iv_patch_flag = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}).set(INPUT.iv_patch_flag); }
    let fs_ls_diff_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}));
    abap.statements.readTable(this.#mt_diff,{keyName: "old_num",
      withTableKey: true,
      assigning: fs_ls_diff_,
      withKey: (i) => {return abap.compare.eq(i.old_num, iv_line_old);},
      withKeyValue: [{key: (i) => {return i.old_num}, value: iv_line_old}],
      usesTableLine: false,
      withKeySimple: {"old_num": iv_line_old}});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Invalid old line number ${abap.templateFormatting(iv_line_old)}`)});
    }
    fs_ls_diff_.get().patch_flag.set(iv_patch_flag);
  }
  async #shortlist() {
    let lv_index = new abap.types.Integer({qualifiedName: "I"});
    let fs_ls_diff_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "patch_flag": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "new_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-new_num"}),
    "new": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-NEW"}),
    "result": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-result"}),
    "old_num": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_definitions=>ty_diff-old_num"}),
    "old": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-OLD"}),
    "short": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "beacon": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_DIFF-BEACON"})}, "zif_abapgit_definitions=>ty_diff", undefined, {}, {}));
    if (abap.compare.lt(abap.builtin.lines({val: this.#mt_diff}), abap.IntegerFactory.get(20))) {
      for await (const unique341 of abap.statements.loop(this.#mt_diff)) {
        fs_ls_diff_.assign(unique341);
        fs_ls_diff_.get().short.set(abap.builtin.abap_true);
      }
    } else {
      for await (const unique342 of abap.statements.loop(this.#mt_diff,{where: async (I) => {return abap.compare.initial(I.result) === false && abap.compare.eq(I.short, abap.builtin.abap_false);},topEquals: {"short": abap.builtin.abap_false}})) {
        
        lv_index.set(abap.builtin.sy.get().tabix);
        const indexBackup1 = abap.builtin.sy.get().index.get();
        const unique343 = abap.IntegerFactory.get(8).get();
        for (let unique344 = 0; unique344 < unique343; unique344++) {
          abap.builtin.sy.get().index.set(unique344 + 1);
          abap.statements.readTable(this.#mt_diff,{index: abap.operators.minus(lv_index,abap.builtin.sy.get().index),
            assigning: fs_ls_diff_});
          if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0)) || abap.compare.eq(fs_ls_diff_.get().short, abap.builtin.abap_true)) {
            break;
          }
          fs_ls_diff_.get().short.set(abap.builtin.abap_true);
        }
        abap.builtin.sy.get().index.set(indexBackup1);
        const indexBackup2 = abap.builtin.sy.get().index.get();
        const unique345 = abap.IntegerFactory.get(8).get();
        for (let unique346 = 0; unique346 < unique345; unique346++) {
          abap.builtin.sy.get().index.set(unique346 + 1);
          abap.statements.readTable(this.#mt_diff,{index: abap.operators.minus(abap.operators.add(lv_index,abap.builtin.sy.get().index),abap.IntegerFactory.get(1)),
            assigning: fs_ls_diff_});
          if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
            break;
          }
          if (!(abap.compare.eq(fs_ls_diff_.get().short, abap.builtin.abap_false))) {
            continue;
          }
          fs_ls_diff_.get().short.set(abap.builtin.abap_true);
        }
        abap.builtin.sy.get().index.set(indexBackup2);
      }
    }
  }
  async zif_abapgit_diff$stats() {
    let rs_count = new abap.types.Structure({
    "insert": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-INSERT"}),
    "delete": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-DELETE"}),
    "update": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_COUNT-UPDATE"})}, "zif_abapgit_definitions=>ty_count", undefined, {}, {});
    rs_count.set(this.#ms_stats);
    return rs_count;
  }
}
abap.Classes['ZCL_ABAPGIT_DIFF'] = zcl_abapgit_diff;
zcl_abapgit_diff.c_starting_beacon = new abap.types.Integer({qualifiedName: "I"});
zcl_abapgit_diff.c_starting_beacon.set(1);
zcl_abapgit_diff.ty_regexset_tt = abap.types.TableFactory.construct(new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":["TABLE_LINE"]},"secondary":[]}, "zcl_abapgit_diff=>ty_regexset_tt");
export {zcl_abapgit_diff};