File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
clarity/src/vm/analysis/type_checker Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,25 @@ impl TypeMap {
86
86
}
87
87
}
88
88
89
+ /// Like set_type but forcing a change if already set
90
+ pub fn override_type ( & mut self , expr : & SymbolicExpression , type_sig : TypeSignature ) {
91
+ match self . map {
92
+ TypeMapDataType :: Map ( ref mut map) => {
93
+ map. insert ( expr. id , type_sig) ;
94
+ }
95
+ TypeMapDataType :: Set ( ref mut map) => {
96
+ map. insert ( expr. id ) ;
97
+ }
98
+ }
99
+ }
100
+
101
+ pub fn get_type ( & self , expr : & SymbolicExpression ) -> Option < & TypeSignature > {
102
+ match self . map {
103
+ TypeMapDataType :: Map ( ref map) => map. get ( & expr. id ) ,
104
+ _ => None ,
105
+ }
106
+ }
107
+
89
108
pub fn get_type_expected ( & self , expr : & SymbolicExpression ) -> Option < & TypeSignature > {
90
109
match self . map {
91
110
TypeMapDataType :: Map ( ref map) => map. get ( & expr. id ) ,
You can’t perform that action at this time.
0 commit comments