Skip to content

Commit

Permalink
Fix for removing ending bracket from name
Browse files Browse the repository at this point in the history
Signed-off-by: worksofliam <[email protected]>
  • Loading branch information
worksofliam committed Feb 5, 2024
1 parent a044491 commit f9ac3c8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions language/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,11 @@ export default class Parser {
result.name = result.name.substring(0, openBracket);
}

// End bracket for sub-statements
if (result.name.endsWith(`)`)) {
result.name = result.name.substring(0, result.name.length - 1);
}

return result;
}

Expand Down
24 changes: 24 additions & 0 deletions tests/suite/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,30 @@ exports.exec_10 = async () => {
assert.strictEqual(cache.sqlReferences[1].description, ``);
}

exports.exec_11 = async () => {
const lines = [
`**FREE`,
``,
`// sql statement causing the the bug, when you find the reference you are also bringing in the ) at the end.`,
` Exec Sql Update PrdBlock`,
` Set cgday = :leastUtilDay,`,
` cgcnstdpt = :pd$dept,`,
` cgcnstjob = :pd$jobc`,
` Where cgblock in (Select b2addid`,
` from prdblk2add) and`,
` cgday = 0;`,
``,
`return;`,
].join(`\n`);

const parser = parserSetup();
const cache = await parser.getDocs(uri, lines, {withIncludes: true, ignoreCache: true});

assert.strictEqual(cache.sqlReferences.length, 2);
assert.strictEqual(cache.sqlReferences[0].name, `PrdBlock`);
assert.strictEqual(cache.sqlReferences[1].name, `prdblk2add`);
}

exports.enum_1 = async () => {
const lines = [
`**free`,
Expand Down

0 comments on commit f9ac3c8

Please sign in to comment.