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
75ab0c6e
Commit
75ab0c6e
authored
Jan 21, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Verbose type inference directive.
parent
58e5be5f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+1
-0
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+6
-0
No files found.
Cython/Compiler/Options.py
View file @
75ab0c6e
...
@@ -63,6 +63,7 @@ directive_defaults = {
...
@@ -63,6 +63,7 @@ directive_defaults = {
'callspec'
:
""
,
'callspec'
:
""
,
'profile'
:
False
,
'profile'
:
False
,
'infer_types'
:
False
,
'infer_types'
:
False
,
'infer_types.verbose'
:
False
,
'autotestdict'
:
True
,
'autotestdict'
:
True
,
'warn'
:
None
,
'warn'
:
None
,
...
...
Cython/Compiler/TypeInference.py
View file @
75ab0c6e
from
Errors
import
error
,
warning
,
warn_once
,
InternalError
import
ExprNodes
import
ExprNodes
import
Nodes
import
Nodes
import
Builtin
import
Builtin
...
@@ -132,6 +133,7 @@ class SimpleAssignmentTypeInferer:
...
@@ -132,6 +133,7 @@ class SimpleAssignmentTypeInferer:
# (Something more powerful than just extending this one...)
# (Something more powerful than just extending this one...)
def
infer_types
(
self
,
scope
):
def
infer_types
(
self
,
scope
):
enabled
=
scope
.
directives
[
'infer_types'
]
enabled
=
scope
.
directives
[
'infer_types'
]
verbose
=
scope
.
directives
[
'infer_types.verbose'
]
if
enabled
==
True
:
if
enabled
==
True
:
spanning_type
=
aggressive_spanning_type
spanning_type
=
aggressive_spanning_type
elif
enabled
is
None
:
# safe mode
elif
enabled
is
None
:
# safe mode
...
@@ -178,6 +180,8 @@ class SimpleAssignmentTypeInferer:
...
@@ -178,6 +180,8 @@ class SimpleAssignmentTypeInferer:
# FIXME: raise a warning?
# FIXME: raise a warning?
# print "No assignments", entry.pos, entry
# print "No assignments", entry.pos, entry
entry
.
type
=
py_object_type
entry
.
type
=
py_object_type
if
verbose
:
warning
(
entry
.
pos
,
"inferred '%s' to be of type '%s'"
%
(
entry
.
name
,
entry
.
type
),
1
)
resolve_dependancy
(
entry
)
resolve_dependancy
(
entry
)
# Deal with simple circular dependancies...
# Deal with simple circular dependancies...
for
entry
,
deps
in
dependancies_by_entry
.
items
():
for
entry
,
deps
in
dependancies_by_entry
.
items
():
...
@@ -197,6 +201,8 @@ class SimpleAssignmentTypeInferer:
...
@@ -197,6 +201,8 @@ class SimpleAssignmentTypeInferer:
# We can't figure out the rest with this algorithm, let them be objects.
# We can't figure out the rest with this algorithm, let them be objects.
for
entry
in
dependancies_by_entry
:
for
entry
in
dependancies_by_entry
:
entry
.
type
=
py_object_type
entry
.
type
=
py_object_type
if
verbose
:
warning
(
entry
.
pos
,
"inferred '%s' to be of type '%s' (default)"
%
(
entry
.
name
,
entry
.
type
),
1
)
def
find_spanning_type
(
type1
,
type2
):
def
find_spanning_type
(
type1
,
type2
):
if
type1
is
type2
:
if
type1
is
type2
:
...
...
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