Skip to content

Commit c934c79

Browse files
committed
Make ast::Node::accept() const
Visitors currently can't mutate the AST anyway. Fixes #56.
1 parent 41c6d19 commit c934c79

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

AstNode.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Node {
3030
const yy::location &getLocation() const
3131
{ return location_; }
3232

33-
virtual void accept(visitor::AstVisitor *visitor) = 0;
33+
virtual void accept(visitor::AstVisitor *visitor) const = 0;
3434
};
3535

3636
}

ast/cxx.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def end_type(self, name):
7777
self._print_noncopyable()
7878
print >> self._deferredOutput
7979
self._print_getters()
80-
print >> self._deferredOutput, ' void accept(visitor::AstVisitor *visitor) override;'
80+
print >> self._deferredOutput, ' void accept(visitor::AstVisitor *visitor) const override;'
8181
print >> self._deferredOutput, '};'
8282
print >> self._deferredOutput
8383
print >> self._deferredOutput

ast/cxx_impl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def end_file(self):
2828
print '}'
2929

3030
def start_type(self, name):
31-
print '''void %s::accept(visitor::AstVisitor *visitor) {
31+
print '''void %s::accept(visitor::AstVisitor *visitor) const {
3232
if (visitor->visit%s(*this)) {
3333
''' % (name, name)
3434

0 commit comments

Comments
 (0)