mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-26 06:02:22 +00:00
Merge branch 'main' into fix/explain-interproc-display-lines
This commit is contained in:
commit
feb6961cea
30 changed files with 175245 additions and 164266 deletions
|
|
@ -161,7 +161,7 @@
|
|||
"_rebaselined_3354_callable_alternatives": "#3354 callable alternatives: a callable chosen by a value-selecting source now flows every branch it can yield (`a ?? b`, `a || b`, `a or b`, `c ? a : b`, statement `if`, elvis), and an operator branch (`x == f || g`) stays opaque instead of seeding a qualified name. Verified by running the BASE (merge-base 233ca2849) and HEAD emitters over the SAME HEAD fixture corpus: every added or removed match is an `@callable-flow.*` match on one of those sources, and the pre-existing corpus is byte-identical (all other languages: zero delta). The rest of the drift is corpus growth from this PR's regression fixture, which this bench globs. Corpus growth: swift-callable-alternatives/App.swift (+1 file, +36 groups). Emitter delta: +6 / -3: `??` and ternary seeds and copies now name each operand; the 3 removed matches are the whole-expression seeds and copy that carried a `target-qualified-name` / `source-qualified-name` of the compound source. capture_groups_fp 1297 -> 1333, fixture_count 67 -> 68; synthetic counts unchanged; scaling 1.057 < 1.5. Prior decf74c01af0c7f403e203b19c2bd92dbf95b4562f6da2b0ac5117ef872204da -> c9fc553662f0db18027fba882e3ff730744f6153cc46eca7b00667fabd6a0df8."
|
||||
},
|
||||
"dart": {
|
||||
"fingerprint": "557bdc505af40590b21e53298584f14227b7d79220806425f8e7da25d78f9712",
|
||||
"fingerprint": "4690403d2be0d270e28a55791df82eaa627d26d28c52d81bfafa59761badcaf3",
|
||||
"scaling_budget": 1.5,
|
||||
"_rebaselined_2963_package_imports": "#3369 package-import fixtures: dart-package-imports adds six .dart files. CORPUS GROWTH ONLY, NOT A CAPTURE CHANGE: parking that directory restores 795290a9524ee0dc38af635536e9744c401ec13828ec77822d39e59e1cd6e649 byte-for-byte. The six files contribute 33 capture groups (862 -> 895) and fixture_count 37 -> 43. Synthetic scale counts stay 5011/16011. Local scaling 1.091 < 1.5. Prior 795290a9524ee0dc38af635536e9744c401ec13828ec77822d39e59e1cd6e649 -> f4edcfedb6e97def5ffbb9d3227fce2549e5c6c6cc876a05bc3b68a46ed30c24.",
|
||||
"_rebaselined_generic_instantiation_2912": "#2912: the Dart heritage marker carries a fourth field \u2014 the type arguments the clause was written with (`implements Validator<String>`) \u2014 so interface dispatch can prune implementors of a mismatched instantiation. Additive marker text on existing heritage matches rather than a new match, so this is digest drift only; a marker from a pre-#2912 cache simply has no fourth field and reads as unknown. Prior ba93c90dcd341259e8e088816bc8c76ad27882419f665e35c056dc22fa54cf73 -> 3a8ddabbeb1cba47a4757451d4f79d726ca230fd15e860772b11526fbb1c6687; scaling 1.027 < 1.5.",
|
||||
|
|
@ -172,7 +172,8 @@
|
|||
"_added": "#939: dart added to the scope-capture bench with the registry-primary migration. Heritage-bearing scale source (Entity extends Base implements Marker) gates the @reference.inherits synth + the postfix-chain reference walk at scale. emitDartScopeCaptures threads tree-sitter captured nodes (no findNodeAtRange root-walk), so it is linear (~1.0).",
|
||||
"_rebaselined": "#1919 review CF3 fix: extended kotlin-local-property-owner (init/accessor destructuring) + new dart-accessor-owner fixture (getter/setter ownership). Fingerprint-only corpus drift; scaling ~1.0.",
|
||||
"_rebaselined_3354_callable_alternatives": "#3354 callable alternatives: a callable chosen by a value-selecting source now flows every branch it can yield (`a ?? b`, `a || b`, `a or b`, `c ? a : b`, statement `if`, elvis), and an operator branch (`x == f || g`) stays opaque instead of seeding a qualified name. Verified by running the BASE (merge-base 233ca2849) and HEAD emitters over the SAME HEAD fixture corpus: every added or removed match is an `@callable-flow.*` match on one of those sources, and the pre-existing corpus is byte-identical (all other languages: zero delta). The rest of the drift is corpus growth from this PR's regression fixture, which this bench globs. Corpus growth: dart-callable-alternatives/app.dart (+1 file, +33 groups). Emitter delta: +6 / -3: `??` and `?:` seeds and copies now name each operand; the 3 removed matches are the whole-expression seeds and copy that carried a qualified name of the compound source. capture_groups_fp 829 -> 862, fixture_count 36 -> 37; synthetic counts unchanged; scaling 1.033 < 1.5. Prior 3a8ddabbeb1cba47a4757451d4f79d726ca230fd15e860772b11526fbb1c6687 -> 795290a9524ee0dc38af635536e9744c401ec13828ec77822d39e59e1cd6e649.",
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 2 existing prefixed package imports retain their explicit aliases (http/tool). Import sources, statement spans and all other matches are unchanged. Fixture entries 43; changed entries 1; capture groups 895 -> 895. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 2 existing prefixed package imports retain their explicit aliases (http/tool). Import sources, statement spans and all other matches are unchanged. Fixture entries 43; changed entries 1; capture groups 895 -> 895. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged.",
|
||||
"_rebaselined_3633_native_extension_types": "#3633: Compared the prior grammar and emitter at 89602560d with native extension-type capture over the same 42 Dart fixture files. Only dart-extension-types/models.dart changes: 11 module/type scope and declaration matches retain the original header text, and Box's declaration gains type-parameter metadata. All method, receiver and heritage captures are unchanged. Total capture groups remain 895 across 43 fixture/synthetic entries; synthetic scale counts stay 5011/16011. Measured scaling 1.127 < 1.5; budget unchanged. Prior 557bdc505af40590b21e53298584f14227b7d79220806425f8e7da25d78f9712 -> 4690403d2be0d270e28a55791df82eaa627d26d28c52d81bfafa59761badcaf3."
|
||||
},
|
||||
"java": {
|
||||
"fingerprint": "41c4338f5813a73199dd5c2609313c11076812df21fd9c429039a833325870e0",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,16 @@ import type { ClassExtractionConfig } from '../../class-types.js';
|
|||
|
||||
export const dartClassConfig: ClassExtractionConfig = {
|
||||
language: SupportedLanguages.Dart,
|
||||
typeDeclarationNodes: ['class_definition', 'extension_declaration', 'enum_declaration'],
|
||||
ancestorScopeNodeTypes: ['class_definition', 'extension_declaration', 'enum_declaration'],
|
||||
typeDeclarationNodes: [
|
||||
'class_definition',
|
||||
'extension_declaration',
|
||||
'extension_type_declaration',
|
||||
'enum_declaration',
|
||||
],
|
||||
ancestorScopeNodeTypes: [
|
||||
'class_definition',
|
||||
'extension_declaration',
|
||||
'extension_type_declaration',
|
||||
'enum_declaration',
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ import {
|
|||
dartArityCompatibility,
|
||||
} from './dart/index.js';
|
||||
import { DART_BUILT_INS } from './dart/built-ins.js';
|
||||
import { preprocessDartExtensionTypes } from './dart/extension-type-preprocess.js';
|
||||
|
||||
/**
|
||||
* Resolve the enclosing function from a `function_body` node by looking at its
|
||||
|
|
@ -123,7 +122,6 @@ export const dartProvider = defineLanguage({
|
|||
},
|
||||
] satisfies AstFrameworkPatternConfig[],
|
||||
treeSitterQueries: DART_QUERIES,
|
||||
preprocessSource: preprocessDartExtensionTypes,
|
||||
typeConfig: dartConfig,
|
||||
exportChecker: dartExportChecker,
|
||||
importResolver: createImportResolver(dartImportConfig),
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import { computeDartArityMetadata } from './arity-metadata.js';
|
|||
import { synthesizeDartReceiverBinding } from './receiver-binding.js';
|
||||
import { synthesizeDartSignatureBindings } from './signature-bindings.js';
|
||||
import { getDartParser, getDartScopeQuery } from './query.js';
|
||||
import { preprocessDartExtensionTypes } from './extension-type-preprocess.js';
|
||||
import { recordCacheHit, recordCacheMiss } from './cache-stats.js';
|
||||
import { getTreeSitterBufferSize } from '../../constants.js';
|
||||
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
||||
|
|
@ -156,17 +155,13 @@ export function emitDartScopeCaptures(
|
|||
_filePath: string,
|
||||
cachedTree?: unknown,
|
||||
): readonly CaptureMatch[] {
|
||||
// Idempotent re-application: `extractParsedFile` already preprocesses, but
|
||||
// direct emitter callers (benchmarks, capture goldens) must see the same
|
||||
// program the pipeline does.
|
||||
const parseText = preprocessDartExtensionTypes(sourceText);
|
||||
let tree: Parser.Tree;
|
||||
if (cachedTree !== undefined && cachedTree !== null) {
|
||||
tree = cachedTree as Parser.Tree;
|
||||
recordCacheHit();
|
||||
} else {
|
||||
tree = parseSourceSafe(getDartParser(), parseText, undefined, {
|
||||
bufferSize: getTreeSitterBufferSize(parseText),
|
||||
tree = parseSourceSafe(getDartParser(), sourceText, undefined, {
|
||||
bufferSize: getTreeSitterBufferSize(sourceText),
|
||||
});
|
||||
recordCacheMiss();
|
||||
}
|
||||
|
|
@ -311,7 +306,7 @@ export function emitDartScopeCaptures(
|
|||
emitDartFieldAssignmentBindings(node, out, memo);
|
||||
return;
|
||||
}
|
||||
if (node.type === 'extension_declaration') {
|
||||
if (node.type === 'extension_declaration' || node.type === 'extension_type_declaration') {
|
||||
emitExtensionImplementsHeritage(node, out);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1129,8 +1124,11 @@ function emitExtensionImplementsHeritage(extensionNode: SyntaxNode, out: Capture
|
|||
const nameNode = extensionNode.childForFieldName('name');
|
||||
if (nameNode === null) return;
|
||||
|
||||
const bodyStart = extensionNode.text.indexOf('{');
|
||||
const header = bodyStart === -1 ? extensionNode.text : extensionNode.text.slice(0, bodyStart);
|
||||
const body = extensionNode.childForFieldName('body');
|
||||
const header =
|
||||
body === null
|
||||
? extensionNode.text
|
||||
: extensionNode.text.slice(0, body.startIndex - extensionNode.startIndex);
|
||||
const implementsIndex = header.indexOf('implements');
|
||||
if (implementsIndex === -1) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
const DART_EXTENSION_TYPE_HEADER =
|
||||
/\b(extension)([ \t]+type[ \t]+(?:const[ \t]+)?)([A-Za-z_$][A-Za-z0-9_$]*)([ \t]*<[^()\r\n]*>)?([ \t]*)\(([^()\r\n]*)\)/g;
|
||||
|
||||
function representationType(representation: string): string | null {
|
||||
const trimmed = representation.trim();
|
||||
const match = /^(.*\S)\s+[A-Za-z_$][A-Za-z0-9_$]*$/.exec(trimmed);
|
||||
const typeName = match?.[1]?.trim();
|
||||
return typeName && typeName.length > 0 ? typeName : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewrites Dart 3.3 `extension type Name(Type value)` headers into ordinary
|
||||
* extension headers before tree-sitter sees the source. The vendored grammar
|
||||
* currently recovers these declarations through an ERROR subtree, while the
|
||||
* existing Dart ingestion path already handles `extension Name on Type`.
|
||||
*/
|
||||
export function preprocessDartExtensionTypes(sourceText: string): string {
|
||||
return sourceText.replace(
|
||||
DART_EXTENSION_TYPE_HEADER,
|
||||
(
|
||||
match,
|
||||
extensionKeyword: string,
|
||||
extensionTypeGap: string,
|
||||
name: string,
|
||||
typeParameters: string | undefined,
|
||||
beforeRepresentation: string,
|
||||
representation: string,
|
||||
) => {
|
||||
const typeName = representationType(representation);
|
||||
if (typeName === null) return match;
|
||||
|
||||
const representationSpanLength = beforeRepresentation.length + representation.length + 2;
|
||||
const rewrittenRepresentation = ` on ${typeName}`;
|
||||
if (rewrittenRepresentation.length > representationSpanLength) return match;
|
||||
|
||||
return (
|
||||
extensionKeyword +
|
||||
' '.repeat(extensionTypeGap.length) +
|
||||
name +
|
||||
(typeParameters ?? '') +
|
||||
rewrittenRepresentation +
|
||||
' '.repeat(representationSpanLength - rewrittenRepresentation.length)
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
* The Dart scope-capture tree-sitter query (`DART_SCOPE_QUERY`) plus lazy
|
||||
* `Parser`/`Query` singletons. Mirror of `languages/swift/query.ts`.
|
||||
*
|
||||
* Verified against tree-sitter-dart 1.0.0 (UserNobody14, commit 80e23c07,
|
||||
* ABI 14) — every node type below also appears in the legacy `DART_QUERIES`,
|
||||
* Verified against tree-sitter-dart 1.0.0-g0038280 (UserNobody14,
|
||||
* ABI 15) — every node type below also appears in the legacy `DART_QUERIES`,
|
||||
* which is validated against the same grammar.
|
||||
*
|
||||
* NOTE: This query intentionally covers ONLY the constructs that map cleanly
|
||||
|
|
@ -39,6 +39,7 @@ const DART_SCOPE_QUERY = `
|
|||
(class_definition) @scope.class
|
||||
(mixin_declaration) @scope.class
|
||||
(extension_declaration) @scope.class
|
||||
(extension_type_declaration) @scope.class
|
||||
(enum_declaration) @scope.class
|
||||
|
||||
; ── Declarations — types ─────────────────────────────────────────────────────
|
||||
|
|
@ -53,6 +54,9 @@ const DART_SCOPE_QUERY = `
|
|||
(type_parameters)? @declaration.type-parameters) @declaration.class
|
||||
(mixin_declaration (identifier) @declaration.name) @declaration.trait
|
||||
(extension_declaration name: (identifier) @declaration.name) @declaration.class
|
||||
(extension_type_declaration
|
||||
name: (identifier) @declaration.name
|
||||
type_parameters: (type_parameters)? @declaration.type-parameters) @declaration.class
|
||||
(enum_declaration name: (identifier) @declaration.name) @declaration.enum
|
||||
|
||||
; ── Declarations — type aliases (old-style + new-style function typedefs) ────
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ const TYPE_DECL_TYPES = new Set([
|
|||
'class_definition',
|
||||
'mixin_declaration',
|
||||
'extension_declaration',
|
||||
'extension_type_declaration',
|
||||
'enum_declaration',
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,12 @@ function extractDartAnnotations(node: SyntaxNode): string[] {
|
|||
|
||||
export const dartMethodConfig: MethodExtractionConfig = {
|
||||
language: SupportedLanguages.Dart,
|
||||
typeDeclarationNodes: ['class_definition', 'mixin_declaration', 'extension_declaration'],
|
||||
typeDeclarationNodes: [
|
||||
'class_definition',
|
||||
'mixin_declaration',
|
||||
'extension_declaration',
|
||||
'extension_type_declaration',
|
||||
],
|
||||
methodNodeTypes: ['method_signature', 'declaration'],
|
||||
bodyNodeTypes: ['class_body', 'extension_body'],
|
||||
|
||||
|
|
|
|||
|
|
@ -2604,7 +2604,7 @@ export const SWIFT_QUERIES = `
|
|||
|
||||
`;
|
||||
|
||||
// Dart queries - works with tree-sitter-dart (UserNobody14/tree-sitter-dart, ABI 14)
|
||||
// Dart queries - works with tree-sitter-dart (UserNobody14/tree-sitter-dart, ABI 15)
|
||||
// Note: Dart grammar has function_signature/method_signature as wrappers;
|
||||
// top-level functions are (program > function_signature),
|
||||
// methods inside classes are (method_signature > function_signature).
|
||||
|
|
@ -2622,6 +2622,8 @@ export const DART_QUERIES = `
|
|||
; ── Extensions ───────────────────────────────────────────────────────────────
|
||||
(extension_declaration
|
||||
name: (identifier) @name) @definition.class
|
||||
(extension_type_declaration
|
||||
name: (identifier) @name) @definition.class
|
||||
|
||||
; ── Enums ────────────────────────────────────────────────────────────────────
|
||||
(enum_declaration
|
||||
|
|
|
|||
|
|
@ -363,6 +363,7 @@ export const CLASS_CONTAINER_TYPES = new Set([
|
|||
// Dart
|
||||
'mixin_declaration',
|
||||
'extension_declaration',
|
||||
'extension_type_declaration',
|
||||
// Ruby
|
||||
'class',
|
||||
'module',
|
||||
|
|
@ -430,6 +431,7 @@ export const CONTAINER_TYPE_TO_LABEL: Record<string, string> = {
|
|||
protocol_declaration: 'Interface',
|
||||
mixin_declaration: 'Mixin',
|
||||
extension_declaration: 'Class',
|
||||
extension_type_declaration: 'Class',
|
||||
class: 'Class',
|
||||
// Ruby `module` declarations map to `Trait` so they participate in the
|
||||
// class-like type registry used by `lookupClassByName` / inheritance
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ afterAll(() => {
|
|||
if (suiteGitnexusHome) cleanupTempDirSync(suiteGitnexusHome);
|
||||
});
|
||||
|
||||
const runAnalyze = () =>
|
||||
const runAnalyze = (walCheckpointThreshold: string) =>
|
||||
spawnSync(process.execPath, [...CLI_SPAWN_PREFIX, 'analyze', '--skip-skills'], {
|
||||
cwd: repoPath,
|
||||
encoding: 'utf8',
|
||||
|
|
@ -85,9 +85,7 @@ const runAnalyze = () =>
|
|||
GITNEXUS_HOME: suiteGitnexusHome,
|
||||
// Skip ensureHeap re-exec (which drops the tsx loader).
|
||||
NODE_OPTIONS: `${process.env.NODE_OPTIONS || ''} --max-old-space-size=8192`.trim(),
|
||||
// Tiny threshold forces auto-checkpoint on every write so the
|
||||
// first write into the WAL trips the planted rename blocker.
|
||||
GITNEXUS_WAL_CHECKPOINT_THRESHOLD: '1',
|
||||
GITNEXUS_WAL_CHECKPOINT_THRESHOLD: walCheckpointThreshold,
|
||||
CI: '1',
|
||||
},
|
||||
});
|
||||
|
|
@ -105,8 +103,10 @@ describe('analyze WAL auto-checkpoint rename failure (real lbug, no mocks)', ()
|
|||
|
||||
// 1) Clean full analyze (no blocker) — builds the index into staging and
|
||||
// swaps it in. Must succeed; the staging checkpoint name is unblocked.
|
||||
const first = runAnalyze();
|
||||
expect(first.status === null ? 'timeout' : first.status).toBe(0);
|
||||
// Use the normal 64 MiB threshold while seeding the index. Checkpointing
|
||||
// every setup write needlessly stalls schema and FTS creation on Windows.
|
||||
const first = runAnalyze('67108864');
|
||||
expect(first.status === null ? 'timeout' : first.status, first.stderr).toBe(0);
|
||||
|
||||
// 2) Change a tracked source file and commit, so the next analyze is an
|
||||
// incremental writeback (in-place), not a full rebuild.
|
||||
|
|
@ -138,12 +138,12 @@ describe('analyze WAL auto-checkpoint rename failure (real lbug, no mocks)', ()
|
|||
fs.writeFileSync(path.join(blockerDir, 'blocker'), 'cannot-be-renamed-over');
|
||||
|
||||
// 4) Incremental analyze into the blocked checkpoint target.
|
||||
const result = runAnalyze();
|
||||
const result = runAnalyze('1');
|
||||
const combined = `${result.stderr}\n${result.stdout}`;
|
||||
|
||||
// The CLI must exit non-zero. status === null means the timeout fired
|
||||
// without a clean exit — also a failure for this assertion.
|
||||
expect(result.status === null ? 'timeout' : result.status).not.toBe(0);
|
||||
// The blocked checkpoint must produce an error, rather than a timeout.
|
||||
expect(result.status, combined).not.toBeNull();
|
||||
expect(result.status).not.toBe(0);
|
||||
|
||||
// Recovery hint must reference the CLI flag and the recommended
|
||||
// 64 MiB threshold (67_108_864 bytes). Both come from the
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import {
|
|||
} from '../../../src/core/tree-sitter/parser-loader.js';
|
||||
import { SupportedLanguages } from '../../../src/config/supported-languages.js';
|
||||
import type { CaptureMatch } from 'gitnexus-shared';
|
||||
import { preprocessDartExtensionTypes } from '../../../src/core/ingestion/languages/dart/extension-type-preprocess.js';
|
||||
import { getDartParser } from '../../../src/core/ingestion/languages/dart/query.js';
|
||||
|
||||
let dartAvailable = isLanguageAvailable(SupportedLanguages.Dart);
|
||||
if (dartAvailable) {
|
||||
|
|
@ -146,18 +146,35 @@ describe.skipIf(!dartAvailable)('F28 — Dart typedef capture (scope layer)', ()
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe.skipIf(!dartAvailable)('Dart extension type declarations (scope layer)', () => {
|
||||
it('rewrites extension type headers without changing source length or line count', () => {
|
||||
const rewritten = preprocessDartExtensionTypes(EXTENSION_TYPES);
|
||||
expect(rewritten).toHaveLength(EXTENSION_TYPES.length);
|
||||
expect(rewritten.split('\n')).toHaveLength(EXTENSION_TYPES.split('\n').length);
|
||||
for (const name of ['UserId', 'EmptyId', 'Celsius', 'Box', 'Pair']) {
|
||||
expect(rewritten.indexOf(name)).toBe(EXTENSION_TYPES.indexOf(name));
|
||||
it('parses native extension types without errors and preserves declaration positions', () => {
|
||||
const tree = getDartParser().parse(EXTENSION_TYPES);
|
||||
expect(tree.rootNode.hasError).toBe(false);
|
||||
const matches = emitDartScopeCaptures(EXTENSION_TYPES, 'test.dart', tree);
|
||||
const declarations = matches.filter((match) => match['@declaration.class']);
|
||||
for (const name of ['UserId', 'EmptyId', 'Celsius', 'Box', 'Pair', 'Fancy']) {
|
||||
const declaration = declarations.find((match) => match['@declaration.name']?.text === name);
|
||||
const precedingLines = EXTENSION_TYPES.slice(0, EXTENSION_TYPES.indexOf(name)).split('\n');
|
||||
expect(declaration?.['@declaration.name']?.range).toMatchObject({
|
||||
startLine: precedingLines.length,
|
||||
startCol: precedingLines.at(-1)?.length,
|
||||
});
|
||||
}
|
||||
expect(rewritten).toContain('UserId on String');
|
||||
expect(rewritten).toContain('EmptyId on String');
|
||||
expect(rewritten).toContain('Celsius on double');
|
||||
expect(rewritten).toContain('Box<T> on List<T>');
|
||||
expect(rewritten).toContain('Pair on String');
|
||||
});
|
||||
|
||||
it('captures generic extension type parameters', () => {
|
||||
const matches = emitDartScopeCaptures(EXTENSION_TYPES, 'test.dart');
|
||||
const box = matches.find((match) => match['@declaration.name']?.text === 'Box');
|
||||
expect(box?.['@declaration.type-parameters']?.text).toBe('<T>');
|
||||
});
|
||||
|
||||
it('binds this inside extension type methods to the owning type', () => {
|
||||
const matches = emitDartScopeCaptures(EXTENSION_TYPES, 'test.dart');
|
||||
const receivers = matches
|
||||
.filter((match) => match['@type-binding.name']?.text === 'this')
|
||||
.map((match) => match['@type-binding.type']?.text);
|
||||
expect(receivers).toEqual(
|
||||
expect.arrayContaining(['UserId', 'Celsius', 'Box', 'Pair', 'Fancy']),
|
||||
);
|
||||
});
|
||||
|
||||
it('captures extension types as class-like declarations', () => {
|
||||
|
|
@ -178,6 +195,16 @@ describe.skipIf(!dartAvailable)('Dart extension type declarations (scope layer)'
|
|||
);
|
||||
expect(imports).not.toContain('__heritage__:implements:int:Pair');
|
||||
});
|
||||
|
||||
it('captures implements clauses after named-record representation types', () => {
|
||||
const imports = heritageImports(
|
||||
'extension type RecordId(({String id}) value) implements Identifiable, Comparator<String, int> {}',
|
||||
);
|
||||
expect(imports).toEqual([
|
||||
'__heritage__:implements:Identifiable:RecordId',
|
||||
'__heritage__:implements:Comparator:RecordId',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -44,10 +44,6 @@ const FIXTURES: Partial<Record<SupportedLanguages, { filePath: string; source: s
|
|||
'',
|
||||
].join('\n'),
|
||||
},
|
||||
[SupportedLanguages.Dart]: {
|
||||
filePath: 'meters.dart',
|
||||
source: ['extension type Meters(int value) {', ' int get raw => value;', '}', ''].join('\n'),
|
||||
},
|
||||
[SupportedLanguages.ObjectiveC]: {
|
||||
filePath: 'Marker.m',
|
||||
source: [
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "tree-sitter-dart",
|
||||
"version": "1.0.0-gbe07cf7",
|
||||
"version": "1.0.0-g0038280",
|
||||
"description": "Dart grammar attempt for tree-sitter",
|
||||
"repository": "https://github.com/UserNobody14/tree-sitter-dart",
|
||||
"license": "ISC",
|
||||
"main": "bindings/node",
|
||||
"types": "bindings/node",
|
||||
"_vendoredBy": "gitnexus — upstream generated src/ and bindings/node/binding.cc copied byte-for-byte from https://github.com/UserNobody14/tree-sitter-dart@be07cf7118d3dba06236a3f19541685a68209934. GitNexus keeps its synchronous CommonJS loader and hardened binding.gyp. Prebuilds are rebuilt from these sources by build-tree-sitter-prebuilds.yml. Do not edit generated C by hand.",
|
||||
"_vendoredBy": "gitnexus - re-vendored from UserNobody14/tree-sitter-dart@0038280b774b65c1b89ba7fec50624d8baed9fe1 by grammar-update-monitor on ABI 15. Source-build inputs (parser.c/scanner.c/src/) refreshed; the GitNexus-hardened binding.gyp + synchronous loader + vendor README + prebuilds are preserved (prebuilds are rebuilt by build-tree-sitter-prebuilds.yml on this version change). No scripts/dependencies here (#836/#1728).",
|
||||
"peerDependencies": {
|
||||
"tree-sitter": "0.25.1"
|
||||
},
|
||||
|
|
@ -15,5 +15,5 @@
|
|||
"optional": true
|
||||
}
|
||||
},
|
||||
"_upstreamCommit": "be07cf7118d3dba06236a3f19541685a68209934"
|
||||
"_upstreamCommit": "0038280b774b65c1b89ba7fec50624d8baed9fe1"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
423e36a7cc1e3186d5b5d34435916c9746883d3745de33be21ec0c9db19a0d0c ./darwin-arm64/tree-sitter-dart.node
|
||||
da526be2e8c6caf0d6b5421c33a59ff0ffcba3609172bd0399bfe98abd1550f2 ./darwin-x64/tree-sitter-dart.node
|
||||
18ee4afbaaa883416ee671c551ba3c69b0dc7ff0bccc42463c9d8e32eea2e704 ./linux-arm64/tree-sitter-dart.node
|
||||
209d3949337ebc59b0f31b19333345e1a45c800f81808cf9f811a3b469166549 ./linux-x64/tree-sitter-dart.node
|
||||
535954d7ffe0b436551c9837be5cf5cf5d7b9cdb6a0d68dd9def2d154164cb51 ./win32-arm64/tree-sitter-dart.node
|
||||
0c3790d0d9e440c11ea90d9a48b308cef4fe0e1e1865243131e4c3e7dfe7e2ff ./win32-x64/tree-sitter-dart.node
|
||||
27da0743f90e98bd2117164fffb89d30975d665c6c8c09f0646964e2b5842331 ./darwin-arm64/tree-sitter-dart.node
|
||||
8c22efae548b85fa3569af4917eb35165436968abbd0007b2ee32e7afaeca85d ./darwin-x64/tree-sitter-dart.node
|
||||
6126179aa1a164e940b9d960a1b767a4d7a56b0ea00baaf59bca03044463f691 ./linux-arm64/tree-sitter-dart.node
|
||||
88e0af5d4f65e48ac57922168504b2a7604e2b19dad5272c4d8a611e0f8db62f ./linux-x64/tree-sitter-dart.node
|
||||
cb4d1a0d1eceec1632f1333bbe5358319f6fdcfe1b3b8098166c2c6dab93e035 ./win32-arm64/tree-sitter-dart.node
|
||||
3b7aba0e431ceef9ecbb8ce0b467efd5958d5e150862ea7fdd385684959d9fae ./win32-x64/tree-sitter-dart.node
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
152
gitnexus/vendor/tree-sitter-dart/src/node-types.json
vendored
152
gitnexus/vendor/tree-sitter-dart/src/node-types.json
vendored
|
|
@ -2168,6 +2168,16 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"primary_constructor": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "primary_constructor",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"superclass": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
|
|
@ -2205,6 +2215,10 @@
|
|||
"type": "base",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "const_builtin",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "interface",
|
||||
"named": true
|
||||
|
|
@ -2755,7 +2769,26 @@
|
|||
{
|
||||
"type": "constant_constructor_signature",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"fields": {
|
||||
"name": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": ".",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "new",
|
||||
"named": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
|
|
@ -2767,10 +2800,6 @@
|
|||
{
|
||||
"type": "formal_parameter_list",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -3054,7 +3083,7 @@
|
|||
"fields": {
|
||||
"name": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": ".",
|
||||
|
|
@ -3188,6 +3217,10 @@
|
|||
"type": "operator_signature",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "primary_constructor_body_signature",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "record_type",
|
||||
"named": true
|
||||
|
|
@ -3300,7 +3333,7 @@
|
|||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "annotation",
|
||||
|
|
@ -3373,7 +3406,7 @@
|
|||
"fields": {
|
||||
"body": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "enum_body",
|
||||
|
|
@ -3390,6 +3423,26 @@
|
|||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary_constructor": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "primary_constructor",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type_parameters": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "type_parameters",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"children": {
|
||||
|
|
@ -3400,6 +3453,10 @@
|
|||
"type": "annotation",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "const_builtin",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "interfaces",
|
||||
"named": true
|
||||
|
|
@ -3407,10 +3464,6 @@
|
|||
{
|
||||
"type": "mixins",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "type_parameters",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -3731,7 +3784,7 @@
|
|||
"fields": {
|
||||
"body": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "extension_body",
|
||||
|
|
@ -3815,7 +3868,7 @@
|
|||
"fields": {
|
||||
"body": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "class_body",
|
||||
|
|
@ -8353,6 +8406,10 @@
|
|||
"type": "operator_signature",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "primary_constructor_body_signature",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "setter_signature",
|
||||
"named": true
|
||||
|
|
@ -10687,6 +10744,55 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "primary_constructor",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "new",
|
||||
"named": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "formal_parameter_list",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "primary_constructor_body_signature",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "initializers",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "this",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "program",
|
||||
"named": true,
|
||||
|
|
@ -11644,7 +11750,7 @@
|
|||
"fields": {
|
||||
"name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
|
|
@ -11652,9 +11758,19 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"parameters": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "formal_parameter_list",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": ".",
|
||||
|
|
@ -11699,6 +11815,10 @@
|
|||
"type": "annotation",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "final_builtin",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
|
|
|
|||
339141
gitnexus/vendor/tree-sitter-dart/src/parser.c
vendored
339141
gitnexus/vendor/tree-sitter-dart/src/parser.c
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"name": "tree-sitter-proto",
|
||||
"version": "0.6.0-gd7d1542",
|
||||
"version": "0.6.0-g1836649",
|
||||
"description": "tree-sitter grammar for protobuf — ABI 14 build from coder3101/tree-sitter-proto latest grammar.js, compatible with tree-sitter 0.25",
|
||||
"repository": "https://github.com/coder3101/tree-sitter-proto",
|
||||
"license": "MIT",
|
||||
"main": "bindings/node",
|
||||
"_vendoredBy": "gitnexus — upstream generated src/ and bindings/node/binding.cc copied byte-for-byte from https://github.com/coder3101/tree-sitter-proto@d7d15427321da271cb1c25c12735e180ef981473. GitNexus keeps its synchronous CommonJS loader and hardened binding.gyp. Prebuilds are rebuilt from these sources by build-tree-sitter-prebuilds.yml. Do not edit generated C by hand.",
|
||||
"_vendoredBy": "gitnexus - re-vendored from coder3101/tree-sitter-proto@18366491f37d43d6d5d02cbb1e79b650b5728145 by grammar-update-monitor on ABI 15. Source-build inputs (parser.c/scanner.c/src/) refreshed; the GitNexus-hardened binding.gyp + synchronous loader + vendor README + prebuilds are preserved (prebuilds are rebuilt by build-tree-sitter-prebuilds.yml on this version change). No scripts/dependencies here (#836/#1728).",
|
||||
"peerDependencies": {
|
||||
"tree-sitter": "0.25.1"
|
||||
},
|
||||
"_upstreamCommit": "d7d15427321da271cb1c25c12735e180ef981473",
|
||||
"_upstreamCommit": "18366491f37d43d6d5d02cbb1e79b650b5728145",
|
||||
"peerDependenciesMeta": {
|
||||
"tree-sitter": {
|
||||
"optional": true
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
dd9744a196fa560f1ec1c30110e3d023722c606dcb7cd4f4e07a2da68dc481e9 ./darwin-arm64/tree-sitter-proto.node
|
||||
82bf2b335e7f8197be98a126a0c982a71ffb4c25c6780cc41463d57986a4727e ./darwin-x64/tree-sitter-proto.node
|
||||
ba65d25de1fd881def2cf85f473094d90a45612bfa763f4f97d2841b3d7d715e ./linux-arm64/tree-sitter-proto.node
|
||||
dea80ed2fb48a6d19866468f652ec48eab5435306c6477b213eafe51cbbbf2ee ./linux-x64/tree-sitter-proto.node
|
||||
f057563de539abd6ada73aa9097e5bd1849bd6c31d721e34c791bf0388bfa237 ./win32-arm64/tree-sitter-proto.node
|
||||
4269e6e073f22ed777400b6f4b553f51974c5d641c56374046bf5c0692f4c841 ./win32-x64/tree-sitter-proto.node
|
||||
289d64f66c85c5e9645a9227aebec2a829fe05958003fb52467852b706e8ed42 ./darwin-arm64/tree-sitter-proto.node
|
||||
085f65a8c6d11ccb1a8ac02bf7ac887f5951aaf8c5c7cd92e12381f5766d33a0 ./darwin-x64/tree-sitter-proto.node
|
||||
dbcc0f5b54b64bcec9f1259c3ae4a538bbd612223cb89dce79287d84db603c98 ./linux-arm64/tree-sitter-proto.node
|
||||
e278720a53610d84d4468d80109c9e7c12f181e13e021d3c9b214fa161333196 ./linux-x64/tree-sitter-proto.node
|
||||
3c9775ef939aed590a70d4a4d80ed277917c275a5ea9bed458fea29c6c94ae73 ./win32-arm64/tree-sitter-proto.node
|
||||
2ce2d2d19b313c4b3e623c4f487388b9b47293bd852a41dc21d85f4e13358d70 ./win32-x64/tree-sitter-proto.node
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue