(self, token_stream, filename, in_class='', visibility=None,
namespace_stack=[])
| 674 | |
| 675 | class AstBuilder(object): |
| 676 | def __init__(self, token_stream, filename, in_class='', visibility=None, |
| 677 | namespace_stack=[]): |
| 678 | self.tokens = token_stream |
| 679 | self.filename = filename |
| 680 | # TODO(nnorwitz): use a better data structure (deque) for the queue. |
| 681 | # Switching directions of the "queue" improved perf by about 25%. |
| 682 | # Using a deque should be even better since we access from both sides. |
| 683 | self.token_queue = [] |
| 684 | self.namespace_stack = namespace_stack[:] |
| 685 | self.in_class = in_class |
| 686 | if in_class is None: |
| 687 | self.in_class_name_only = None |
| 688 | else: |
| 689 | self.in_class_name_only = in_class.split('::')[-1] |
| 690 | self.visibility = visibility |
| 691 | self.in_function = False |
| 692 | self.current_token = None |
| 693 | # Keep the state whether we are currently handling a typedef or not. |
| 694 | self._handling_typedef = False |
| 695 | |
| 696 | self.converter = TypeConverter(self.namespace_stack) |
| 697 | |
| 698 | def HandleError(self, msg, token): |
| 699 | printable_queue = list(reversed(self.token_queue[-20:])) |
nothing calls this directly
no test coverage detected