Skip to content

Commit

Permalink
type_instantiation: Remove check of is_primitive() in execution context
Browse files Browse the repository at this point in the history
  • Loading branch information
CohenArthur committed Feb 26, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent ef7ebab commit f229969
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/instruction/type_instantiation.rs
Original file line number Diff line number Diff line change
@@ -77,18 +77,6 @@ impl TypeInstantiation {
}
}

/// Check if the type we're currently instantiating is a primitive type or not
// FIXME: Remove later, as it should not be needed once typechecking is implemented
fn check_primitive(&self) -> Result<(), Error> {
match self.type_name.is_primitive() {
true => Err(Error::new(ErrKind::Context).with_msg(format!(
"cannot instantiate primitive type `{}`",
self.type_name.id()
))),
false => Ok(()),
}
}

pub fn set_generics(&mut self, generics: Vec<TypeId>) {
self.generics = generics
}
@@ -120,11 +108,6 @@ impl Instruction for TypeInstantiation {
}

fn execute(&self, ctx: &mut Context) -> Option<ObjectInstance> {
if let Err(e) = self.check_primitive() {
ctx.error(e);
return None;
}

let type_dec = self.get_declaration(ctx)?;

if let Err(e) = self.check_fields_count(&type_dec) {

0 comments on commit f229969

Please sign in to comment.