mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-23 22:06:04 +00:00
fix(r): strip backticks from R6 class name when typing $new() receivers
The R grammar yields an identifier whose text keeps its backticks, so `Foo`$new() produced calleeName "`Foo`" while the class-name set holds the bare name. Apply rBareName, as declaredClassName already does. Found in bot review round 5 (PR #3513, comment 4348423277).
This commit is contained in:
parent
5eea3c7196
commit
5cee573baf
2 changed files with 8 additions and 1 deletions
|
|
@ -273,7 +273,7 @@ const scanConstructorBinding: ConstructorBindingScanner = (node) => {
|
|||
const className = children[0];
|
||||
const method = children[1];
|
||||
if (className?.type === 'identifier' && method?.text === 'new') {
|
||||
return { varName: lhs.text, calleeName: className.text };
|
||||
return { varName: lhs.text, calleeName: rBareName(className.text) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,6 +185,13 @@ describe('R type environment: only an assignment binds a type', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('scans a backticked R6 class name as the bare class name', () => {
|
||||
expect(constructorBinding('obj <- `Foo`$new()')).toEqual({
|
||||
varName: 'obj',
|
||||
calleeName: 'Foo',
|
||||
});
|
||||
});
|
||||
|
||||
it.each(['+', '==', '->'])('scans nothing for `obj %s Foo$new()`', (op) => {
|
||||
expect(constructorBinding(`obj ${op} Foo$new()`)).toBeUndefined();
|
||||
expect(constructorBinding(`obj ${op} new("Foo")`)).toBeUndefined();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue