got some basics working!
This commit is contained in:
@@ -43,6 +43,11 @@ pub enum BackendError {
|
||||
InvalidTypeCast { from: PrimitiveType, to: Type },
|
||||
#[error("Unknown string constant '{0}")]
|
||||
UnknownString(ArcIntern<String>),
|
||||
#[error("Compiler doesn't currently support function arguments")]
|
||||
NoFunctionArguments {
|
||||
function_name: String,
|
||||
argument_name: String,
|
||||
},
|
||||
}
|
||||
|
||||
impl From<BackendError> for Diagnostic<usize> {
|
||||
@@ -73,6 +78,13 @@ impl From<BackendError> for Diagnostic<usize> {
|
||||
),
|
||||
BackendError::UnknownString(str) => Diagnostic::error()
|
||||
.with_message(format!("Unknown string found trying to compile: '{}'", str)),
|
||||
BackendError::NoFunctionArguments {
|
||||
function_name,
|
||||
argument_name,
|
||||
} => Diagnostic::error().with_message(format!(
|
||||
"Function {} takes a function argument ({}), which is not supported",
|
||||
function_name, argument_name
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,6 +140,17 @@ impl PartialEq for BackendError {
|
||||
BackendError::UnknownString(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
BackendError::NoFunctionArguments {
|
||||
function_name: f1,
|
||||
argument_name: a1,
|
||||
} => match other {
|
||||
BackendError::NoFunctionArguments {
|
||||
function_name: f2,
|
||||
argument_name: a2,
|
||||
} => f1 == f2 && a1 == a2,
|
||||
_ => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user