diff options
Diffstat (limited to 'src/ast/path.hpp')
-rw-r--r-- | src/ast/path.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ast/path.hpp b/src/ast/path.hpp index cfdf16c2..4ff128c6 100644 --- a/src/ast/path.hpp +++ b/src/ast/path.hpp @@ -178,8 +178,8 @@ public: ::std::vector<PathNode>& nodes() { return m_nodes; } const ::std::vector<PathNode>& nodes() const { return m_nodes; } - PathNode& operator[](size_t idx) { return m_nodes[idx]; } - const PathNode& operator[](size_t idx) const { return m_nodes[idx]; } + PathNode& operator[](int idx) { if(idx>=0) return m_nodes[idx]; else return m_nodes[size()+idx]; } + const PathNode& operator[](int idx) const { if(idx>=0) return m_nodes[idx]; else return m_nodes[size()+idx]; } bool operator==(const Path& x) const; |