Fix some warnings, remove unused code
This commit is contained in:
		
							parent
							
								
									1eb3e8c095
								
							
						
					
					
						commit
						79c98a18f7
					
				| @ -512,11 +512,6 @@ impl mir::Expression { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| pub enum IndexKind { | ||||
|     Array(u32), | ||||
|     Struct(u32), | ||||
| } | ||||
| 
 | ||||
| impl IndexedVariableReference { | ||||
|     fn get_stack_value(&self, scope: &mut Scope, load_after_gep: bool) -> Option<StackValue> { | ||||
|         match &self.kind { | ||||
|  | ||||
| @ -13,9 +13,8 @@ use super::{ | ||||
|     typecheck::ErrorKind, | ||||
|     typerefs::{ScopeTypeRefs, TypeRef, TypeRefs}, | ||||
|     types::{pick_return, ReturnType}, | ||||
|     Block, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind, IfExpression, | ||||
|     IndexedVariableReference, IndexedVariableReferenceKind, Module, NamedVariableRef, ReturnKind, | ||||
|     StmtKind, TypeDefinitionKind, | ||||
|     Block, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind, IfExpression, Module, | ||||
|     ReturnKind, StmtKind, | ||||
|     TypeKind::*, | ||||
|     VagueType::*, | ||||
| }; | ||||
| @ -148,61 +147,6 @@ impl Block { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl IndexedVariableReference { | ||||
|     fn find_hint<'s>( | ||||
|         &self, | ||||
|         state: &PassState<ErrorKind>, | ||||
|         hints: &'s ScopeTypeRefs, | ||||
|     ) -> Result<Option<(bool, TypeRef<'s>)>, ErrorKind> { | ||||
|         match &self.kind { | ||||
|             IndexedVariableReferenceKind::Named(NamedVariableRef(_, name, _)) => { | ||||
|                 Ok(hints.find_var(&name)) | ||||
|             } | ||||
|             IndexedVariableReferenceKind::ArrayIndex(inner, _) => { | ||||
|                 if let Some((mutable, inner_ref)) = inner.find_hint(state, hints)? { | ||||
|                     // Check that the resolved type is at least an array, no
 | ||||
|                     // need for further resolution.
 | ||||
|                     let inner_ty = inner_ref.resolve_weak().unwrap(); | ||||
|                     match inner_ty { | ||||
|                         Array(type_kind, _) => Ok(hints | ||||
|                             .from_type(&type_kind) | ||||
|                             .clone() | ||||
|                             .map(|t_ref| (mutable, t_ref))), | ||||
|                         _ => Err(ErrorKind::TriedIndexingNonArray(inner_ty.clone())), | ||||
|                     } | ||||
|                 } else { | ||||
|                     Ok(None) | ||||
|                 } | ||||
|             } | ||||
|             IndexedVariableReferenceKind::StructIndex(inner, field_name) => { | ||||
|                 if let Some((mutable, inner_ref)) = inner.find_hint(state, hints)? { | ||||
|                     // Check that the resolved type is at least an array, no
 | ||||
|                     // need for further resolution.
 | ||||
|                     let inner_ty = inner_ref.resolve_weak().unwrap(); | ||||
|                     match &inner_ty { | ||||
|                         CustomType(struct_name) => match state.scope.types.get(&struct_name) { | ||||
|                             Some(kind) => match kind { | ||||
|                                 TypeDefinitionKind::Struct(struct_ty) => Ok(hints | ||||
|                                     .from_type( | ||||
|                                         &struct_ty | ||||
|                                             .get_field_ty(field_name) | ||||
|                                             .cloned() | ||||
|                                             .ok_or(ErrorKind::NoSuchField(self.get_name()))?, | ||||
|                                     ) | ||||
|                                     .map(|v| (mutable, v))), | ||||
|                             }, | ||||
|                             None => Err(ErrorKind::TriedAccessingNonStruct(inner_ty.clone())), | ||||
|                         }, | ||||
|                         _ => Err(ErrorKind::TriedAccessingNonStruct(inner_ty)), | ||||
|                     } | ||||
|                 } else { | ||||
|                     Ok(None) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl Expression { | ||||
|     fn infer_types<'s>( | ||||
|         &mut self, | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| use super::{ | ||||
|     typecheck::{Collapsable, ErrorKind}, | ||||
|     typecheck::ErrorKind, | ||||
|     typerefs::{ScopeTypeRefs, TypeRef, TypeRefs}, | ||||
|     VagueType as Vague, *, | ||||
| }; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user