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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
bf259422
Commit
bf259422
authored
Jul 15, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix PersistentNode analyse
parent
91ffc474
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+15
-9
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+1
-0
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+1
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
bf259422
...
...
@@ -4037,6 +4037,7 @@ class PersistentNode(ExprNode):
subexprs
=
[
"arg"
]
temp_counter
=
0
generate_counter
=
0
analyse_counter
=
0
result_code
=
None
def
__init__
(
self
,
arg
,
uses
):
...
...
@@ -4045,13 +4046,15 @@ class PersistentNode(ExprNode):
self
.
uses
=
uses
def
analyse_types
(
self
,
env
):
if
self
.
analyse_counter
==
0
:
self
.
arg
.
analyse_types
(
env
)
self
.
type
=
self
.
arg
.
type
self
.
result_ctype
=
self
.
arg
.
result_ctype
self
.
is_temp
=
1
self
.
analyse_counter
+=
1
def
calculate_result_code
(
self
):
return
self
.
arg
.
result_code
return
self
.
result_code
def
generate_evaluation_code
(
self
,
code
):
if
self
.
generate_counter
==
0
:
...
...
@@ -4071,12 +4074,15 @@ class PersistentNode(ExprNode):
def
allocate_temps
(
self
,
env
,
result
=
None
):
if
self
.
temp_counter
==
0
:
self
.
arg
.
allocate_temps
(
env
)
self
.
allocate_temp
(
env
,
result
)
self
.
arg
.
release_temp
(
env
)
self
.
temp_counter
+=
1
def
allocate_temp
(
self
,
env
,
result
=
None
):
if
result
is
None
:
self
.
result_code
=
env
.
allocate_temp
(
self
.
type
)
else
:
self
.
result_code
=
result
self
.
arg
.
release_temp
(
env
)
self
.
temp_counter
+=
1
def
release_temp
(
self
,
env
):
if
self
.
temp_counter
==
self
.
uses
:
...
...
Cython/Compiler/Main.py
View file @
bf259422
...
...
@@ -354,6 +354,7 @@ def create_generate_code(context, options, result):
return
generate_code
def
create_default_pipeline
(
context
,
options
,
result
):
from
Visitor
import
PrintTree
from
ParseTreeTransforms
import
WithTransform
,
NormalizeTree
,
PostParse
from
ParseTreeTransforms
import
AnalyseDeclarationsTransform
,
AnalyseExpressionsTransform
from
ParseTreeTransforms
import
CreateClosureClasses
,
MarkClosureVisitor
,
DecoratorTransform
...
...
Cython/Compiler/Visitor.py
View file @
bf259422
...
...
@@ -213,6 +213,7 @@ class PrintTree(TreeVisitor):
def
__call__
(
self
,
tree
,
phase
=
None
):
print
(
"Parse tree dump at phase '%s'"
%
phase
)
self
.
visit
(
tree
)
return
tree
# Don't do anything about process_list, the defaults gives
# nice-looking name[idx] nodes which will visually appear
...
...
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