Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
43173842
Commit
43173842
authored
Dec 04, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support dotted attributes in TreePath
parent
f75b953a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
Cython/Compiler/TreePath.py
Cython/Compiler/TreePath.py
+8
-3
No files found.
Cython/Compiler/TreePath.py
View file @
43173842
...
@@ -144,11 +144,14 @@ def handle_attribute(next, token):
...
@@ -144,11 +144,14 @@ def handle_attribute(next, token):
else:
else:
if token[0] == '=':
if token[0] == '=':
value = parse_path_value(next)
value = parse_path_value(next)
name_path = name.split('.')
if value is None:
if value is None:
def select(result):
def select(result):
for node in result:
for node in result:
try:
try:
attr_value = getattr(node, name)
attr_value = node
for attr in name_path:
attr_value = getattr(attr_value, attr)
except AttributeError:
except AttributeError:
continue
continue
if attr_value is not None:
if attr_value is not None:
...
@@ -157,11 +160,13 @@ def handle_attribute(next, token):
...
@@ -157,11 +160,13 @@ def handle_attribute(next, token):
def select(result):
def select(result):
for node in result:
for node in result:
try:
try:
attr_value = getattr(node, name)
attr_value = node
for attr in name_path:
attr_value = getattr(attr_value, attr)
except AttributeError:
except AttributeError:
continue
continue
if attr_value == value:
if attr_value == value:
yield value
yield
attr_
value
return select
return select
def parse_path_value(next):
def parse_path_value(next):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment