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: 2 additions & 3 deletions language/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ export default class Parser {
lineIsFree = false;
lineNumber += 1;

if (baseLine.startsWith(`**`)) {
if (baseLine.startsWith(`**`) && baseLine[2] !== `*`) {
// Usually is **FREE
if (lineNumber === 0) continue;
// After compile time data, we're done
Expand Down Expand Up @@ -1484,8 +1484,7 @@ export default class Parser {
}

switch (cSpec.opcode && cSpec.opcode.value) {
case `BEGSR`:

case `BEGSR`:
if (cSpec.factor1 && !scope.find(cSpec.factor1.value, `subroutine`)) {
currentItem = new Declaration(`subroutine`);
currentItem.name = cSpec.factor1.value;
Expand Down
25 changes: 25 additions & 0 deletions tests/suite/fixed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1425,4 +1425,29 @@ test('incorrect range on prototypes and procedures (#412)', async () => {
expect(prRange.start).to.deep.equal(prRange.end-1);
expect(procRange.start).toBeGreaterThan(prRange.end);
expect(procRange.end).toBeGreaterThan(procRange.start);
});

test('missing subroutines #443', async () => {
const lines = [
` C PROCRC BEGSR`,
` C*`,
` C ENDSR`,
` C**************************`,
` C ADDSUB BEGSR`,
` C MOVE #4XDSP XHXDSP O/G LINE`,
`******* USE CLASS CODE FROM OVERRIDDEN CLASS!`,
` C LDACL IFEQ 'B'`,
` C ENDIF`,
` C*`,
` C ENDSR`,
].join(`\n`);

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

expect(cache).toBeDefined();

const subroutines = cache.subroutines;
expect(subroutines.length).toBe(2);
expect(subroutines[0].name).toBe('PROCRC');
expect(subroutines[1].name).toBe('ADDSUB');
});