diff --git a/src/language/linter.js b/src/language/linter.js index d3ad5ea4..2e0e0ee6 100644 --- a/src/language/linter.js +++ b/src/language/linter.js @@ -894,12 +894,9 @@ module.exports = class Linter { if ([ `IF`, `ELSE`, `ELSEIF`, `FOR`, `FOR-EACH`, `DOW`, `DOU`, `MONITOR`, `ON-ERROR`, `ON-EXIT`, `BEGSR`, `SELECT`, `WHEN`, `OTHER`, `DCL-PROC`, `DCL-PI`, `DCL-PR`, `DCL-DS` ].includes(opcode)) { - if (opcode === `DCL-DS` && oneLineTriggers[opcode].some(trigger => upperLine.includes(trigger))) { - //No change + if ([`DCL-DS`, `DCL-PI`, `DCL-PR`].includes(opcode) && oneLineTriggers[opcode].some(trigger => upperLine.includes(trigger))) { + //No change } - else if (opcode === `DCL-PI` && oneLineTriggers[opcode].some(trigger => upperLine.includes(trigger))) { - //No change - } else if (opcode === `SELECT`) { if (skipIndentCheck === false) expectedIndent += (indent*2); } diff --git a/src/language/models/oneLineTriggers.js b/src/language/models/oneLineTriggers.js index 20d96915..5ab91bb3 100644 --- a/src/language/models/oneLineTriggers.js +++ b/src/language/models/oneLineTriggers.js @@ -1,4 +1,5 @@ module.exports = { 'DCL-DS': [`LIKEDS`, `LIKEREC`, `END-DS`], 'DCL-PI': [`END-PI`], + 'DCL-PR': [`OVERLOAD`] } \ No newline at end of file diff --git a/src/language/parser.js b/src/language/parser.js index 3adda00d..11f06865 100644 --- a/src/language/parser.js +++ b/src/language/parser.js @@ -537,6 +537,12 @@ module.exports = class Parser { currentItem.readParms = true; + // Does the keywords include a keyword that makes end-ds useless? + if (currentItem.keywords.some(keyword => oneLineTriggers[`DCL-PR`].some(trigger => keyword.startsWith(trigger)))) { + scope.procedures.push(currentItem); + resetDefinition = true; + } + currentDescription = []; } } diff --git a/tests/suite/index.js b/tests/suite/index.js index 60b23c65..5e6c351a 100644 --- a/tests/suite/index.js +++ b/tests/suite/index.js @@ -2520,5 +2520,43 @@ module.exports = { }, newValue: undefined, }); + }, + + overload1: async () => { + const lines = [ + `**FREE`, + ``, + `Dcl-PR json_setBool pointer extproc(*CWIDEN : 'jx_SetBoolByName');`, + ` node pointer value;`, + ` nodePath pointer value options(*string);`, + ` value ind value;`, + `End-PR;`, + ``, + `Dcl-PR json_setNum pointer extproc(*CWIDEN : 'jx_SetDecByName');`, + ` node pointer value;`, + ` nodePath pointer value options(*string);`, + ` value packed(30:15) value;`, + `End-PR;`, + ``, + `Dcl-PR json_set pointer overload ( `, + ` json_setBool: `, + ` json_setNum `, + `);`, + ``, + `Dcl-PR json_nodeType int(5) extproc(*CWIDEN : 'jx_GetNodeType');`, + ` node pointer value;`, + `End-PR;`, + ].join(`\n`); + + const parser = new Parser(); + const cache = await parser.getDocs(URI, lines); + + const { indentErrors } = Linter.getErrors(lines, { + indent: 2, + PrettyComments: true + }, cache); + + assert.strictEqual(cache.procedures.length, 4); + assert.strictEqual(indentErrors.length, 0); } } \ No newline at end of file