mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-19 00:31:06 +00:00
Merge commit '6e92d2345e8231a44556ce7d416451f5f3e6c398' as 'engine262'
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type { ParseNode } from '../parser/ParseNode.mts';
|
||||
import type { JSStringValue } from '../value.mts';
|
||||
import {
|
||||
TopLevelLexicallyDeclaredNames,
|
||||
} from './all.mts';
|
||||
|
||||
export function LexicallyDeclaredNames(node: ParseNode): JSStringValue[] {
|
||||
switch (node.type) {
|
||||
case 'Script':
|
||||
if (node.ScriptBody) {
|
||||
return LexicallyDeclaredNames(node.ScriptBody);
|
||||
}
|
||||
return [];
|
||||
case 'ScriptBody':
|
||||
return TopLevelLexicallyDeclaredNames(node.StatementList);
|
||||
case 'FunctionBody':
|
||||
case 'GeneratorBody':
|
||||
case 'AsyncBody':
|
||||
case 'AsyncGeneratorBody':
|
||||
return TopLevelLexicallyDeclaredNames(node.FunctionStatementList);
|
||||
case 'ClassStaticBlockBody':
|
||||
return TopLevelLexicallyDeclaredNames(node.ClassStaticBlockStatementList);
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user