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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### New Features

- VBA calls and property reads now reach the right class through more kinds of receivers: a `Public` variable of a standard module used from any other file, an `Object` variable `Set` from a factory function in another module, `Me.Field.Member`, and chains such as `a.Hijo.IDCalc` typed through a `Property Get` or public field, `With` blocks included; a receiver whose type cannot be deduced still links nothing (#345).

### Fixes

- VBA calls and property reads/writes now link even when their case differs from the declaration, such as `a.idcalc` for `IDCalc`, or a call on a variable declared `As EXPEDIENTE` reaching the class `Expediente`; an ambiguous match is still left unlinked. (#346)
Expand Down
9 changes: 6 additions & 3 deletions __tests__/extraction-vba-member-access.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,18 @@ describe('VBA member access edges (#334)', () => {
const cg = await buildProject(FILES);
const hijoGet = fn(cg, 'Anexo.Hijo', 'get');
expect(callerNames(cg, hijoGet)).toContain('Encadenado');
// `a.Hijo.IDCalc` reads Otra.IDCalc through an untyped intermediate:
// it must not be linked to Anexo.IDCalc.
// `a.Hijo.IDCalc` reads Otra.IDCalc (issue #345 types the hop through
// `Property Get Hijo() As Otra`): it must not be linked to Anexo.IDCalc.
expect(callerNames(cg, fn(cg, 'Otra.IDCalc'))).toContain('Encadenado');
expect(callerNames(cg, fn(cg, 'Anexo.IDCalc'))).not.toContain('Encadenado');
});

it('G2: member calls resolve to the receiver class, never to another class sharing the name', async () => {
const cg = await buildProject(FILES);
expect(callerNames(cg, fn(cg, 'Anexo.Registrar'))).toEqual(['ConWith', 'WithAnidado']);
expect(callerNames(cg, fn(cg, 'Otra.Registrar'))).toEqual(['LlamaOtra']);
// Issue #345: `.Registrar` inside `With .Hijo` (in `With a`) is Otra's,
// typed through `Property Get Hijo() As Otra`.
expect(callerNames(cg, fn(cg, 'Otra.Registrar'))).toEqual(['LlamaOtra', 'WithAnidado']);
});

it('G2: an untyped receiver is never joined to a class by name; it stays a failed unresolved reference', async () => {
Expand Down
Loading