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
0defd1cf
Commit
0defd1cf
authored
Jul 22, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TreeFragment temporaries bugfix
parent
24e3fe16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
Cython/Compiler/TreeFragment.py
Cython/Compiler/TreeFragment.py
+13
-6
No files found.
Cython/Compiler/TreeFragment.py
View file @
0defd1cf
...
...
@@ -6,6 +6,8 @@ import re
from
cStringIO
import
StringIO
from
Scanning
import
PyrexScanner
,
StringSourceDescriptor
from
Symtab
import
BuiltinScope
,
ModuleScope
import
Symtab
import
PyrexTypes
from
Visitor
import
VisitorTransform
,
temp_name_handle
from
Nodes
import
Node
,
StatListNode
from
ExprNodes
import
NameNode
...
...
@@ -108,11 +110,16 @@ class TemplateTransform(VisitorTransform):
self
.
substitutions
=
substitutions
tempdict
=
{}
for
key
in
temps
:
tempdict
[
key
]
=
temp_name_handle
(
key
)
self
.
temps
=
tempdict
tempdict
[
key
]
=
temp_name_handle
(
key
)
# pending result_code refactor: Symtab.new_temp(PyrexTypes.py_object_type, key)
self
.
temp
_key_to_entrie
s
=
tempdict
self
.
pos
=
pos
return
super
(
TemplateTransform
,
self
).
__call__
(
node
)
def
get_pos
(
self
,
node
):
if
self
.
pos
:
return
self
.
pos
else
:
return
node
.
pos
def
visit_Node
(
self
,
node
):
if
node
is
None
:
...
...
@@ -135,11 +142,11 @@ class TemplateTransform(VisitorTransform):
def
visit_NameNode
(
self
,
node
):
temp
name
=
self
.
temp
s
.
get
(
node
.
name
)
if
temp
name
is
not
None
:
temp
entry
=
self
.
temp_key_to_entrie
s
.
get
(
node
.
name
)
if
temp
entry
is
not
None
:
# Replace name with temporary
node
.
name
=
tempname
return
self
.
visit_Node
(
node
)
return
NameNode
(
self
.
get_pos
(
node
),
name
=
tempentry
)
# Pending result_code refactor: return NameNode(self.get_pos(node), entry=tempentry
)
else
:
return
self
.
try_substitution
(
node
,
node
.
name
)
...
...
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