Fix warnings and issues
This commit is contained in:
		
							parent
							
								
									023d3b75b6
								
							
						
					
					
						commit
						ea8a833bdf
					
				| @ -1,9 +1,9 @@ | |||||||
| // Arithmetic, function calls and imports! | // Arithmetic, function calls and imports! | ||||||
| 
 | 
 | ||||||
| pub fn OneHalf(var1: f32) -> f32 { | pub fn test() -> u8 { | ||||||
|   return var1 * 1.5; |   return 5; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| pub fn main() -> bool { | pub fn main() -> bool { | ||||||
|   return 7.5 > 5.001; |   return 7.5 > (test() as f16); | ||||||
| } | } | ||||||
|  | |||||||
| @ -61,5 +61,5 @@ fn main() { | |||||||
| 
 | 
 | ||||||
|     dbg!(&context); |     dbg!(&context); | ||||||
| 
 | 
 | ||||||
|     context.compile(); |     context.compile(None, Vec::new()); | ||||||
| } | } | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ use std::{ | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| use llvm_sys::{ | use llvm_sys::{ | ||||||
|     LLVMAttributeIndex, LLVMIntPredicate, LLVMLinkage, LLVMRealPredicate, LLVMValueKind, |     LLVMIntPredicate, LLVMLinkage, LLVMRealPredicate, LLVMValueKind, | ||||||
|     analysis::LLVMVerifyModule, |     analysis::LLVMVerifyModule, | ||||||
|     core::*, |     core::*, | ||||||
|     debuginfo::*, |     debuginfo::*, | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| use std::{cell::RefCell, collections::hash_map::Values, rc::Rc}; | use std::{cell::RefCell, rc::Rc}; | ||||||
| 
 | 
 | ||||||
| use crate::builder::InstructionValue; | use crate::builder::InstructionValue; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -6,8 +6,8 @@ use reid_lib::{ | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| use crate::mir::{ | use crate::mir::{ | ||||||
|     self, CustomTypeKey, FunctionCall, FunctionDefinition, FunctionDefinitionKind, IfExpression, |     self, CustomTypeKey, FunctionCall, FunctionDefinitionKind, IfExpression, SourceModuleId, | ||||||
|     SourceModuleId, TypeDefinition, TypeKind, WhileStatement, |     TypeKind, WhileStatement, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug)] | #[derive(Debug)] | ||||||
|  | |||||||
| @ -8,8 +8,6 @@ use crate::{ | |||||||
|     }, |     }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| use super::TypeKind; |  | ||||||
| 
 |  | ||||||
| impl mir::Context { | impl mir::Context { | ||||||
|     pub fn from(modules: Vec<mir::Module>, base: PathBuf) -> mir::Context { |     pub fn from(modules: Vec<mir::Module>, base: PathBuf) -> mir::Context { | ||||||
|         let mut map = ModuleMap::new(); |         let mut map = ModuleMap::new(); | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| use std::{cell::RefCell, collections::HashMap, hash::Hash, mem, rc::Rc}; | use std::{cell::RefCell, collections::HashMap, mem, rc::Rc}; | ||||||
| 
 | 
 | ||||||
| use reid_lib::{ | use reid_lib::{ | ||||||
|     builder::{InstructionValue, TypeValue}, |     builder::{InstructionValue, TypeValue}, | ||||||
|  | |||||||
| @ -2,42 +2,9 @@ use reid_lib::{builder::InstructionValue, Instr}; | |||||||
| 
 | 
 | ||||||
| use crate::{ | use crate::{ | ||||||
|     codegen::{ErrorKind, Scope, StackValue, StackValueKind}, |     codegen::{ErrorKind, Scope, StackValue, StackValueKind}, | ||||||
|     mir::{BinaryOperator, BinopDefinition, FunctionDefinition, FunctionDefinitionKind, TypeKind}, |     mir::{BinopDefinition, FunctionDefinition, TypeKind}, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| fn intrinsic( |  | ||||||
|     name: &str, |  | ||||||
|     ret_ty: TypeKind, |  | ||||||
|     params: Vec<(&str, TypeKind)>, |  | ||||||
|     fun: impl IntrinsicFunction + 'static, |  | ||||||
| ) -> FunctionDefinition { |  | ||||||
|     FunctionDefinition { |  | ||||||
|         name: name.into(), |  | ||||||
|         is_pub: false, |  | ||||||
|         is_imported: false, |  | ||||||
|         return_type: ret_ty, |  | ||||||
|         parameters: params.into_iter().map(|(n, ty)| (n.into(), ty)).collect(), |  | ||||||
|         kind: FunctionDefinitionKind::Intrinsic(Box::new(fun)), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| fn intrinsic_binop( |  | ||||||
|     op: BinaryOperator, |  | ||||||
|     lhs: TypeKind, |  | ||||||
|     rhs: TypeKind, |  | ||||||
|     ret_ty: TypeKind, |  | ||||||
|     fun: impl IntrinsicFunction + 'static, |  | ||||||
| ) -> BinopDefinition { |  | ||||||
|     BinopDefinition { |  | ||||||
|         lhs: ("lhs".to_string(), lhs), |  | ||||||
|         op, |  | ||||||
|         rhs: ("rhs".to_owned(), rhs), |  | ||||||
|         return_type: ret_ty, |  | ||||||
|         fn_kind: FunctionDefinitionKind::Intrinsic(Box::new(fun)), |  | ||||||
|         meta: Default::default(), |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| pub fn form_intrinsics() -> Vec<FunctionDefinition> { | pub fn form_intrinsics() -> Vec<FunctionDefinition> { | ||||||
|     let intrinsics = Vec::new(); |     let intrinsics = Vec::new(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,8 +1,4 @@ | |||||||
| use std::{ | use std::{fmt::Debug, ops::AddAssign, str::Chars}; | ||||||
|     fmt::Debug, |  | ||||||
|     ops::{Add, AddAssign}, |  | ||||||
|     str::Chars, |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| static BINARY_NUMERICS: &[char] = &['0', '1']; | static BINARY_NUMERICS: &[char] = &['0', '1']; | ||||||
| static OCTAL_NUMERICS: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7']; | static OCTAL_NUMERICS: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7']; | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| //! This module contains relevant code for [`Pass`] and shared code between
 | //! This module contains relevant code for [`Pass`] and shared code between
 | ||||||
| //! passes. Passes can be performed on Reid MIR to e.g. typecheck the code.
 | //! passes. Passes can be performed on Reid MIR to e.g. typecheck the code.
 | ||||||
| 
 | 
 | ||||||
| use std::collections::{HashMap, HashSet}; | use std::collections::HashMap; | ||||||
| use std::convert::Infallible; | use std::convert::Infallible; | ||||||
| use std::error::Error as STDError; | use std::error::Error as STDError; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ use std::{ | |||||||
| use crate::{mir::TypeKind, util::try_all}; | use crate::{mir::TypeKind, util::try_all}; | ||||||
| 
 | 
 | ||||||
| use super::{ | use super::{ | ||||||
|     pass::{self, Pass, PassResult, PassState, ScopeBinopDef, ScopeBinopKey}, |     pass::{Pass, PassResult, PassState, ScopeBinopKey}, | ||||||
|     typecheck::{ErrorKind, ErrorTypedefKind}, |     typecheck::{ErrorKind, ErrorTypedefKind}, | ||||||
|     typerefs::{ScopeTypeRefs, TypeRef, TypeRefs}, |     typerefs::{ScopeTypeRefs, TypeRef, TypeRefs}, | ||||||
|     BinopDefinition, Block, CustomTypeKey, ExprKind, Expression, FunctionDefinition, |     BinopDefinition, Block, CustomTypeKey, ExprKind, Expression, FunctionDefinition, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user