reorganise

This commit is contained in:
Gergo Magyar 2026-03-16 21:00:16 +00:00
parent 0c98923729
commit 00c90d476f
4 changed files with 9 additions and 9 deletions

View file

@ -143,15 +143,15 @@ const extractJavaPatternBinding: PatternBindingExtractor = (node) => {
export const javaTypeConfig: LanguageTypeConfig = {
declarationNodeTypes: JAVA_DECLARATION_NODE_TYPES,
forLoopNodeTypes: JAVA_FOR_LOOP_NODE_TYPES,
patternBindingNodeTypes: new Set(['instanceof_expression']),
extractDeclaration: extractJavaDeclaration,
extractParameter: extractJavaParameter,
extractInitializer: extractJavaInitializer,
scanConstructorBinding: scanJavaConstructorBinding,
forLoopNodeTypes: JAVA_FOR_LOOP_NODE_TYPES,
extractForLoopBinding: extractJavaForLoopBinding,
extractPendingAssignment: extractJavaPendingAssignment,
extractPatternBinding: extractJavaPatternBinding,
patternBindingNodeTypes: new Set(['instanceof_expression']),
};
// ── Kotlin ────────────────────────────────────────────────────────────────

View file

@ -344,6 +344,7 @@ const PATTERN_BINDING_NODE_TYPES: ReadonlySet<string> = new Set(['as_pattern']);
export const typeConfig: LanguageTypeConfig = {
declarationNodeTypes: DECLARATION_NODE_TYPES,
forLoopNodeTypes: FOR_LOOP_NODE_TYPES,
patternBindingNodeTypes: PATTERN_BINDING_NODE_TYPES,
extractDeclaration,
extractParameter,
extractInitializer,
@ -351,5 +352,4 @@ export const typeConfig: LanguageTypeConfig = {
extractForLoopBinding,
extractPendingAssignment,
extractPatternBinding,
patternBindingNodeTypes: PATTERN_BINDING_NODE_TYPES,
};

View file

@ -271,11 +271,11 @@ const extractPatternBinding: PatternBindingExtractor = (
export const typeConfig: LanguageTypeConfig = {
declarationNodeTypes: DECLARATION_NODE_TYPES,
patternBindingNodeTypes: new Set(['let_condition']),
extractDeclaration,
extractInitializer,
extractParameter,
scanConstructorBinding,
extractPendingAssignment,
extractPatternBinding,
patternBindingNodeTypes: new Set(['let_condition']),
};

View file

@ -63,6 +63,11 @@ export interface LanguageTypeConfig {
declarationNodeTypes: ReadonlySet<string>;
/** AST node types for for-each/for-in statements with explicit element types. */
forLoopNodeTypes?: ReadonlySet<string>;
/** Optional allowlist of AST node types on which extractPatternBinding should run.
* When present, extractPatternBinding is only invoked for nodes whose type is in this set,
* short-circuiting the call for all other node types. When absent, every node is passed to
* extractPatternBinding (legacy behaviour). */
patternBindingNodeTypes?: ReadonlySet<string>;
/** Extract a (varName → typeName) binding from a declaration node */
extractDeclaration: TypeBindingExtractor;
/** Extract a (varName → typeName) binding from a parameter node */
@ -91,9 +96,4 @@ export interface LanguageTypeConfig {
* The extractor receives the current scope's resolved bindings (read-only) to look up the
* source variable's type. Returns undefined for non-matching nodes or unknown source types. */
extractPatternBinding?: PatternBindingExtractor;
/** Optional allowlist of AST node types on which extractPatternBinding should run.
* When present, extractPatternBinding is only invoked for nodes whose type is in this set,
* short-circuiting the call for all other node types. When absent, every node is passed to
* extractPatternBinding (legacy behaviour). */
patternBindingNodeTypes?: ReadonlySet<string>;
}