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
Gwenaël Samain
cython
Commits
3ab206d3
Commit
3ab206d3
authored
Mar 27, 2012
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LetNode: implement generate_function_definitions() method, fix T766
parent
dd8ac390
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
Cython/Compiler/UtilNodes.py
Cython/Compiler/UtilNodes.py
+5
-0
tests/run/letnode_T766.pyx
tests/run/letnode_T766.pyx
+28
-0
No files found.
Cython/Compiler/UtilNodes.py
View file @
3ab206d3
...
...
@@ -310,6 +310,11 @@ class LetNode(Nodes.StatNode, LetNodeMixin):
self
.
body
.
generate_execution_code
(
code
)
self
.
teardown_temp_expr
(
code
)
def
generate_function_definitions
(
self
,
env
,
code
):
self
.
temp_expression
.
generate_function_definitions
(
env
,
code
)
self
.
body
.
generate_function_definitions
(
env
,
code
)
class
TempResultFromStatNode
(
ExprNodes
.
ExprNode
):
# An ExprNode wrapper around a StatNode that executes the StatNode
# body. Requires a ResultRefNode that it sets up to refer to its
...
...
tests/run/letnode_T766.pyx
0 → 100644
View file @
3ab206d3
# mode: run
# ticket: 766
# tags: letnode
def
test_letnode_range
(
int
n
):
"""
>>> [i() for i in test_letnode_range(5)]
[0, 1, 2, 3, 4]
"""
ret
=
[]
for
i
in
range
(
n
):
def
bar
(
x
=
i
):
return
x
ret
.
append
(
bar
)
return
ret
def
test_letnode_enumerate
(
a
):
"""
>>> [i() for i in test_letnode_enumerate("abc")]
[0, 1, 2]
"""
cdef
int
n
ret
=
[]
for
n
,
i
in
enumerate
(
a
):
def
bar
(
x
=
n
):
return
x
ret
.
append
(
bar
)
return
ret
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