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
cf89a114
Commit
cf89a114
authored
May 08, 2012
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TypeInference: use CF collected assignments
parent
8c5aa3ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+0
-2
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+9
-6
No files found.
Cython/Compiler/Symtab.py
View file @
cf89a114
...
...
@@ -112,7 +112,6 @@ class Entry(object):
# buffer_aux BufferAux or None Extra information needed for buffer variables
# inline_func_in_pxd boolean Hacky special case for inline function in pxd file.
# Ideally this should not be necesarry.
# assignments [ExprNode] List of expressions that get assigned to this entry.
# might_overflow boolean In an arithmetic expression that could cause
# overflow (used for type inference).
# utility_code_definition For some Cython builtins, the utility code
...
...
@@ -193,7 +192,6 @@ class Entry(object):
self.pos = pos
self.init = init
self.overloaded_alternatives = []
self.assignments = []
self.cf_assignments = []
self.cf_references = []
...
...
Cython/Compiler/TypeInference.py
View file @
cf89a114
...
...
@@ -31,7 +31,6 @@ class MarkAssignments(EnvTransform):
if
lhs
.
entry
is
None
:
# TODO: This shouldn't happen...
return
lhs
.
entry
.
assignments
.
append
(
rhs
)
if
self
.
parallel_block_stack
:
parallel_node
=
self
.
parallel_block_stack
[
-
1
]
...
...
@@ -359,8 +358,8 @@ class SimpleAssignmentTypeInferer(object):
entry
.
type
=
py_object_type
continue
all
=
set
()
for
expr
in
entry
.
assignments
:
all
.
update
(
expr
.
type_dependencies
(
scope
))
for
assmt
in
entry
.
cf_
assignments
:
all
.
update
(
assmt
.
rhs
.
type_dependencies
(
scope
))
if
all
:
dependancies_by_entry
[
entry
]
=
all
for
dep
in
all
:
...
...
@@ -384,7 +383,8 @@ class SimpleAssignmentTypeInferer(object):
while
True
:
while
ready_to_infer
:
entry
=
ready_to_infer
.
pop
()
types
=
[
expr
.
infer_type
(
scope
)
for
expr
in
entry
.
assignments
]
types
=
[
assmt
.
rhs
.
infer_type
(
scope
)
for
assmt
in
entry
.
cf_assignments
]
if
types
and
Utils
.
all
(
types
):
entry
.
type
=
spanning_type
(
types
,
entry
.
might_overflow
)
else
:
...
...
@@ -397,10 +397,13 @@ class SimpleAssignmentTypeInferer(object):
# Deal with simple circular dependancies...
for
entry
,
deps
in
dependancies_by_entry
.
items
():
if
len
(
deps
)
==
1
and
deps
==
set
([
entry
]):
types
=
[
expr
.
infer_type
(
scope
)
for
expr
in
entry
.
assignments
if
expr
.
type_dependencies
(
scope
)
==
()]
types
=
[
assmt
.
rhs
.
infer_type
(
scope
)
for
assmt
in
entry
.
cf_assignments
if
assmt
.
rhs
.
type_dependencies
(
scope
)
==
()]
if
types
:
entry
.
type
=
spanning_type
(
types
,
entry
.
might_overflow
)
types
=
[
expr
.
infer_type
(
scope
)
for
expr
in
entry
.
assignments
]
types
=
[
assmt
.
rhs
.
infer_type
(
scope
)
for
assmt
in
entry
.
cf_assignments
]
entry
.
type
=
spanning_type
(
types
,
entry
.
might_overflow
)
# might be wider...
resolve_dependancy
(
entry
)
del
dependancies_by_entry
[
entry
]
...
...
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