@@ -316,34 +316,12 @@ func isSymbolDeclaredInside(sym *ast.Symbol, funcNode *ast.Node) bool {
316316 return false
317317}
318318
319- // GetVarDeclListKind returns the kind of a VariableDeclarationList: one of
320- // "const", "let", "var", "using", "await using", or "" for anything else.
321- //
322- // IMPORTANT: tsgo encodes `await using` as `NodeFlagsConst | NodeFlagsUsing`
323- // (see the node-flags definitions in typescript-go's ast package), so the aggregate flag
324- // `NodeFlagsAwaitUsing` is NOT a single bit. We must inspect the individual
325- // `NodeFlagsUsing` and `NodeFlagsConst` bits and only report `"await using"`
326- // when BOTH are set, otherwise `flags & NodeFlagsAwaitUsing != 0` would
327- // collapse plain `const` and plain `using` into `"await using"`.
319+ // GetVarDeclListKind is a thin wrapper around utils.GetVarDeclListKind kept
320+ // for backwards compatibility with the typescript-eslint counterpart in
321+ // internal/plugins/typescript/rules/no_loop_func, which imports this symbol.
322+ // New callers should use utils.GetVarDeclListKind directly.
328323func GetVarDeclListKind (declList * ast.Node ) string {
329- if declList == nil || declList .Kind != ast .KindVariableDeclarationList {
330- return ""
331- }
332- flags := declList .Flags
333- hasUsing := flags & ast .NodeFlagsUsing != 0
334- hasConst := flags & ast .NodeFlagsConst != 0
335- switch {
336- case hasUsing && hasConst :
337- return "await using"
338- case hasUsing :
339- return "using"
340- case hasConst :
341- return "const"
342- case flags & ast .NodeFlagsLet != 0 :
343- return "let"
344- default :
345- return "var"
346- }
324+ return utils .GetVarDeclListKind (declList )
347325}
348326
349327// enclosingVarDeclOfBindingElement walks up through nested BindingElement /
0 commit comments