1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008, 2009 Henrik Tidefelt
21 #include "shapesexceptions.h"
27 class IllegalFinalReference
: public RuntimeError
29 RefCountPtr
< const char > valueType
;
32 IllegalFinalReference( RefCountPtr
< const char > _valueType
, const char * _fieldID
);
33 virtual ~IllegalFinalReference( );
34 virtual void display( std::ostream
& os
) const;
37 class ProtectedMemberPublicScope
: public RuntimeError
39 RefCountPtr
< const char > valueType
;
42 ProtectedMemberPublicScope( RefCountPtr
< const char > _valueType
, const char * _fieldID
);
43 virtual ~ProtectedMemberPublicScope( );
44 virtual void display( std::ostream
& os
) const;
47 class MemberNotAssignable
: public RuntimeError
49 RefCountPtr
< const char > valueType
;
51 RefCountPtr
< const char > scope
;
53 MemberNotAssignable( RefCountPtr
< const char > _valueType
, const char * _fieldID
, RefCountPtr
< const char > _scope
);
54 virtual ~MemberNotAssignable( );
55 virtual void display( std::ostream
& os
) const;
58 class InstantiatingAbstractClass
: public RuntimeError
60 RefCountPtr
< const Lang::Class
> cls
;
62 InstantiatingAbstractClass( RefCountPtr
< const Lang::Class
> _cls
);
63 virtual ~InstantiatingAbstractClass( );
64 virtual void display( std::ostream
& os
) const;
67 class FailedToDeclareClassAbstract
: public RuntimeError
69 RefCountPtr
< const Lang::Class
> cls
;
70 const Shapes::Ast::ClassFunction
* classExpr
;
72 FailedToDeclareClassAbstract( RefCountPtr
< const Lang::Class
> _cls
, const Shapes::Ast::ClassFunction
* _classExpr
);
73 virtual ~FailedToDeclareClassAbstract( );
74 virtual void display( std::ostream
& os
) const;
77 class RepeatedImmediateParent
: public RuntimeError
79 RefCountPtr
< const Lang::Class
> cls
;
80 RefCountPtr
< const Lang::Class
> parent
;
82 RepeatedImmediateParent( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
);
83 virtual ~RepeatedImmediateParent( );
84 virtual void display( std::ostream
& os
) const;
87 class OverridingNonParent
: public RuntimeError
89 RefCountPtr
< const Lang::Class
> cls
;
90 RefCountPtr
< const Lang::Class
> parent
;
92 OverridingNonParent( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
);
93 virtual ~OverridingNonParent( );
94 virtual void display( std::ostream
& os
) const;
97 class InheritingFinal
: public RuntimeError
99 RefCountPtr
< const Lang::Class
> cls
;
100 RefCountPtr
< const Lang::Class
> parent
;
102 InheritingFinal( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
);
103 virtual ~InheritingFinal( );
104 virtual void display( std::ostream
& os
) const;
107 class OverridingUndeclaredMethod
: public RuntimeError
109 RefCountPtr
< const Lang::Class
> cls
;
110 RefCountPtr
< const Lang::Class
> parent
;
113 OverridingUndeclaredMethod( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
, const char * _id
);
114 virtual ~OverridingUndeclaredMethod( );
115 virtual void display( std::ostream
& os
) const;
118 class OverridingFinalMethod
: public RuntimeError
120 RefCountPtr
< const Lang::Class
> cls
;
121 RefCountPtr
< const Lang::Class
> parent
;
124 OverridingFinalMethod( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
, const char * _id
);
125 virtual ~OverridingFinalMethod( );
126 virtual void display( std::ostream
& os
) const;
129 class IllegalRepeatedBase
: public RuntimeError
131 RefCountPtr
< const Lang::Class
> cls
;
132 RefCountPtr
< const Lang::Class
> parent
;
134 IllegalRepeatedBase( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
);
135 virtual ~IllegalRepeatedBase( );
136 virtual void display( std::ostream
& os
) const;
139 class AmbiguousInheritedMethod
: public RuntimeError
141 RefCountPtr
< const Lang::Class
> cls
;
142 RefCountPtr
< const char > id
;
143 std::set
< RefCountPtr
< const Lang::Class
> > parents
;
145 AmbiguousInheritedMethod( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const char > _id
, std::set
< RefCountPtr
< const Lang::Class
> > _parents
);
146 virtual ~AmbiguousInheritedMethod( );
147 virtual void display( std::ostream
& os
) const;
150 class MisplacedSuperReference
: public RuntimeError
153 MisplacedSuperReference( const Ast::SourceLocation
& _loc
);
154 virtual ~MisplacedSuperReference( );
155 virtual void display( std::ostream
& os
) const;
158 class SuperReferenceClassNotParent
: public RuntimeError
160 RefCountPtr
< const Lang::Class
> cls
;
161 RefCountPtr
< const Lang::Class
> parent
;
163 SuperReferenceClassNotParent( RefCountPtr
< const Lang::Class
> _cls
, RefCountPtr
< const Lang::Class
> _parent
);
164 virtual ~SuperReferenceClassNotParent( );
165 virtual void display( std::ostream
& os
) const;
168 class NoSuchMethod
: public RuntimeError
170 RefCountPtr
< const Lang::Class
> cls
;
171 Kernel::MethodId method
;
173 NoSuchMethod( RefCountPtr
< const Lang::Class
> _cls
, const Kernel::MethodId
& _method
);
174 virtual ~NoSuchMethod( );
175 virtual void display( std::ostream
& os
) const;
178 class NoSuchLocalMethod
: public RuntimeError
180 RefCountPtr
< const Lang::Class
> cls
;
181 Kernel::MethodId method
;
183 NoSuchLocalMethod( RefCountPtr
< const Lang::Class
> _cls
, const Kernel::MethodId
& _method
);
184 virtual ~NoSuchLocalMethod( );
185 virtual void display( std::ostream
& os
) const;