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
878d8413
Commit
878d8413
authored
Dec 04, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
type inference for builtin/extension types
parent
d98a76b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+13
-10
No files found.
Cython/Compiler/ExprNodes.py
View file @
878d8413
...
...
@@ -1073,7 +1073,7 @@ class NameNode(AtomicExprNode):
self
.
name
==
self
.
entry
.
type
.
name
:
# Unfortunately the type attribute of type objects
# is used for the pointer to the type they represent.
return
self
.
entry
.
type
#
type_type
return
type_type
else
:
return
self
.
entry
.
type
...
...
@@ -2400,19 +2400,22 @@ class SimpleCallNode(CallNode):
return
self
.
function
.
type_dependencies
(
env
)
def
infer_type
(
self
,
env
):
func_type
=
self
.
function
.
infer_type
(
env
)
function
=
self
.
function
func_type
=
function
.
infer_type
(
env
)
if
func_type
.
is_ptr
:
func_type
=
func_type
.
base_type
if
func_type
.
is_cfunction
:
return
func_type
.
return_type
elif
func_type
.
is_extension_type
:
return
func_type
elif
func_type
.
is_builtin_type
and
\
func_type
.
name
in
Builtin
.
types_that_construct_their_instance
:
return
func_type
else
:
return
py_object_type
elif
func_type
is
type_type
:
if
function
.
is_name
and
function
.
entry
and
function
.
entry
.
type
:
result_type
=
function
.
entry
.
type
if
result_type
.
is_extension_type
:
return
result_type
elif
result_type
.
is_builtin_type
:
if
function
.
entry
.
name
in
Builtin
.
types_that_construct_their_instance
:
return
result_type
return
py_object_type
def
analyse_as_type
(
self
,
env
):
attr
=
self
.
function
.
as_cython_attribute
()
if
attr
==
'pointer'
:
...
...
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