MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / enum_variant

Method enum_variant

aiscript-vm/src/parser/mod.rs:439–457  ·  view source on GitHub ↗
(&mut self, _can_assign: bool)

Source from the content-addressed store, hash-verified

437 }
438
439 fn enum_variant(&mut self, _can_assign: bool) -> Option<Expr<'gc>> {
440 // The enum name is in previous_expr since this is an infix operator
441 let enum_name = match &self.previous_expr.take()? {
442 Expr::Variable { name, .. } => *name,
443 _ => {
444 self.error("Expected enum name before '::'.");
445 return None;
446 }
447 };
448
449 self.consume(TokenType::Identifier, "Expect variant name after '::'.");
450 let variant = self.previous;
451
452 Some(Expr::EnumVariant {
453 enum_name,
454 variant,
455 line: variant.line,
456 })
457 }
458
459 fn class_declaration(&mut self, visibility: Visibility) -> Option<Stmt<'gc>> {
460 self.consume_either(

Callers

nothing calls this directly

Calls 2

errorMethod · 0.45
consumeMethod · 0.45

Tested by

no test coverage detected