Hide intrinsic binary operators in alternate mode
This commit is contained in:
		
							parent
							
								
									17e8cf4807
								
							
						
					
					
						commit
						45d381f865
					
				| @ -152,7 +152,7 @@ pub fn perform_all_passes<'map>( | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     println!("{}", &context); |     println!("{:#}", &context); | ||||||
| 
 | 
 | ||||||
|     let state = context.pass(&mut LinkerPass { |     let state = context.pass(&mut LinkerPass { | ||||||
|         module_map, |         module_map, | ||||||
| @ -162,7 +162,7 @@ pub fn perform_all_passes<'map>( | |||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     println!("{:-^100}", "LINKER OUTPUT"); |     println!("{:-^100}", "LINKER OUTPUT"); | ||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     println!("{}", &context); |     println!("{:#}", &context); | ||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     dbg!(&state); |     dbg!(&state); | ||||||
| 
 | 
 | ||||||
| @ -202,7 +202,7 @@ pub fn perform_all_passes<'map>( | |||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     println!("{:-^100}", "TYPECHECKER OUTPUT"); |     println!("{:-^100}", "TYPECHECKER OUTPUT"); | ||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     println!("{}", &context); |     println!("{:#}", &context); | ||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     dbg!(&state); |     dbg!(&state); | ||||||
| 
 | 
 | ||||||
| @ -243,7 +243,7 @@ pub fn compile_and_pass<'map>( | |||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     println!("{:-^100}", "FINAL OUTPUT"); |     println!("{:-^100}", "FINAL OUTPUT"); | ||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     println!("{}", &mir_context); |     println!("{:#}", &mir_context); | ||||||
| 
 | 
 | ||||||
|     let mut context = Context::new(format!("Reid ({})", env!("CARGO_PKG_VERSION"))); |     let mut context = Context::new(format!("Reid ({})", env!("CARGO_PKG_VERSION"))); | ||||||
|     let codegen_modules = match mir_context.codegen(&mut context) { |     let codegen_modules = match mir_context.codegen(&mut context) { | ||||||
|  | |||||||
| @ -15,6 +15,8 @@ impl Display for Context { | |||||||
| 
 | 
 | ||||||
| impl Display for Module { | impl Display for Module { | ||||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|  |         let is_alternate = f.alternate(); | ||||||
|  | 
 | ||||||
|         writeln!(f, "Module({}) ({}) {{", self.name, self.module_id)?; |         writeln!(f, "Module({}) ({}) {{", self.name, self.module_id)?; | ||||||
| 
 | 
 | ||||||
|         let mut state = Default::default(); |         let mut state = Default::default(); | ||||||
| @ -23,9 +25,27 @@ impl Display for Module { | |||||||
|         for import in &self.imports { |         for import in &self.imports { | ||||||
|             writeln!(inner_f, "{}", import)?; |             writeln!(inner_f, "{}", import)?; | ||||||
|         } |         } | ||||||
|         for binop in &self.binop_defs { | 
 | ||||||
|  |         let intrinsic_binops = self | ||||||
|  |             .binop_defs | ||||||
|  |             .iter() | ||||||
|  |             .filter(|b| matches!(b.fn_kind, FunctionDefinitionKind::Intrinsic(_))); | ||||||
|  | 
 | ||||||
|  |         for binop in self | ||||||
|  |             .binop_defs | ||||||
|  |             .iter() | ||||||
|  |             .filter(|b| !matches!(b.fn_kind, FunctionDefinitionKind::Intrinsic(_))) | ||||||
|  |         { | ||||||
|             writeln!(inner_f, "{}", binop)?; |             writeln!(inner_f, "{}", binop)?; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         if is_alternate { | ||||||
|  |             writeln!(inner_f, "... <{}> intrinsic binary operators", intrinsic_binops.count())?; | ||||||
|  |         } else { | ||||||
|  |             for binop in intrinsic_binops { | ||||||
|  |                 writeln!(inner_f, "{}", binop)?; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|         for typedef in &self.typedefs { |         for typedef in &self.typedefs { | ||||||
|             writeln!(inner_f, "{}", typedef)?; |             writeln!(inner_f, "{}", typedef)?; | ||||||
|         } |         } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user