use thiserror::Error;
#[derive(Error, Debug)]
pub enum BuildHIRError {
#[error(
"Variable declarations must be `let` or `const`, `var` declarations are not supported"
)]
VariableDeclarationKindIsVar,
#[error("Invariant: Expected variable declaration to declare a fresh binding")]
VariableDeclarationBindingIsNonLocal,
#[error("`for` statements must have an initializer, eg `for (**let i = 0**; ...)`")]
ForStatementIsMissingInitializer,
#[error(
"`for` statements must have a test condition, eg `for (let i = 0; **i < count**; ...)`"
)]
ForStatementIsMissingTest,
#[error("Invariant: Expected an expression node")]
NonExpressionInExpressionPosition,
#[error("React functions may not reassign variables defined outside of the component or hook")]
ReassignedGlobal,
#[error("Could not resolve a target for `break` statement")]
UnresolvedBreakTarget,
#[error("Could not resolve a target for `continue` statement")]
UnresolvedContinueTarget,
#[error("Labeled `continue` statements must use the label of a loop statement")]
ContinueTargetIsNotALoop,
#[error("Invariant: Identifier was not resolved (did name resolution run successfully?)")]
UnknownIdentifier,
#[error("Expected function to have a body")]
EmptyFunction,
#[error("`super` is not suppported")]
UnsupportedSuperExpression,
}