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 2015 Henrik Tidefelt
22 #include "identifier.h"
24 #include "Shapes_Ast_decls.h"
25 #include "Shapes_Kernel_decls.h"
37 virtual ~CoreLocation( );
39 virtual void show( std::ostream
& os
) const = 0;
42 std::ostream
& operator << ( std::ostream
& os
, const CoreLocation
& self
);
44 class CharPtrLocation
: public CoreLocation
48 CharPtrLocation( const char * loc
);
49 virtual ~CharPtrLocation( );
50 virtual void show( std::ostream
& os
) const;
53 class CharRefPtrLocation
: public CoreLocation
55 RefCountPtr
< const char > loc_
;
57 CharRefPtrLocation( const RefCountPtr
< const char > & loc
);
58 virtual ~CharRefPtrLocation( );
59 virtual void show( std::ostream
& os
) const;
62 class BoundLocation
: public CoreLocation
64 Ast::PlacedIdentifier loc_
;
65 Ast::Identifier::Type type_
;
67 BoundLocation( const Ast::PlacedIdentifier
& loc
, Ast::Identifier::Type type
= Ast::Identifier::VARIABLE
);
68 virtual ~BoundLocation( );
69 virtual void show( std::ostream
& os
) const;
72 class MethodLocation
: public CoreLocation
74 Kernel::MethodId method_
;
76 MethodLocation( const Kernel::MethodId method
);
77 virtual ~MethodLocation( );
78 virtual void show( std::ostream
& os
) const;
81 class MutatorLocation
: public CoreLocation
83 RefCountPtr
< const ::Shapes::Lang::Class
> class_
;
86 MutatorLocation( const Kernel::State
* state
, const char * name
);
87 virtual ~MutatorLocation( );
88 virtual void show( std::ostream
& os
) const;
91 /* Location based on FileID, presenting itself by means of
94 class FileIDLocation
: public CoreLocation
96 const Ast::FileID
* fileID_
; /* All FileID pointers are owned by FileID. */
98 FileIDLocation( const Ast::FileID
* fileID
);
99 virtual ~FileIDLocation( );
100 virtual void show( std::ostream
& os
) const;