@@ -21,10 +21,11 @@ import {
2121 lines ,
2222 resetLines ,
2323} from './location.js' ;
24+ import * as scopeMethods from './scope.js' ;
2425import * as tokenMethods from './tokens.js' ;
2526
2627import type { Program } from '../generated/types.d.ts' ;
27- import type { Scope , ScopeManager , Variable } from './scope.ts' ;
28+ import type { ScopeManager } from './scope.ts' ;
2829import type { BufferWithArrays , Node , NodeOrToken , Ranged } from './types.ts' ;
2930
3031const { max } = Math ;
@@ -182,15 +183,11 @@ export const SOURCE_CODE = Object.freeze({
182183 throw new Error ( '`sourceCode.isSpaceBetween` not implemented yet' ) ; // TODO
183184 } ,
184185
185- /**
186- * Determine whether the given identifier node is a reference to a global variable.
187- * @param node - `Identifier` node to check.
188- * @returns `true` if the identifier is a reference to a global variable.
189- */
190- // oxlint-disable-next-line no-unused-vars
191- isGlobalReference ( node : Node ) : boolean {
192- throw new Error ( '`sourceCode.isGlobalReference` not implemented yet' ) ; // TODO
193- } ,
186+ // Scope methods
187+ isGlobalReference : scopeMethods . isGlobalReference ,
188+ getDeclaredVariables : scopeMethods . getDeclaredVariables ,
189+ getScope : scopeMethods . getScope ,
190+ markVariableAsUsed : scopeMethods . markVariableAsUsed ,
194191
195192 // Token methods
196193 getTokens : tokenMethods . getTokens ,
@@ -223,38 +220,6 @@ export const SOURCE_CODE = Object.freeze({
223220 getIndexFromLoc : getOffsetFromLineColumn ,
224221
225222 getAncestors,
226-
227- /**
228- * Get the variables that `node` defines.
229- * This is a convenience method that passes through to the same method on the `scopeManager`.
230- * @param node - The node for which the variables are obtained.
231- * @returns An array of variable nodes representing the variables that `node` defines.
232- */
233- // oxlint-disable-next-line no-unused-vars
234- getDeclaredVariables ( node : Node ) : Variable [ ] {
235- throw new Error ( '`sourceCode.getDeclaredVariables` not implemented yet' ) ; // TODO
236- } ,
237-
238- /**
239- * Get the scope for the given node
240- * @param node - The node to get the scope of.
241- * @returns The scope information for this node.
242- */
243- // oxlint-disable-next-line no-unused-vars
244- getScope ( node : Node ) : Scope {
245- throw new Error ( '`sourceCode.getScope` not implemented yet' ) ; // TODO
246- } ,
247-
248- /**
249- * Mark a variable as used in the current scope
250- * @param name - The name of the variable to mark as used.
251- * @param refNode? - The closest node to the variable reference.
252- * @returns `true` if the variable was found and marked as used, `false` if not.
253- */
254- // oxlint-disable-next-line no-unused-vars
255- markVariableAsUsed ( name : string , refNode : Node ) : boolean {
256- throw new Error ( '`sourceCode.markVariableAsUsed` not implemented yet' ) ; // TODO
257- } ,
258223} ) ;
259224
260225export type SourceCode = typeof SOURCE_CODE ;
0 commit comments