@@ -19,29 +19,6 @@ export function collectGrants(ast: AstNode) {
1919 node . type === 'MemberExpression' &&
2020 isReference ( node , parent )
2121 ) {
22- function getMemberExpressionFullNameRecursive ( astNode : MemberExpression ) : string | null {
23- if ( astNode . property . type !== 'Identifier' ) {
24- return null ;
25- }
26-
27- switch ( astNode . object . type ) {
28- case 'MemberExpression' : {
29- const nameSoFar = getMemberExpressionFullNameRecursive ( astNode . object ) ;
30- if ( nameSoFar == null ) {
31- return null ;
32- }
33-
34- return `${ nameSoFar } .${ astNode . property . name } `
35- }
36- case 'Identifier' : {
37- return `${ astNode . object . name } .${ astNode . property . name } ` ;
38- }
39- default : {
40- return null ;
41- }
42- }
43- }
44-
4522 const fullName = getMemberExpressionFullNameRecursive ( node ) ;
4623 const match = GRANTS_REGEXP . exec ( fullName ) ;
4724 if ( match ) {
@@ -69,6 +46,29 @@ export function collectGrants(ast: AstNode) {
6946 return grantSetPerFile ;
7047}
7148
49+ function getMemberExpressionFullNameRecursive ( astNode : MemberExpression ) : string | null {
50+ if ( astNode . property . type !== 'Identifier' ) {
51+ return null ;
52+ }
53+
54+ switch ( astNode . object . type ) {
55+ case 'MemberExpression' : {
56+ const nameSoFar = getMemberExpressionFullNameRecursive ( astNode . object ) ;
57+ if ( nameSoFar == null ) {
58+ return null ;
59+ }
60+
61+ return `${ nameSoFar } .${ astNode . property . name } `
62+ }
63+ case 'Identifier' : {
64+ return `${ astNode . object . name } .${ astNode . property . name } ` ;
65+ }
66+ default : {
67+ return null ;
68+ }
69+ }
70+ }
71+
7272export function getMetadata (
7373 metaFileContent : string ,
7474 additionalGrantList : Set < string > ,
0 commit comments