[][src]Enum oakc::mir::MirError

pub enum MirError {
    FunctionNotDefined(Identifier),
    StructureRedefined(Identifier),
    PrimitiveTypeRedefined(Identifier),
    FunctionRedefined(Identifier),
    VariableNotDefined(Identifier),
    MethodRedefined(MirTypeIdentifier),
    MethodNotDefined(MirTypeIdentifier),
    StructureNotDefined(Identifier),
    DereferenceNonPointer(MirType),
    IndexVoidPointer(MirExpression),
    AutoDefineVoidPointer(StringMirExpression),
    DefineMismatchedType(String),
    AssignMismatchedType(MirExpression),
    ArgumentMismatchedType(MirExpression),
    FreeNonPointer(MirExpression),
    NonBooleanCondition(MirExpression),
    NonNumberAllocate(MirExpression),
    NonNumberIndex(MirExpression),
    NonNumberBinaryOperation(MirExpressionMirExpression),
    NonNumberUnaryOperation(MirExpression),
    NotEnoughArguments(MirExpression),
    TooManyArguments(MirExpression),
    CalledFunctionAsMethod(String),
    MismatchedReturnType(String),
    MultipleReturns(String),
    NonVoidExpressionNotUsed(MirExpression),
    MismatchedCastSize(MirExpressionMirType),
    OnlyOneBranchReturns(String),
    IfReturns(String),
    LoopReturns(String),
    NonVoidNoReturn(String),
    MethodOnUnboundCopyDrop(MirExpression),
    MismatchedConditionalBranchTypes(MirExpressionMirExpression),
}

A value representing an error while assembling the MIR code

Variants

FunctionNotDefined(Identifier)

Calling a function without defining it

StructureRedefined(Identifier)

Defining a type multiple times

PrimitiveTypeRedefined(Identifier)

Defining a structure with the name of a primitive type

FunctionRedefined(Identifier)

Defining a function multiple times

VariableNotDefined(Identifier)

Using a variable without defining it

MethodRedefined(MirTypeIdentifier)

Defining a method multiple times for a type

MethodNotDefined(MirTypeIdentifier)

Calling a method for a type where it is not defined

StructureNotDefined(Identifier)

Using a structure name as a type without defining it If this were acceptable, the compiler would never know the size of the variable.

DereferenceNonPointer(MirType)

Dereferencing a non-pointer value

IndexVoidPointer(MirExpression)

Indexing a void pointer This is inherently bad because void pointers have size zero. Indexing them is the same as dereferencing, but less efficient.

AutoDefineVoidPointer(StringMirExpression)

Auto define a void pointer This is less of a type error itself and more of a safety net. Variables that hold the result of alloc must be the proper type for expressions like ptr[n] to work.

DefineMismatchedType(String)

Mismatched types in a let statement

AssignMismatchedType(MirExpression)

Mismatched types in an assignment statement

ArgumentMismatchedType(MirExpression)

Arguments to a function call do not match parameter types

FreeNonPointer(MirExpression)

Use a free statement using an address argument of a non-pointer type

NonBooleanCondition(MirExpression)

Using a non-boolean expression for an if statement, and if-else statement, a while loop, or a for loop

NonNumberAllocate(MirExpression)

Using a non-number for an alloc call

NonNumberIndex(MirExpression)

Indexing an array with a non-number value

NonNumberBinaryOperation(MirExpressionMirExpression)

Adding, subtracting, multiplying, or dividing two values where one or more of them is not a number.

NonNumberUnaryOperation(MirExpression)

Using the not operator or other unary operator on a non-number value.

NotEnoughArguments(MirExpression)

Calling a function without enough arguments

TooManyArguments(MirExpression)

Calling a function with too many arguments

CalledFunctionAsMethod(String)

Calling an associated function, such as a constructor, as a method

MismatchedReturnType(String)

The return type of the function does not match the result of the function

MultipleReturns(String)

A function attempts to use multiple return statements

NonVoidExpressionNotUsed(MirExpression)

An expression with non-void type is pushed onto the stack without being used by another expression or statement.

MismatchedCastSize(MirExpressionMirType)

A bad typecast due to mismatched sizes in types. For example, a value with size 3 cannot be cast to a number with size 1

OnlyOneBranchReturns(String)

Only one branch of an if-else statement returns in a function

IfReturns(String)

A single branch if-statement uses a return

LoopReturns(String)

Return statement used in a loop in a function

NonVoidNoReturn(String)

A non-void function never returns

MethodOnUnboundCopyDrop(MirExpression)

Prevent memory leaks by preventing the user from calling methods on objects that will not be dropped

MismatchedConditionalBranchTypes(MirExpressionMirExpression)

The branches of a conditional expression have different types

Trait Implementations

impl Clone for MirError[src]

impl Debug for MirError[src]

impl Display for MirError[src]

Print an MIR error on the command line

impl PartialEq<MirError> for MirError[src]

impl PartialOrd<MirError> for MirError[src]

impl StructuralPartialEq for MirError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Colorize for T where
    T: Display
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.