mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +00:00
32 lines
748 B
TypeScript
32 lines
748 B
TypeScript
|
import { ScopeTracker } from '../../src/core/utils/parse'
|
||
|
|
||
|
export class TestScopeTracker extends ScopeTracker {
|
||
|
getScopes () {
|
||
|
return this.scopes
|
||
|
}
|
||
|
|
||
|
getScopeIndexKey () {
|
||
|
return this.scopeIndexKey
|
||
|
}
|
||
|
|
||
|
getScopeIndexStack () {
|
||
|
return this.scopeIndexStack
|
||
|
}
|
||
|
|
||
|
isDeclaredInScope (identifier: string, scope: string) {
|
||
|
const oldKey = this.scopeIndexKey
|
||
|
this.scopeIndexKey = scope
|
||
|
const result = this.isDeclared(identifier)
|
||
|
this.scopeIndexKey = oldKey
|
||
|
return result
|
||
|
}
|
||
|
|
||
|
getDeclarationFromScope (identifier: string, scope: string) {
|
||
|
const oldKey = this.scopeIndexKey
|
||
|
this.scopeIndexKey = scope
|
||
|
const result = this.getDeclaration(identifier)
|
||
|
this.scopeIndexKey = oldKey
|
||
|
return result
|
||
|
}
|
||
|
}
|