Skip to content

Commit

Permalink
fixes to pass unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
esquires committed Sep 4, 2017
1 parent fc4bb20 commit 1affd81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ htmlcov/
*.egg*/
.coverage
.travis-solo/
tags
14 changes: 8 additions & 6 deletions cpp/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ def get_template_indices(self, names):

class ASTBuilder(object):

def __init__(self, token_stream, filename, system_includes=[],
nonsystem_includes=[], in_class=None,
def __init__(self, token_stream, filename, system_includes=tuple(),
nonsystem_includes=tuple(), in_class=None,
namespace_stack=None, quiet=False):
if namespace_stack is None:
namespace_stack = []
Expand Down Expand Up @@ -748,21 +748,23 @@ def _generate_one(self, token):
name = name[1:].strip()

filename = name.strip('<>"')
def is_file(prefix):

def _is_file(prefix):
return os.path.isfile(os.path.join(prefix, filename))

if filter(is_file, self.system_includes):
if any([d for d in self.system_includes if _is_file(d)]):
system = True
elif filter(is_file, self.nonsystem_includes):
elif any([d for d in self.nonsystem_includes if _is_file(d)]):
system = False
else:
system = True
filename = name

if name[0] in '<"':
assert_parse(name[-1] in '>"', token)

system = name[0] == '<'
filename = name[1:-1]

return Include(token.start, token.end, filename, system)
if name.startswith('define'):
# Remove "define".
Expand Down

0 comments on commit 1affd81

Please sign in to comment.