|
|
|
@ -2,6 +2,7 @@ module tlang.compiler.typecheck.dependency.exceptions;
|
|
|
|
|
|
|
|
|
|
import tlang.misc.exceptions : TError;
|
|
|
|
|
import std.conv : to;
|
|
|
|
|
import std.string : format;
|
|
|
|
|
|
|
|
|
|
// FIXME: Extend TError rather than Exception
|
|
|
|
|
public enum DependencyError
|
|
|
|
@ -25,4 +26,34 @@ public final class DependencyException : TError
|
|
|
|
|
{
|
|
|
|
|
return errTye;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* An access violation occurs when you
|
|
|
|
|
* try to access one entity from an
|
|
|
|
|
* environment that doesn't allow
|
|
|
|
|
* for that due to the access rights
|
|
|
|
|
* of the referent entity
|
|
|
|
|
*/
|
|
|
|
|
public final class AccessViolation : TError
|
|
|
|
|
{
|
|
|
|
|
import tlang.compiler.symbols.data : Entity, Statement;
|
|
|
|
|
|
|
|
|
|
this
|
|
|
|
|
(
|
|
|
|
|
Statement env,
|
|
|
|
|
Entity referent
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
super
|
|
|
|
|
(
|
|
|
|
|
format
|
|
|
|
|
(
|
|
|
|
|
"Cannot access entity '%s' with access modifier %s from statement '%s'",
|
|
|
|
|
referent.getName(),
|
|
|
|
|
referent.getAccessorType(),
|
|
|
|
|
env
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|