1- use crate :: symbols:: Name ;
1+ use crate :: { location :: LocationKind , symbols:: Name } ;
22use squawk_syntax:: {
33 SyntaxKind , SyntaxNode ,
44 ast:: { self , AstNode } ,
@@ -884,7 +884,7 @@ pub(crate) fn classify_name(name: &ast::Name) -> Option<NameClass> {
884884 None
885885}
886886
887- pub ( crate ) fn classify_def_node ( def_node : & SyntaxNode ) -> Option < NameRefClass > {
887+ pub ( crate ) fn classify_def_node ( def_node : & SyntaxNode ) -> Option < LocationKind > {
888888 let mut in_column = false ;
889889 let mut in_column_list = false ;
890890 for ancestor in def_node. ancestors ( ) {
@@ -895,106 +895,106 @@ pub(crate) fn classify_def_node(def_node: &SyntaxNode) -> Option<NameRefClass> {
895895 in_column_list = true ;
896896 }
897897 if ast:: Param :: can_cast ( ancestor. kind ( ) ) {
898- return Some ( NameRefClass :: NamedArgParameter ) ;
898+ return Some ( LocationKind :: NamedArgParameter ) ;
899899 }
900900 if ast:: CreateTableLike :: can_cast ( ancestor. kind ( ) ) {
901901 if in_column {
902- return Some ( NameRefClass :: SelectColumn ) ;
902+ return Some ( LocationKind :: Column ) ;
903903 }
904- return Some ( NameRefClass :: Table ) ;
904+ return Some ( LocationKind :: Table ) ;
905905 }
906906 if ast:: CreateType :: can_cast ( ancestor. kind ( ) ) {
907907 if in_column {
908- return Some ( NameRefClass :: CompositeTypeField ) ;
908+ return Some ( LocationKind :: Column ) ;
909909 }
910- return Some ( NameRefClass :: Type ) ;
910+ return Some ( LocationKind :: Type ) ;
911911 }
912912 if ast:: CreateFunction :: can_cast ( ancestor. kind ( ) ) {
913- return Some ( NameRefClass :: Function ) ;
913+ return Some ( LocationKind :: Function ) ;
914914 }
915915 if ast:: CreateProcedure :: can_cast ( ancestor. kind ( ) ) {
916- return Some ( NameRefClass :: Procedure ) ;
916+ return Some ( LocationKind :: Procedure ) ;
917917 }
918918 if ast:: WithTable :: can_cast ( ancestor. kind ( ) ) {
919919 if in_column_list {
920- return Some ( NameRefClass :: SelectColumn ) ;
920+ return Some ( LocationKind :: Column ) ;
921921 }
922- return Some ( NameRefClass :: Table ) ;
922+ return Some ( LocationKind :: Table ) ;
923923 }
924924 if ast:: CreateTableAs :: can_cast ( ancestor. kind ( ) ) {
925- return Some ( NameRefClass :: Table ) ;
925+ return Some ( LocationKind :: Table ) ;
926926 }
927927 if ast:: CreateIndex :: can_cast ( ancestor. kind ( ) ) {
928- return Some ( NameRefClass :: Index ) ;
928+ return Some ( LocationKind :: Index ) ;
929929 }
930930 if ast:: CreateSequence :: can_cast ( ancestor. kind ( ) ) {
931- return Some ( NameRefClass :: Sequence ) ;
931+ return Some ( LocationKind :: Sequence ) ;
932932 }
933933 if ast:: CreateTrigger :: can_cast ( ancestor. kind ( ) ) {
934- return Some ( NameRefClass :: Trigger ) ;
934+ return Some ( LocationKind :: Trigger ) ;
935935 }
936936 if ast:: CreateEventTrigger :: can_cast ( ancestor. kind ( ) ) {
937- return Some ( NameRefClass :: EventTrigger ) ;
937+ return Some ( LocationKind :: EventTrigger ) ;
938938 }
939939 if ast:: CreateTablespace :: can_cast ( ancestor. kind ( ) ) {
940- return Some ( NameRefClass :: Tablespace ) ;
940+ return Some ( LocationKind :: Tablespace ) ;
941941 }
942942 if ast:: CreateDatabase :: can_cast ( ancestor. kind ( ) ) {
943- return Some ( NameRefClass :: Database ) ;
943+ return Some ( LocationKind :: Database ) ;
944944 }
945945 if ast:: CreateServer :: can_cast ( ancestor. kind ( ) ) {
946- return Some ( NameRefClass :: Server ) ;
946+ return Some ( LocationKind :: Server ) ;
947947 }
948948 if ast:: CreateExtension :: can_cast ( ancestor. kind ( ) ) {
949- return Some ( NameRefClass :: Extension ) ;
949+ return Some ( LocationKind :: Extension ) ;
950950 }
951951 if ast:: CreateRole :: can_cast ( ancestor. kind ( ) ) {
952- return Some ( NameRefClass :: Role ) ;
952+ return Some ( LocationKind :: Role ) ;
953953 }
954954 if ast:: CreateAggregate :: can_cast ( ancestor. kind ( ) ) {
955- return Some ( NameRefClass :: Aggregate ) ;
955+ return Some ( LocationKind :: Aggregate ) ;
956956 }
957957 if ast:: CreateSchema :: can_cast ( ancestor. kind ( ) ) {
958- return Some ( NameRefClass :: Schema ) ;
958+ return Some ( LocationKind :: Schema ) ;
959959 }
960960 if ast:: CreateView :: can_cast ( ancestor. kind ( ) )
961961 || ast:: CreateMaterializedView :: can_cast ( ancestor. kind ( ) )
962962 {
963963 if in_column_list {
964- return Some ( NameRefClass :: SelectColumn ) ;
964+ return Some ( LocationKind :: Column ) ;
965965 }
966- return Some ( NameRefClass :: View ) ;
966+ return Some ( LocationKind :: View ) ;
967967 }
968968 if ast:: CreatePolicy :: can_cast ( ancestor. kind ( ) ) {
969- return Some ( NameRefClass :: Policy ) ;
969+ return Some ( LocationKind :: Policy ) ;
970970 }
971971 if ast:: CreatePropertyGraph :: can_cast ( ancestor. kind ( ) ) {
972- return Some ( NameRefClass :: PropertyGraph ) ;
972+ return Some ( LocationKind :: PropertyGraph ) ;
973973 }
974974 if ast:: Declare :: can_cast ( ancestor. kind ( ) ) {
975- return Some ( NameRefClass :: Cursor ) ;
975+ return Some ( LocationKind :: Cursor ) ;
976976 }
977977 if ast:: Prepare :: can_cast ( ancestor. kind ( ) ) {
978- return Some ( NameRefClass :: PreparedStatement ) ;
978+ return Some ( LocationKind :: PreparedStatement ) ;
979979 }
980980 if ast:: Listen :: can_cast ( ancestor. kind ( ) ) {
981- return Some ( NameRefClass :: Channel ) ;
981+ return Some ( LocationKind :: Channel ) ;
982982 }
983983 if ast:: Alias :: can_cast ( ancestor. kind ( ) ) {
984984 if in_column {
985- return Some ( NameRefClass :: SelectColumn ) ;
985+ return Some ( LocationKind :: Column ) ;
986986 }
987- return Some ( NameRefClass :: FromTable ) ;
987+ return Some ( LocationKind :: Table ) ;
988988 }
989989 if ast:: WindowDef :: can_cast ( ancestor. kind ( ) ) {
990- return Some ( NameRefClass :: Window ) ;
990+ return Some ( LocationKind :: Window ) ;
991991 }
992992 if ast:: AsName :: can_cast ( ancestor. kind ( ) )
993993 || ast:: ParenSelect :: can_cast ( ancestor. kind ( ) )
994994 || ast:: Values :: can_cast ( ancestor. kind ( ) )
995995 || ast:: Select :: can_cast ( ancestor. kind ( ) )
996996 {
997- return Some ( NameRefClass :: SelectColumn ) ;
997+ return Some ( LocationKind :: Column ) ;
998998 }
999999 }
10001000 None
0 commit comments