Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/src/language/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,10 @@ export default class Linter {
const definedProcedure = globalProcs.find(proc => proc.name.toUpperCase() === upperName);
if (definedProcedure) {
let requiresBlock = false;
if (statement.length <= i + 1) {
// Don't require parms for procedures found in Ctl-Opt
if (statement[0].value.toUpperCase() === `CTL-OPT`) {
// do nothing
} else if (statement.length <= i + 1) {
requiresBlock = true;
} else if (statement[i + 1].type !== `openbracket`) {
requiresBlock = true;
Expand Down
18 changes: 18 additions & 0 deletions tests/suite/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,24 @@ exports.linter8 = async () => {
}, `Error not as expected`);
};

exports.linter_Do_Not_Require_Parameters_For_Control_Options = async () => {
const lines = [
`**FREE`,
`ctl-opt main(main) ;`,
`dcl-proc main ;`,
` return ;`,
`end-proc main ;`,
].join(`\n`);

const parser = parserSetup();
const cache = await parser.getDocs(uri, lines);
const { errors } = Linter.getErrors({ uri, content: lines }, {
RequiresParameter: true
}, cache);

assert.strictEqual(errors.length, 0, `Unexpected RequiresParamters error`);
};

/**
* Check that local variables are not in global scope
*/
Expand Down