gitnexus 1.6.13-rc.50 → 1.6.13-rc.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { CaptureMatch } from '../../../../_shared/index.js';
|
|
13
13
|
import { type SyntaxNode } from '../../utils/ast-helpers.js';
|
|
14
|
+
/** Static-like descriptors do not inject an instance on attribute access. */
|
|
15
|
+
export declare function isPythonStaticLikeMethod(fnNode: SyntaxNode): boolean;
|
|
14
16
|
export interface PythonBoundReceiver {
|
|
15
17
|
readonly kind: 'instance' | 'class';
|
|
16
18
|
readonly parameter: SyntaxNode;
|
|
@@ -44,6 +44,10 @@ function hasDecorator(fnNode, decoratorName) {
|
|
|
44
44
|
}
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
|
+
/** Static-like descriptors do not inject an instance on attribute access. */
|
|
48
|
+
export function isPythonStaticLikeMethod(fnNode) {
|
|
49
|
+
return (fnNode.childForFieldName('name')?.text === '__new__' || hasDecorator(fnNode, 'staticmethod'));
|
|
50
|
+
}
|
|
47
51
|
function firstBoundReceiverParameter(parameters) {
|
|
48
52
|
for (let i = 0; i < parameters.namedChildCount; i++) {
|
|
49
53
|
const child = parameters.namedChild(i);
|
|
@@ -82,14 +86,12 @@ function firstParameterName(param) {
|
|
|
82
86
|
*/
|
|
83
87
|
export function classifyPythonBoundReceiver(fnNode) {
|
|
84
88
|
const enclosingClass = findEnclosingClassDefinition(fnNode);
|
|
85
|
-
if (enclosingClass === null ||
|
|
89
|
+
if (enclosingClass === null || isPythonStaticLikeMethod(fnNode))
|
|
86
90
|
return null;
|
|
87
91
|
const functionName = fnNode.childForFieldName('name')?.text;
|
|
88
92
|
// Python applies these descriptor kinds implicitly even without decorators.
|
|
89
93
|
// __new__ is static-like (its class argument is explicit), while
|
|
90
94
|
// __init_subclass__ and __class_getitem__ receive the class implicitly.
|
|
91
|
-
if (functionName === '__new__')
|
|
92
|
-
return null;
|
|
93
95
|
const params = fnNode.childForFieldName('parameters');
|
|
94
96
|
if (params === null)
|
|
95
97
|
return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { definitionIdPosition } from '../../scope-resolution/utils/definition-id.js';
|
|
2
|
-
import { classifyPythonBoundReceiver } from './receiver-binding.js';
|
|
2
|
+
import { classifyPythonBoundReceiver, isPythonStaticLikeMethod } from './receiver-binding.js';
|
|
3
3
|
const simplePositionalCallsByFile = new Map();
|
|
4
4
|
const positionalCapacitiesByFile = new Map();
|
|
5
5
|
const positionKey = (line, column) => `${line}:${column}`;
|
|
@@ -47,6 +47,10 @@ function positionalCapacity(fnNode) {
|
|
|
47
47
|
if (parameters === null)
|
|
48
48
|
return undefined;
|
|
49
49
|
const receiver = classifyPythonBoundReceiver(fnNode)?.parameter;
|
|
50
|
+
// Plain class functions still receive the instance even with no declared
|
|
51
|
+
// receiver slot. Without that slot, a zero-argument call is not proven safe.
|
|
52
|
+
if (receiver === undefined && !isPythonStaticLikeMethod(fnNode))
|
|
53
|
+
return undefined;
|
|
50
54
|
let capacity = 0;
|
|
51
55
|
let keywordOnly = false;
|
|
52
56
|
for (const parameter of parameters.namedChildren) {
|
|
@@ -798,7 +798,9 @@ import { copyV8CacheIfPresent, tryLoadV8Cache, writeV8CacheFile } from './v8-sid
|
|
|
798
798
|
// v118 (#3398): decorated Python methods with unproven decorator identity no
|
|
799
799
|
// longer publish subtype positional capacity. Warm v117 side-channel snapshots
|
|
800
800
|
// would retain that capacity and could emit a false concrete call target.
|
|
801
|
-
|
|
801
|
+
// v119 (#3396): Python subtype method capacities now omit receiverless ordinary
|
|
802
|
+
// methods. Warm v118 ParsedFiles would replay a false compatible target.
|
|
803
|
+
const SCHEMA_BUMP = 119;
|
|
802
804
|
const GITNEXUS_PKG_VERSION = (() => {
|
|
803
805
|
try {
|
|
804
806
|
// package.json sits at gitnexus/package.json — two levels up from
|
package/package.json
CHANGED