File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11use rustc_hash:: FxHashMap as HashMap ;
2+ use rustc_hash:: FxHashSet as HashSet ;
23use crate :: lexer:: { ParseError , SrcPos } ;
34use crate :: ast:: * ;
45
@@ -183,6 +184,48 @@ impl Program
183184 // Set the number of globals
184185 self . num_globals = env. next_global_idx ;
185186
187+
188+
189+
190+ // Note: we need to make sure that there's no cycle
191+ // Might be simpler to do a DFS from each class?
192+ // We can keep track of which classes have already been processed
193+
194+ let mut processed = HashSet :: < ClassId > :: default ( ) ;
195+
196+
197+
198+
199+
200+
201+ /*
202+ // Set of classes to be processed
203+ let mut classes: HashSet<ClassId> = self.classes.keys().cloned().collect();
204+
205+ // Until we've processed all classes for inheritance
206+ for class_id in &classes.clone() {
207+
208+ let class = &self.classes[class_id];
209+
210+ // If a class has no parent, skip it
211+ if class.parent_id == ClassId::default() {
212+ classes.remove(class_id);
213+ continue;
214+ }
215+
216+ // Wait until the parent of this class has been processed
217+ if classes.contains(&class.parent_id) {
218+ continue;
219+ }
220+ }
221+ */
222+
223+
224+
225+
226+
227+
228+
186229 Ok ( ( ) )
187230 }
188231}
You can’t perform that action at this time.
0 commit comments