@@ -8,13 +8,21 @@ use std::hash::Hash;
88use base:: charset:: { subscript_char, superscript_char, Script } ;
99use base:: prelude:: * ;
1010
11- use super :: eval:: { RcBlock , SymbolContext , SymbolDefinition , SymbolUse } ;
11+ use super :: eval:: RcBlock ;
1212use super :: glyph;
1313use super :: span:: * ;
1414use super :: state:: NumeralMode ;
15- use super :: symbol:: { SymbolName , SymbolOrHere } ;
15+ use super :: symbol:: { SymbolContext , SymbolName , SymbolOrHere } ;
16+ use super :: symtab:: SymbolDefinition ;
1617use super :: types:: * ;
1718
19+ #[ derive( Debug , PartialEq , Eq , Clone ) ]
20+ enum SymbolUse {
21+ Reference ( SymbolContext ) ,
22+ Definition ( SymbolDefinition ) ,
23+ Origin ( SymbolName , BlockIdentifier ) ,
24+ }
25+
1826pub ( crate ) trait RcAllocator {
1927 fn allocate ( & mut self , span : Span , value : Unsigned36Bit ) -> Address ;
2028}
@@ -170,7 +178,7 @@ impl ArithmeticExpression {
170178 ArithmeticExpression { first, tail }
171179 }
172180
173- pub ( crate ) fn symbol_uses (
181+ fn symbol_uses (
174182 & self ,
175183 block_id : BlockIdentifier ,
176184 block_offset : Unsigned18Bit ,
@@ -251,7 +259,7 @@ pub(crate) enum ConfigValue {
251259}
252260
253261impl ConfigValue {
254- pub ( crate ) fn symbol_uses ( & self ) -> impl Iterator < Item = ( SymbolName , Span , SymbolUse ) > {
262+ fn symbol_uses ( & self ) -> impl Iterator < Item = ( SymbolName , Span , SymbolUse ) > {
255263 match self {
256264 ConfigValue :: Literal ( _span, _value) => None ,
257265 ConfigValue :: Symbol ( _span, SymbolOrHere :: Here ) => None ,
@@ -288,7 +296,7 @@ impl From<SymbolOrLiteral> for Atom {
288296}
289297
290298impl Atom {
291- pub ( crate ) fn symbol_uses (
299+ fn symbol_uses (
292300 & self ,
293301 block_id : BlockIdentifier ,
294302 block_offset : Unsigned18Bit ,
@@ -408,7 +416,7 @@ pub(crate) enum SymbolOrLiteral {
408416}
409417
410418impl SymbolOrLiteral {
411- pub ( crate ) fn symbol_uses ( & self ) -> impl Iterator < Item = ( SymbolName , Span , SymbolUse ) > {
419+ fn symbol_uses ( & self ) -> impl Iterator < Item = ( SymbolName , Span , SymbolUse ) > {
412420 let mut result: Vec < ( SymbolName , Span , SymbolUse ) > = Vec :: with_capacity ( 1 ) ;
413421 match self {
414422 SymbolOrLiteral :: Literal ( _) => ( ) ,
@@ -445,7 +453,7 @@ pub(crate) enum InstructionFragment {
445453}
446454
447455impl InstructionFragment {
448- pub ( crate ) fn symbol_uses (
456+ fn symbol_uses (
449457 & self ,
450458 block_id : BlockIdentifier ,
451459 block_offset : Unsigned18Bit ,
@@ -572,7 +580,7 @@ impl Octal for Origin {
572580}
573581
574582impl Origin {
575- pub ( crate ) fn symbol_uses (
583+ fn symbol_uses (
576584 & self ,
577585 block_id : BlockIdentifier ,
578586 ) -> impl Iterator < Item = ( SymbolName , Span , SymbolUse ) > {
@@ -637,7 +645,7 @@ impl CommaDelimitedInstruction {
637645 }
638646 }
639647
640- pub ( crate ) fn symbol_uses (
648+ fn symbol_uses (
641649 & self ,
642650 block_id : BlockIdentifier ,
643651 block_offset : Unsigned18Bit ,
@@ -683,7 +691,7 @@ pub(crate) struct UntaggedProgramInstruction {
683691}
684692
685693impl UntaggedProgramInstruction {
686- pub ( crate ) fn symbol_uses (
694+ fn symbol_uses (
687695 & self ,
688696 block_id : BlockIdentifier ,
689697 block_offset : Unsigned18Bit ,
@@ -703,7 +711,7 @@ pub(crate) struct Tag {
703711}
704712
705713impl Tag {
706- pub ( crate ) fn symbol_uses (
714+ fn symbol_uses (
707715 & self ,
708716 block_id : BlockIdentifier ,
709717 block_offset : Unsigned18Bit ,
@@ -728,7 +736,7 @@ pub(crate) struct TaggedProgramInstruction {
728736}
729737
730738impl TaggedProgramInstruction {
731- pub ( crate ) fn symbol_uses (
739+ fn symbol_uses (
732740 & self ,
733741 block_id : BlockIdentifier ,
734742 offset : Unsigned18Bit ,
@@ -798,7 +806,7 @@ pub(crate) struct SourceFile {
798806}
799807
800808impl SourceFile {
801- pub ( crate ) fn symbol_uses ( & self ) -> impl Iterator < Item = ( SymbolName , Span , SymbolUse ) > + ' _ {
809+ fn symbol_uses ( & self ) -> impl Iterator < Item = ( SymbolName , Span , SymbolUse ) > + ' _ {
802810 self . blocks
803811 . iter ( )
804812 . flat_map ( |( block_id, block) | block. symbol_uses ( * block_id) )
@@ -882,7 +890,7 @@ impl Statement {
882890 }
883891 }
884892
885- pub ( crate ) fn symbol_uses (
893+ fn symbol_uses (
886894 & self ,
887895 block_id : BlockIdentifier ,
888896 offset : Unsigned18Bit ,
@@ -959,7 +967,7 @@ pub(crate) struct ManuscriptBlock {
959967}
960968
961969impl ManuscriptBlock {
962- pub ( crate ) fn symbol_uses (
970+ fn symbol_uses (
963971 & self ,
964972 block_id : BlockIdentifier ,
965973 ) -> impl Iterator < Item = ( SymbolName , Span , SymbolUse ) > {
0 commit comments