Using of internal storage to store lexical scope directives

This commit is contained in:
sanex
2020-12-30 10:12:33 +03:00
parent 89db80a32c
commit adcf2691aa
6 changed files with 14 additions and 40 deletions
-13
View File
@@ -1,5 +1,4 @@
import * as ESTree from 'estree';
import { TNodeWithLexicalScope } from '../types/node/TNodeWithLexicalScope';
export class NodeMetadata {
/**
@@ -47,16 +46,4 @@ export class NodeMetadata {
public static isReplacedLiteral (literalNode: ESTree.Literal): boolean {
return NodeMetadata.get<ESTree.LiteralNodeMetadata, 'replacedLiteral'>(literalNode, 'replacedLiteral') === true;
}
/**
* @param {TNodeWithLexicalScope} nodeWithLexicalScope
* @returns {Directive | null | undefined}
*/
public static getDirectiveNode (nodeWithLexicalScope: TNodeWithLexicalScope): ESTree.Directive | null | undefined {
return NodeMetadata.get<
ESTree.ProgramNodeMetadata
| ESTree.FunctionNodeMetadata,
'directiveNode'
>(nodeWithLexicalScope, 'directiveNode');
}
}