use std::convert::TryInto;
use crate::{top_level::CodeGenContext, typecheck::typedef::Type};
use inkwell::{
types::BasicTypeEnum,
values::{BasicValueEnum, PointerValue},
};
use rustpython_parser::ast::{Expr, ExprKind, Stmt, StmtKind};
impl<'ctx> CodeGenContext<'ctx> {
fn gen_var(&mut self, ty: Type) -> PointerValue<'ctx> {
let ty = self.get_llvm_type(ty);
let ty = if let BasicTypeEnum::PointerType(ty) = ty {
ty.get_element_type().try_into().unwrap()
} else {
ty
};
self.builder.build_alloca(ty, "tmp")
}
fn parse_pattern(&mut self, pattern: &Expr