oftlisp/
location.rs

1use gc::Gc;
2
3use reader::SourceLocation;
4use symbol::Symbol;
5
6/// The location a [`Value`](enum.Value.html) originated from. See
7/// [`WithLocation`](struct.WithLocation.html).
8#[derive(Clone, Debug, Finalize, PartialEq, Trace)]
9pub enum Location {
10    /// The value did not come from an annotated location.
11    None,
12
13    /// The value was read from a file.
14    Source(SourceLocation),
15
16    /// The value was constructed by a macro.
17    Macro {
18        /// The location at which the macro was defined.
19        macro_location: Gc<Location>,
20
21        /// The name of the macro.
22        macro_name: Symbol,
23    },
24}
25
26impl Default for Location {
27    fn default() -> Location {
28        Location::None
29    }
30}