luaur_analysis/records/
cannot_infer_binary_operation.rs1use crate::enums::op_kind::OpKind;
2use alloc::string::String;
3use luaur_ast::records::ast_expr_binary::AstExprBinary_Op;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub struct CannotInferBinaryOperation {
7 pub(crate) op: AstExprBinary_Op,
8 pub(crate) suggested_to_annotate: Option<String>,
9 pub(crate) kind: OpKind,
10}
11
12impl core::hash::Hash for CannotInferBinaryOperation {
13 fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
14 (self.op as i32).hash(state);
15 self.suggested_to_annotate.hash(state);
16 self.kind.hash(state);
17 }
18}
19
20#[allow(non_snake_case)]
21impl CannotInferBinaryOperation {
22 pub fn op(&self) -> AstExprBinary_Op {
23 self.op
24 }
25
26 pub fn suggestedToAnnotate(&self) -> Option<&str> {
27 self.suggested_to_annotate.as_deref()
28 }
29
30 pub fn kind(&self) -> OpKind {
31 self.kind
32 }
33}
34
35impl CannotInferBinaryOperation {
36 pub const fn new(
37 op: AstExprBinary_Op,
38 suggested_to_annotate: Option<String>,
39 kind: OpKind,
40 ) -> Self {
41 Self {
42 op,
43 suggested_to_annotate,
44 kind,
45 }
46 }
47}