Skip to content

Commit

Permalink
Better naming in modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercerenies committed Oct 26, 2022
1 parent ea1a6b1 commit 31450c8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ir/modifier/instance_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ use super::{ParseRule, Several, Constant};

/// Modifier for [`ClassFnDecl`].
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum FnMod { // TODO Change the name so it doesn't match the name from super::function
pub enum MethodMod {
/// `static` declarations allow the instance method to be called
/// without an instance of the class available.
Static,
}

impl FnMod {
impl MethodMod {

/// Apply the modifier to an instance function declaration.
pub fn apply(&self, decl: &mut ClassFnDecl) {
match self {
FnMod::Static => {
MethodMod::Static => {
decl.is_static = Static::IsStatic;
}
}
Expand All @@ -31,16 +31,16 @@ impl FnMod {
/// attempt is made to do so.
pub fn apply_to_constructor(&self, decl: &mut ConstructorDecl) -> Result<(), GDError> {
match self {
FnMod::Static => {
MethodMod::Static => {
Err(GDError::new(GDErrorF::StaticConstructor, decl.body.pos))
}
}
}
}

/// Parse rule for `FnMod`.
pub fn parser() -> impl ParseRule<Modifier=FnMod> {
/// Parse rule for `MethodMod`.
pub fn parser() -> impl ParseRule<Modifier=MethodMod> {
Several::new(vec!(
Box::new(Constant::new("static", FnMod::Static).unique())
Box::new(Constant::new("static", MethodMod::Static).unique())
))
}

0 comments on commit 31450c8

Please sign in to comment.