Remove unused method AsmParser.labelFindFor (#8022)

`AsmParser.labelFindFor` was only called in tests.
This commit is contained in:
narpfel
2025-08-12 15:50:53 +02:00
committed by GitHub
parent f289b79f1d
commit 68db4ca482
5 changed files with 1 additions and 35 deletions

View File

@@ -50,17 +50,7 @@ function processAsmWithParser<T extends AsmParser>(
}
describe('AsmParser subclass compatibility', () => {
describe('labelFindFor method behavior', () => {
it('should use VcAsmParser labelFindFor override to find specific VC labels', () => {
const asmLines = ['_start:', 'mov eax, OFFSET _data', 'call _function', 'jmp _start'];
const usedLabels = initializeParserAndFindLabels(VcAsmParser, [], asmLines);
// VC-specific label detection should find these labels
expect(usedLabels.has('_data')).toBe(true);
expect(usedLabels.has('_function')).toBe(true);
expect(usedLabels.has('_start')).toBe(true);
});
describe('findUsedLabels method behavior', () => {
it('should show EWAVR label finding now works correctly after refactoring', () => {
const asmLines = [
'_data: .word 0x1234',
@@ -78,10 +68,6 @@ describe('AsmParser subclass compatibility', () => {
expect(usedLabels.has('_main')).toBe(true);
expect(usedLabels.has('HIGH')).toBe(true);
expect(usedLabels.has('LOW')).toBe(true);
// Verify that specific expected labels are found rather than checking exact count
// The refactoring fixed the issue where EWAVR's labelFindFor returned definition regex
// Now it uses the base class identifierFindRe for finding label references
});
it('should show base class finds all identifier-like tokens as potential labels', () => {
@@ -96,9 +82,6 @@ describe('AsmParser subclass compatibility', () => {
expect(usedLabels.has('value')).toBe(true); // Actual label reference
expect(usedLabels.has('jmp')).toBe(true); // Instruction (not a label)
expect(usedLabels.has('_start')).toBe(true); // Actual label reference
// This over-matching is why subclasses override labelFindFor
// to be more specific about what constitutes a label in their syntax
});
});

View File

@@ -163,11 +163,6 @@ describe('AsmEWAVRParser', () => {
expect(usedLabels.has('HIGH')).toBe(true); // Ensure HIGH is included
expect(usedLabels.has('LOW')).toBe(true); // Ensure LOW is included
// Verify we found the expected labels rather than checking exact count
// The labelFindFor regex is still for definitions (with colons)
const labelFindRegex = parser.labelFindFor();
expect(labelFindRegex.test('_data:')).toBe(true); // Matches definitions
expect(labelFindRegex.test('_data')).toBe(false); // Doesn't match usage
});
it('should handle EWAVR segment syntax and register operations', () => {