Skip to content

Commit

Permalink
Make ast::Node::accept() const
Browse files Browse the repository at this point in the history
Visitors currently can't mutate the AST anyway. Fixes #56.
  • Loading branch information
swolchok committed Oct 16, 2017
1 parent 41c6d19 commit c934c79
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion AstNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Node {
const yy::location &getLocation() const
{ return location_; }

virtual void accept(visitor::AstVisitor *visitor) = 0;
virtual void accept(visitor::AstVisitor *visitor) const = 0;
};

}
Expand Down
2 changes: 1 addition & 1 deletion ast/cxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def end_type(self, name):
self._print_noncopyable()
print >> self._deferredOutput
self._print_getters()
print >> self._deferredOutput, ' void accept(visitor::AstVisitor *visitor) override;'
print >> self._deferredOutput, ' void accept(visitor::AstVisitor *visitor) const override;'
print >> self._deferredOutput, '};'
print >> self._deferredOutput
print >> self._deferredOutput
Expand Down
2 changes: 1 addition & 1 deletion ast/cxx_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def end_file(self):
print '}'

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

Expand Down

0 comments on commit c934c79

Please sign in to comment.